Skip to main content

MetadataSource

Trait MetadataSource 

Source
pub trait MetadataSource: MetadataParts {
    // Required methods
    fn data(&self) -> &str;
    fn as_bytes(&self) -> &[u8] ⓘ;
    fn timecode(&self) -> Timecode;
    fn to_owned(&self) -> MetadataFrame;
    fn copy_into(&self, destination: &mut MetadataFrame);
}
Expand description

A validated metadata input for sending, connection metadata and recording.

Implemented by MetadataFrame and MetadataFrameRef. Both can be sent directly, including through &dyn MetadataSource, without a wrapper string allocation or copy in synchronous sends. For connection registrations, the receiver or router retains its own copy; senders use the SDK’s documented copy. A captured input may be released as soon as the operation returns. Async recording copies the text immediately into its deferred command. The source’s timecode is preserved in every operation.

This trait is sealed: applications cannot supply unchecked native pointers.

Required Methods§

Source

fn data(&self) -> &str

The UTF-8 text without its trailing NUL. Empty metadata returns "".

Source

fn as_bytes(&self) -> &[u8] ⓘ

The payload bytes, excluding the trailing NUL.

Source

fn timecode(&self) -> Timecode

The source timecode, including Timecode::SYNTHESIZE when requested.

Source

fn to_owned(&self) -> MetadataFrame

Copy the text and timecode into an independently owned frame.

Source

fn copy_into(&self, destination: &mut MetadataFrame)

Copy into an existing frame, reusing its text allocation when its capacity holds the text and trailing NUL, even when the length changes.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§