pub struct AnnotationBuilder { /* private fields */ }Expand description
Builder for Annotation that validates frequency bounds on
build.
Create one with Annotation::builder or AnnotationBuilder::new.
All fields other than core:sample_start start unset. The built
annotation has no extra fields.
Implementations§
Source§impl AnnotationBuilder
impl AnnotationBuilder
Sourcepub fn new(sample_start: Integer) -> Self
pub fn new(sample_start: Integer) -> Self
Creates a builder for an annotation beginning at sample_start
(core:sample_start), with all other fields unset.
Sourcepub fn sample_count(self, sample_count: Integer) -> Self
pub fn sample_count(self, sample_count: Integer) -> Self
Sets the number of annotated samples (core:sample_count).
Zero is accepted.
Sourcepub fn frequency_range(self, lower: Number, upper: Number) -> Self
pub fn frequency_range(self, lower: Number, upper: Number) -> Self
Sets the lower and upper frequency edges in Hz
(core:freq_lower_edge and core:freq_upper_edge).
The bounds are validated by build.
Sourcepub fn label(self, label: impl Into<String>) -> Self
pub fn label(self, label: impl Into<String>) -> Self
Sets the short human-readable label (core:label).
Sourcepub fn comment(self, comment: impl Into<String>) -> Self
pub fn comment(self, comment: impl Into<String>) -> Self
Sets the free-text comment (core:comment).
Sourcepub fn generator(self, generator: impl Into<String>) -> Self
pub fn generator(self, generator: impl Into<String>) -> Self
Sets the name of the annotation’s creator (core:generator).
Sourcepub fn uuid(self, uuid: impl Into<String>) -> Self
pub fn uuid(self, uuid: impl Into<String>) -> Self
Sets the annotation UUID (core:uuid).
The value is not checked to be a valid UUID.
Sourcepub fn build(self) -> Result<Annotation, SigmfError>
pub fn build(self) -> Result<Annotation, SigmfError>
Validates the frequency bounds and builds the Annotation.
§Errors
Returns crate::SigmfError::InvalidMetadata if frequency bounds were
supplied and either bound is not finite, or the lower bound exceeds the
upper bound.
Trait Implementations§
Source§impl Clone for AnnotationBuilder
impl Clone for AnnotationBuilder
Auto Trait Implementations§
impl Freeze for AnnotationBuilder
impl RefUnwindSafe for AnnotationBuilder
impl Send for AnnotationBuilder
impl Sync for AnnotationBuilder
impl Unpin for AnnotationBuilder
impl UnsafeUnpin for AnnotationBuilder
impl UnwindSafe for AnnotationBuilder
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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