Struct cybergrape::spatial_data_format::GrapeFileBuilder
source · pub struct GrapeFileBuilder {
sample_rate: u64,
streams: Vec<(GrapeTag, Vec<f32>)>,
}
Expand description
This builder contains the data required
Fields§
§sample_rate: u64
§streams: Vec<(GrapeTag, Vec<f32>)>
Implementations§
source§impl GrapeFileBuilder
impl GrapeFileBuilder
sourcefn new() -> Self
fn new() -> Self
Instaintiate a builder with no streams and a default sample rate of 1000 samples per second.
sourcepub fn set_samplerate(self, sample_rate: u64) -> Self
pub fn set_samplerate(self, sample_rate: u64) -> Self
Sets the sample rate of the builder to the argument.
sourcepub fn add_stream(self, stream: &[f32], tag: GrapeTag) -> Self
pub fn add_stream(self, stream: &[f32], tag: GrapeTag) -> Self
Adds a tagged stream to the builder.
sourcepub fn clear_streams(self) -> Self
pub fn clear_streams(self) -> Self
Removes all streams from the builder
sourcepub fn build_truncate(self) -> GrapeFile
pub fn build_truncate(self) -> GrapeFile
Builds a GrapeFile from the builder, truncating all streams to the length of the shortest stream.
sourcepub fn build_extend(self) -> GrapeFile
pub fn build_extend(self) -> GrapeFile
Builds a GrapeFile from the builder, extending all streams with the last value recorded in each stream.
sourcepub fn build(self) -> Result<GrapeFile, GrapeFileError>
pub fn build(self) -> Result<GrapeFile, GrapeFileError>
Builds a GrapeFile from a builder, returning the GrapeFile if all streams are of the same length, and GrapeFileError::UnequalSampleBufferLengths otherwise.
Trait Implementations§
source§impl Clone for GrapeFileBuilder
impl Clone for GrapeFileBuilder
source§fn clone(&self) -> GrapeFileBuilder
fn clone(&self) -> GrapeFileBuilder
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for GrapeFileBuilder
impl Debug for GrapeFileBuilder
Auto Trait Implementations§
impl Freeze for GrapeFileBuilder
impl RefUnwindSafe for GrapeFileBuilder
impl Send for GrapeFileBuilder
impl Sync for GrapeFileBuilder
impl Unpin for GrapeFileBuilder
impl UnwindSafe for GrapeFileBuilder
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more