Skip to main content

Arena

Struct Arena 

Source
pub struct Arena<T: ?Sized, Storage = T> { /* private fields */ }
Expand description

Interning arena for values of type T, storing them with the given Storage type (that needs to be Sized).

For Sized values, Storage = T is a good default that incurs no overhead. For non-Sized values such as str, you need to specify a Sized storage type, such as Box<T>.

Implementations§

Source§

impl<T: ?Sized, Storage> Arena<T, Storage>
where Storage: GetSize,

Source

pub fn print_summary(&self, prefix: &str, title: &str, total_bytes: usize)

Available on crate feature debug only.

Prints a summary of the storage used by this arena to stdout.

Trait Implementations§

Source§

impl<T, Storage> Debug for Arena<T, Storage>
where T: Debug + ?Sized, Storage: Borrow<T>,

Source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: ?Sized, Storage> Default for Arena<T, Storage>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de, T, Storage> Deserialize<'de> for Arena<T, Storage>
where T: Eq + Hash + ?Sized, Storage: Borrow<T> + Deserialize<'de>,

Available on crate feature serde only.
Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<T: ?Sized, Storage> GetSize for Arena<T, Storage>
where Storage: GetSize,

Available on crate feature get-size2 only.
Source§

fn get_heap_size_with_tracker<Tr: GetSizeTracker>( &self, tracker: Tr, ) -> (usize, Tr)

Determines how many bytes this object occupies inside the heap while using a tracker. Read more
Source§

fn get_stack_size() -> usize

Determines how may bytes this object occupies inside the stack. Read more
Source§

fn get_heap_size(&self) -> usize

Determines how many bytes this object occupies inside the heap. Read more
Source§

fn get_size(&self) -> usize

Determines the total size of the object. Read more
Source§

fn get_size_with_tracker<T>(&self, tracker: T) -> (usize, T)
where T: GetSizeTracker,

Determines the total size of the object while using a tracker. Read more
Source§

impl<T, Storage> PartialEq for Arena<T, Storage>
where T: Eq + ?Sized, Storage: Borrow<T>,

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T, Storage> Serialize for Arena<T, Storage>
where T: Serialize + ?Sized, Storage: Borrow<T>,

Available on crate feature serde only.
Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<T, Storage> Eq for Arena<T, Storage>
where T: Eq + ?Sized, Storage: Borrow<T>,

Auto Trait Implementations§

§

impl<T, Storage = T> !Freeze for Arena<T, Storage>

§

impl<T, Storage = T> !RefUnwindSafe for Arena<T, Storage>

§

impl<T, Storage> Send for Arena<T, Storage>
where Storage: Send + Sync, T: ?Sized,

§

impl<T, Storage> Sync for Arena<T, Storage>
where Storage: Send + Sync, T: ?Sized,

§

impl<T, Storage> Unpin for Arena<T, Storage>
where T: ?Sized,

§

impl<T, Storage> UnwindSafe for Arena<T, Storage>
where Storage: RefUnwindSafe, T: ?Sized,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,