Skip to main content

VisitContext

Struct VisitContext 

Source
pub struct VisitContext<'a, State> { /* private fields */ }
Expand description

State and recursive operations available to a visit callback.

A matched callback owns traversal of its value. Recursive operations reborrow the visitor, so mutable state cannot remain borrowed across them.

Implementations§

Source§

impl<State> VisitContext<'_, State>

Source

pub fn state(&self) -> &State

User state shared by every callback in this traversal.

Source

pub fn state_mut(&mut self) -> &mut State

Mutably borrow the user state.

Source

pub fn current(&self) -> &VisitValue

Complete borrowed value active at this callback.

Source

pub fn def_region_kind(&self) -> DefRegionKind

Definition-region state active at the callback’s current value.

Source

pub fn visit<T>(&mut self, child: &T) -> Result<Option<VisitInterrupt>>
where for<'x> AnyView<'x>: From<&'x T>,

Visit child using the current definition-region state.

Source

pub fn visit_with<T>( &mut self, child: &T, def_region_kind: DefRegionKind, ) -> Result<Option<VisitInterrupt>>
where for<'x> AnyView<'x>: From<&'x T>,

Visit child using an explicit definition-region state.

Source

pub fn visit_children(&mut self) -> Result<Option<VisitInterrupt>>

Visit the current value’s children using registered hooks or reflected structural fields. The current value itself is not dispatched again.

Auto Trait Implementations§

§

impl<'a, State> !RefUnwindSafe for VisitContext<'a, State>

§

impl<'a, State> !Send for VisitContext<'a, State>

§

impl<'a, State> !Sync for VisitContext<'a, State>

§

impl<'a, State> !UnwindSafe for VisitContext<'a, State>

§

impl<'a, State> Freeze for VisitContext<'a, State>

§

impl<'a, State> Unpin for VisitContext<'a, State>

§

impl<'a, State> UnsafeUnpin for VisitContext<'a, State>

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

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.