Struct allocative::Visitor

source ·
pub struct Visitor<'a> { /* private fields */ }

Implementations§

source§

impl<'a> Visitor<'a>

source

pub fn enter<'b>(&'b mut self, name: Key, size: usize) -> Visitor<'b>
where 'a: 'b,

source

pub fn enter_unique<'b>(&'b mut self, name: Key, size: usize) -> Visitor<'b>
where 'a: 'b,

source

pub fn enter_shared<'b>( &'b mut self, name: Key, size: usize, ptr: *const () ) -> Option<Visitor<'b>>
where 'a: 'b,

Enter a field containing a shared pointer.

This functions does nothing and returns None if pointee (ptr argument) was previously visited.

source

pub fn enter_self_sized<'b, T>(&'b mut self) -> Visitor<'b>
where 'a: 'b,

This function is typically called as the first function of an Allocative implementation to record self.

source

pub fn enter_self<'b, T: ?Sized>(&'b mut self, this: &T) -> Visitor<'b>
where 'a: 'b,

This function is typically called as first function of an Allocative implementation to record self.

source

pub fn visit_simple<'b>(&'b mut self, name: Key, size: usize)
where 'a: 'b,

Visit simple sized field (e.g. u32) without descending into children.

source

pub fn visit_simple_sized<'b, T>(&'b mut self)
where 'a: 'b,

Visit simple sized field (e.g. u32) without descending into children.

source

pub fn visit_field<'b, T: Allocative + ?Sized>( &'b mut self, name: Key, field: &T )
where 'a: 'b,

source

pub fn visit_field_with<'b, 'f, F: for<'c, 'd> FnOnce(&'d mut Visitor<'c>)>( &'b mut self, name: Key, field_size: usize, visit: F )

Similar to visit_field but instead of calling Allocative::visit for whichever is the field type, you can provide a custom closure to call instead.

Useful if the field type does not implement Allocative.

source

pub fn visit_slice<'b, T: Allocative>(&'b mut self, slice: &[T])
where 'a: 'b,

source

pub fn visit_iter<'b, 'i, T: Allocative + 'i, I: IntoIterator<Item = &'i T>>( &'b mut self, iter: I )
where 'a: 'b,

source

pub fn visit_vec_like_body<'b, T>(&'b mut self, data: &[T], capacity: usize)
where T: Allocative, 'a: 'b,

source

pub fn visit_generic_map_fields<'b, 'x, K: Allocative + 'x, V: Allocative + 'x>( &'b mut self, entries: impl IntoIterator<Item = (&'x K, &'x V)> )

source

pub fn visit_generic_set_fields<'b, 'x, K: Allocative + 'x>( &'b mut self, entries: impl IntoIterator<Item = &'x K> )
where 'a: 'b,

source

pub fn exit(self)

Trait Implementations§

source§

impl<'a> Drop for Visitor<'a>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Visitor<'a>

§

impl<'a> !Send for Visitor<'a>

§

impl<'a> !Sync for Visitor<'a>

§

impl<'a> Unpin for Visitor<'a>

§

impl<'a> !UnwindSafe for Visitor<'a>

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<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>,

§

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>,

§

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.