Skip to main content

MapWithContextPolicy

Struct MapWithContextPolicy 

Source
pub struct MapWithContextPolicy<Mapper, Policy> { /* private fields */ }
Expand description

A MapDispatch with a MutContextPolicy, sharing the dispatcher’s state.

Pass this value or a mutable reference to structural_map. Each node’s map callback runs outside its policy scope; its children run inside. This mapper cannot be a callback tuple member or another wrapper’s dispatcher. Compose policies as (outer, inner) within one wrapper.

Implementations§

Source§

impl<Mapper: MapDispatch, Policy: MutContextPolicy<Mapper>> MapWithContextPolicy<Mapper, Policy>

Source

pub fn new(mapper: Mapper, policy: Policy) -> Self

Combine a dispatcher and a default-recursion policy.

Source

pub fn state(&self) -> &Mapper

Access the dispatcher and shared state.

Source

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

Mutably access the dispatcher outside recursive calls.

Source

pub fn into_state(self) -> Mapper

Recover the dispatcher and its state.

Auto Trait Implementations§

§

impl<Mapper, Policy> !Send for MapWithContextPolicy<Mapper, Policy>

§

impl<Mapper, Policy> !Sync for MapWithContextPolicy<Mapper, Policy>

§

impl<Mapper, Policy> Freeze for MapWithContextPolicy<Mapper, Policy>
where Mapper: Freeze,

§

impl<Mapper, Policy> RefUnwindSafe for MapWithContextPolicy<Mapper, Policy>
where Mapper: RefUnwindSafe, Policy: RefUnwindSafe,

§

impl<Mapper, Policy> Unpin for MapWithContextPolicy<Mapper, Policy>
where Mapper: Unpin,

§

impl<Mapper, Policy> UnsafeUnpin for MapWithContextPolicy<Mapper, Policy>
where Mapper: UnsafeUnpin,

§

impl<Mapper, Policy> UnwindSafe for MapWithContextPolicy<Mapper, Policy>
where Mapper: 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.