bevy_ecs::intern

Trait Internable

Source
pub trait Internable: Hash + Eq {
    // Required methods
    fn leak(&self) -> &'static Self;
    fn ref_eq(&self, other: &Self) -> bool;
    fn ref_hash<H: Hasher>(&self, state: &mut H);
}
Expand description

A trait for internable values.

This is used by Interner<T> to create static references for values that are interned.

Required Methods§

Source

fn leak(&self) -> &'static Self

Creates a static reference to self, possibly leaking memory.

Source

fn ref_eq(&self, other: &Self) -> bool

Returns true if the two references point to the same value.

Source

fn ref_hash<H: Hasher>(&self, state: &mut H)

Feeds the reference to the hasher.

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.

Implementations on Foreign Types§

Source§

impl Internable for str

Source§

fn leak(&self) -> &'static Self

Source§

fn ref_eq(&self, other: &Self) -> bool

Source§

fn ref_hash<H: Hasher>(&self, state: &mut H)

Implementors§