Skip to main content

AnyFrameMeta

Trait AnyFrameMeta 

Source
pub unsafe trait AnyFrameMeta:
    Any
    + Send
    + Sync {
    // Provided methods
    fn on_drop(&mut self, _reader: &mut VmReader<'_, Infallible>) { ... }
    fn is_untyped(&self) -> bool { ... }
}
Expand description

All frame metadata types must implement this trait.

If a frame type needs specific drop behavior, it should specify when implementing this trait. When we drop the last handle to this frame, the on_drop method will be called. The on_drop method is called with the physical address of the frame.

The implemented structure should have a size less than or equal to FRAME_METADATA_MAX_SIZE and an alignment less than or equal to FRAME_METADATA_MAX_ALIGN. Otherwise, the metadata type cannot be used because storing it will fail compile-time assertions.

§Safety

If on_drop reads the page using the provided VmReader, the implementer must ensure that the frame is safe to read.

Provided Methods§

Source

fn on_drop(&mut self, _reader: &mut VmReader<'_, Infallible>)

Called when the last handle to the frame is dropped.

Source

fn is_untyped(&self) -> bool

Whether the metadata’s associated frame is untyped.

If a type implements AnyUFrameMeta, this should be true. Otherwise, it should be false.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl AnyFrameMeta for ()

Source§

fn is_untyped(&self) -> bool

Implementors§