Struct allocative::Visitor
source · pub struct Visitor<'a> { /* private fields */ }
Implementations§
source§impl<'a> Visitor<'a>
impl<'a> Visitor<'a>
pub fn enter<'b>(&'b mut self, name: Key, size: usize) -> Visitor<'b>where
'a: 'b,
pub fn enter_unique<'b>(&'b mut self, name: Key, size: usize) -> 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.
sourcepub fn enter_self_sized<'b, T>(&'b mut self) -> Visitor<'b>where
'a: 'b,
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.
sourcepub fn enter_self<'b, T: ?Sized>(&'b mut self, this: &T) -> Visitor<'b>where
'a: 'b,
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.
sourcepub fn visit_simple<'b>(&'b mut self, name: Key, size: usize)where
'a: 'b,
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.
sourcepub fn visit_simple_sized<'b, T>(&'b mut self)where
'a: 'b,
pub fn visit_simple_sized<'b, T>(&'b mut self)where
'a: 'b,
Visit simple sized field (e.g. u32
) without descending into children.
pub fn visit_field<'b, T: Allocative + ?Sized>(
&'b mut self,
name: Key,
field: &T
)where
'a: 'b,
sourcepub 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
)
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
.
pub fn visit_slice<'b, T: Allocative>(&'b mut self, slice: &[T])where
'a: 'b,
pub fn visit_iter<'b, 'i, T: Allocative + 'i, I: IntoIterator<Item = &'i T>>(
&'b mut self,
iter: I
)where
'a: 'b,
pub fn visit_vec_like_body<'b, T>(&'b mut self, data: &[T], capacity: usize)where
T: Allocative,
'a: 'b,
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)> )
pub fn visit_generic_set_fields<'b, 'x, K: Allocative + 'x>(
&'b mut self,
entries: impl IntoIterator<Item = &'x K>
)where
'a: 'b,
pub fn exit(self)
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more