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
impl FrameMetaSet
Sourcepub fn attach<T: FrameMeta + 'static>(&mut self, meta: T)
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.
Sourcepub fn get<T: FrameMeta + 'static>(&self) -> Option<&T>
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).
Sourcepub fn get_mut<T: FrameMeta + 'static>(&mut self) -> Option<&mut T>
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.
Sourcepub fn iter(&self) -> impl Iterator<Item = &dyn FrameMeta>
pub fn iter(&self) -> impl Iterator<Item = &dyn FrameMeta>
Iterate every attached meta as a trait object.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn propagate(&mut self, transform: Transform)
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
impl Clone for FrameMetaSet
Source§fn clone(&self) -> FrameMetaSet
fn clone(&self) -> FrameMetaSet
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more