ObjectArena

Trait ObjectArena 

Source
pub trait ObjectArena: 'static + Default {
    type Object: Object<Handle = Self::Handle, Arena = Self>;
    type Handle: Handle<Object = Self::Object>;

    // Required methods
    fn try_get(handle: Self::Handle, w: Wr<'_>) -> Option<&Self::Object>;
    fn try_get_mut(handle: Self::Handle, w: W<'_>) -> Option<&mut Self::Object>;
    fn as_strong_if_alive(
        handle: Self::Handle,
        w: W<'_>,
    ) -> Option<Strong<Self::Handle>>;
    fn print_debug(
        f: &mut Formatter<'_>,
        handle: Self::Handle,
        w: Wr<'_>,
    ) -> Result;
}
Expand description

A custom arena managing a specific type of Object.

This is likely only relevant to you if you are implementing a custom arena.

Required Associated Types§

Source

type Object: Object<Handle = Self::Handle, Arena = Self>

The Object being managed by the arena.

Source

type Handle: Handle<Object = Self::Object>

The Handle being managed by the arena.

Required Methods§

Source

fn try_get(handle: Self::Handle, w: Wr<'_>) -> Option<&Self::Object>

Implements the Handle::try_r operation.

Source

fn try_get_mut(handle: Self::Handle, w: W<'_>) -> Option<&mut Self::Object>

Implements the Handle::try_m operation.

Source

fn as_strong_if_alive( handle: Self::Handle, w: W<'_>, ) -> Option<Strong<Self::Handle>>

Implements the Handle::as_strong_if_alive operation.

Source

fn print_debug(f: &mut Formatter<'_>, handle: Self::Handle, w: Wr<'_>) -> Result

Implements the Handle’s fmt::Debug operation.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> ObjectArena for DefaultObjectArena<T>
where T: Object<Arena = Self> + Debug,