Struct PrePostMut

Source
pub struct PrePostMut<'a, T, R, F, S> { /* private fields */ }
Expand description

Implements both traversals at once.

Implementations§

Source§

impl<'a, T, R, F> PrePostMut<'a, T, R, F, Synchronous>
where F: FnMut(&mut Node<T>, &R) -> R,

Source

pub fn reduce<U, P>(self, base: R, post: P) -> U
where F: FnMut(&mut Node<T>, &R) -> R, P: FnMut(&mut Node<T>, &R, Vec<U>) -> U,

Traverses the tree calling both associated closures when corresponding. Returns the latest result given by the post closure, which value correspond to the root of the tree.

Source

pub fn map<U, P>(self, base: R, post: P) -> Node<U>
where F: FnMut(&mut Node<T>, &R) -> R, P: FnMut(&mut Node<T>, &R, &mut Vec<Node<U>>) -> U,

Traverses the tree in both orders, building a new tree by calling the post closure along the way. Returns the latest result given by the post closure, which value correspond to the root of the tree.

Auto Trait Implementations§

§

impl<'a, T, R, F, S> Freeze for PrePostMut<'a, T, R, F, S>
where F: Freeze,

§

impl<'a, T, R, F, S> RefUnwindSafe for PrePostMut<'a, T, R, F, S>

§

impl<'a, T, R, F, S> Send for PrePostMut<'a, T, R, F, S>
where F: Send, R: Send, S: Send, T: Send,

§

impl<'a, T, R, F, S> Sync for PrePostMut<'a, T, R, F, S>
where F: Sync, R: Sync, S: Sync, T: Sync,

§

impl<'a, T, R, F, S> Unpin for PrePostMut<'a, T, R, F, S>
where F: Unpin, R: Unpin, S: Unpin,

§

impl<'a, T, R, F, S> !UnwindSafe for PrePostMut<'a, T, R, F, S>

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.