Skip to main content

Keepalive

Trait Keepalive 

Source
pub trait Keepalive: Send + Sync {
    // Required methods
    fn addr(&self) -> usize;
    fn size(&self) -> usize;

    // Provided method
    fn downgrade(&self) -> Option<Arc<dyn WeakKeepalive>> { ... }
}
Expand description

Trait for values that keep a backing memory allocation alive and know its address and size.

As long as a value implementing this trait exists, the memory region it describes is guaranteed to remain valid.

Required Methods§

Source

fn addr(&self) -> usize

Start address of the memory region this keepalive pins.

Source

fn size(&self) -> usize

Size in bytes of the memory region this keepalive pins.

Provided Methods§

Source

fn downgrade(&self) -> Option<Arc<dyn WeakKeepalive>>

Produce a WeakKeepalive pointing at the same underlying resource. Defaults to None for impls with no weak form.

Implementations on Foreign Types§

Source§

impl Keepalive for Box<[u8]>

Source§

fn addr(&self) -> usize

Source§

fn size(&self) -> usize

Implementors§