pub struct Annotation {
pub sample_start: usize,
pub sample_count: Option<usize>,
pub label: Option<String>,
pub comment: Option<String>,
pub freq_lower_edge: Option<f64>,
pub freq_upper_edge: Option<f64>,
}Expand description
An annotation of a SigMF recording.
Fields§
§sample_start: usizecore:sample_start.
sample_count: Option<usize>core:sample_count (to the end of the recording when absent).
label: Option<String>core:label (a short name: the modulation, the emitter, …).
comment: Option<String>core:comment.
freq_lower_edge: Option<f64>core:freq_lower_edge (Hz).
freq_upper_edge: Option<f64>core:freq_upper_edge (Hz).
Implementations§
Source§impl Annotation
impl Annotation
Sourcepub const KEYS: [&'static str; 6]
pub const KEYS: [&'static str; 6]
The keys of Annotation::from_mapping.
Sourcepub fn from_mapping(a: &Json) -> Result<Annotation>
pub fn from_mapping(a: &Json) -> Result<Annotation>
An annotation from a mapping of the keys of Annotation::KEYS (the SigMF keys
without their core: prefix), as the Python bindings take it: sample_start is
required, the others are optional.
§Errors
Error::Config for another key, or a missing or negative sample_start.
§Examples
use comnum_spec::io::Annotation;
let a = Annotation::from_mapping(&serde_json::json!({"sample_start": 3, "label": "QPSK"}))?;
assert_eq!((a.sample_start, a.label.as_deref()), (3, Some("QPSK")));
assert!(Annotation::from_mapping(&serde_json::json!({"sample_start": 3, "start": 1})).is_err());Trait Implementations§
Source§impl Clone for Annotation
impl Clone for Annotation
Source§impl Debug for Annotation
impl Debug for Annotation
Source§impl Default for Annotation
impl Default for Annotation
Source§impl PartialEq for Annotation
impl PartialEq for Annotation
impl StructuralPartialEq for Annotation
Auto Trait Implementations§
impl Forget for Annotation
impl Freeze for Annotation
impl RefUnwindSafe for Annotation
impl Send for Annotation
impl Sync for Annotation
impl Unpin for Annotation
impl UnsafeUnpin for Annotation
impl UnwindSafe for Annotation
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§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