Skip to main content

FrameMetaSet

Struct FrameMetaSet 

Source
pub struct FrameMetaSet(/* private fields */);
Expand description

A list of typed FrameMeta attached to a frame. Empty (no allocation) on a freshly constructed frame.

Each entry is an Arc so a fan-out (tee) clone shares the metadata by refcount instead of deep-copying it (cheap, and the analytics graph is identical on both branches). A branch that mutates one entry pays a copy-on-write deep copy only then (see get_mut), so the other branch never observes the change.

Implementations§

Source§

impl FrameMetaSet

Source

pub fn new() -> Self

An empty metadata set with no backing allocation.

Source

pub fn attach<T: FrameMeta + 'static>(&mut self, meta: T)

Attach one piece of metadata, replacing any entry of the same type (in place, so the order of the other entries is unchanged).

A set holds at most one meta per type: get / get_mut key by type, so a second entry of a type would be unreachable, and an empty one already on the frame would hide what an element attaches later.

Source

pub fn get<T: FrameMeta + 'static>(&self) -> Option<&T>

The attached meta of type T, if any. At most one is ever attached (see attach).

Source

pub fn get_mut<T: FrameMeta + 'static>(&mut self) -> Option<&mut T>

Mutable access to the attached meta of type T, if any (at most one is ever attached, see attach).

Copy-on-write: if the entry is shared with another frame (a tee branch holds the same Arc), it is first deep-copied via FrameMeta::clone_box so this mutation stays private to this frame. When the entry is uniquely owned no copy is made.

Source

pub fn iter(&self) -> impl Iterator<Item = &dyn FrameMeta>

Iterate every attached meta as a trait object.

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn propagate(&mut self, transform: Transform)

Apply a Transform: retain only metas whose propagate returns Propagation::Keep. An element that resamples / re-encodes calls this so stale meta never rides a frame it no longer describes.

Trait Implementations§

Source§

impl Clone for FrameMetaSet

Source§

fn clone(&self) -> FrameMetaSet

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FrameMetaSet

Source§

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

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

impl Default for FrameMetaSet

Source§

fn default() -> FrameMetaSet

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ElementBound for T
where T: Send,

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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, <T as TryFrom<U>>::Error>

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.