Skip to main content

Module collection

Module collection 

Source
Expand description

The SigMF collection object (.sigmf-collection files).

A collection groups related recordings, for example the channels of a phased-array capture. Its single top-level collection object carries core:version, optional descriptive fields, core:extensions, and core:streams: a list of RecordingRefs naming each recording’s metadata file and its SHA-512 digest.

Collection is the whole document and CollectionMetadata is the collection object. Unknown top-level and collection fields, including extension fields, are preserved. Legacy [name, hash] stream tuples are accepted when reading; see Collection::to_vec_preserving_stream_forms to write them back in that form. Use Collection::validate to check a collection against the specification.

§Example

use sigmf::collection::{Collection, CollectionMetadata};
use sigmf::recording::RecordingRef;

let mut metadata = CollectionMetadata::new(
    "1.2.6",
    vec![RecordingRef::new("channel-0", &"0".repeat(128))],
);
metadata.description = Some("two-channel capture".into());
let collection = Collection::new(metadata);

let bytes = collection.to_vec()?;
let parsed = Collection::from_slice(&bytes)?;
assert_eq!(parsed.collection.streams[0].get_name(), "channel-0");

Structs§

Collection
A complete .sigmf-collection document.
CollectionMetadata
The collection object of a .sigmf-collection document.