This commit is contained in:
Martin Kavík 2024-06-01 19:39:19 +02:00
parent 645e03ea86
commit ea38f61058
14 changed files with 123 additions and 19 deletions

View file

@ -6,3 +6,6 @@ repository.workspace = true
authors.workspace = true
readme.workspace = true
publish.workspace = true
[dependencies]
wellen.workspace = true

View file

@ -1 +1 @@
pub mod wellen_helpers;

View file

@ -0,0 +1,15 @@
use wellen::{simple::Waveform, *};
pub fn read_from_bytes(bytes: Vec<u8>) -> Result<Waveform> {
read_from_bytes_with_options(bytes, &LoadOptions::default())
}
pub fn read_from_bytes_with_options(bytes: Vec<u8>, options: &LoadOptions) -> Result<Waveform> {
let header = viewers::read_header_from_bytes(bytes, options)?;
let body = viewers::read_body(header.body, &header.hierarchy, None)?;
Ok(Waveform::new(
header.hierarchy,
body.source,
body.time_table,
))
}