Skip to main content

WalkWithContextPolicy

Struct WalkWithContextPolicy 

Source
pub struct WalkWithContextPolicy<Walker, Policy> { /* private fields */ }
Expand description

A walk dispatcher combined with a reusable default-recursion policy.

The dispatcher is also the state visible through the policy’s context. Use #[dispatch(walk)] or implement WalkDispatch to define its callbacks. Pass this value or a mutable reference to structural_walk.

Implementations§

Source§

impl<Walker: WalkDispatch, Policy: ContextPolicy<Walker>> WalkWithContextPolicy<Walker, Policy>

Source

pub fn new(walker: Walker, policy: Policy) -> Self

Combine a dispatcher and a default-recursion policy.

Source

pub fn state(&self) -> &Walker

Access the dispatcher and its traversal state.

Source

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

Mutably access the dispatcher outside an active walk.

Source

pub fn into_state(self) -> Walker

Recover the dispatcher and its state.

Auto Trait Implementations§

§

impl<Walker, Policy> !Send for WalkWithContextPolicy<Walker, Policy>

§

impl<Walker, Policy> !Sync for WalkWithContextPolicy<Walker, Policy>

§

impl<Walker, Policy> Freeze for WalkWithContextPolicy<Walker, Policy>
where Walker: Freeze,

§

impl<Walker, Policy> RefUnwindSafe for WalkWithContextPolicy<Walker, Policy>
where Walker: RefUnwindSafe, Policy: RefUnwindSafe,

§

impl<Walker, Policy> Unpin for WalkWithContextPolicy<Walker, Policy>
where Walker: Unpin,

§

impl<Walker, Policy> UnsafeUnpin for WalkWithContextPolicy<Walker, Policy>
where Walker: UnsafeUnpin,

§

impl<Walker, Policy> UnwindSafe for WalkWithContextPolicy<Walker, Policy>
where Walker: UnwindSafe, Policy: RefUnwindSafe,

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.