Skip to main content

MetadataFrameRef

Struct MetadataFrameRef 

Source
pub struct MetadataFrameRef<'rx> { /* private fields */ }
Expand description

A zero-copy borrowed metadata frame.

This type wraps an RAII guard that owns the NDI frame buffer lifetime, exposing a safe, zero-copy view of the metadata string. The frame is automatically freed when dropped through its receiver or sender’s matching metadata release.

Key characteristics:

  • Zero allocations: References NDI SDK buffers directly
  • Zero copies: No string duplication
  • RAII lifetime: Exactly one free per frame, enforced at compile time
  • Send + Sync: Captured metadata can be processed on a scoped worker thread

§Examples

// Zero-copy capture
if let Some(frame) = receiver.capture_metadata_ref(Duration::from_millis(1000))? {
    println!("Metadata: {}", frame.data());

    // Frame is freed here when `frame` goes out of scope
}

Implementations§

Source§

impl<'rx> MetadataFrameRef<'rx>

Source

pub fn timecode(&self) -> Timecode

Get the timecode.

Source

pub fn data(&self) -> &str

Get a zero-copy view of the metadata text.

This returns a reference directly into the NDI SDK’s buffer. No allocation or string copying is performed.

Source

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

Get a zero-copy view of the metadata UTF-8 payload bytes, excluding the SDK trailing NUL terminator.

Source

pub fn to_owned(&self) -> MetadataFrame

Convert this borrowed frame to an owned MetadataFrame.

This performs a string copy, allowing the frame to outlive the NDI buffer and be sent across threads.

Source

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

Copy text and timecode into an existing owned frame. Reuses its text allocation when its capacity holds the text and trailing NUL.

Trait Implementations§

Source§

impl<'rx> Debug for MetadataFrameRef<'rx>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> MetadataSource for MetadataFrameRef<'a>

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.

Auto Trait Implementations§

§

impl<'rx> Freeze for MetadataFrameRef<'rx>

§

impl<'rx> RefUnwindSafe for MetadataFrameRef<'rx>

§

impl<'rx> Send for MetadataFrameRef<'rx>

§

impl<'rx> Sync for MetadataFrameRef<'rx>

§

impl<'rx> Unpin for MetadataFrameRef<'rx>

§

impl<'rx> UnsafeUnpin for MetadataFrameRef<'rx>

§

impl<'rx> UnwindSafe for MetadataFrameRef<'rx>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.