pub trait Biplate<To>{
// Required method
fn biplate(&self) -> (Tree<To>, Box<dyn Fn(Tree<To>) -> Self>);
// Provided methods
fn with_children_bi(&self, children: Vector<To>) -> Self { ... }
fn descend_bi(&self, op: Arc<dyn Fn(To) -> To>) -> Self { ... }
fn universe_bi(&self) -> Vector<To> { ... }
fn children_bi(&self) -> Vector<To> { ... }
fn transform_bi(&self, op: Arc<dyn Fn(To) -> To>) -> Self { ... }
fn holes_bi(&self) -> impl Iterator<Item = (To, Arc<dyn Fn(To) -> Self>)> { ... }
fn contexts_bi(&self) -> impl Iterator<Item = (To, Arc<dyn Fn(To) -> Self>)> { ... }
}Expand description
Biplate<U> for type T operates over all values of type U within T.
Required Methods§
Provided Methods§
Sourcefn with_children_bi(&self, children: Vector<To>) -> Self
fn with_children_bi(&self, children: Vector<To>) -> Self
Reconstructs the node with the given children.
§Panics
If there are a different number of children given as there were originally returned by children().
Sourcefn descend_bi(&self, op: Arc<dyn Fn(To) -> To>) -> Self
fn descend_bi(&self, op: Arc<dyn Fn(To) -> To>) -> Self
Like descend but with more general types.
If from == to then this function does not descend. Therefore, when writing definitions it is highly unlikely that this function should be used in the recursive case. A common pattern is to first match the types using descendBi, then continue the recursion with descend.
fn universe_bi(&self) -> Vector<To>
Sourcefn children_bi(&self) -> Vector<To>
fn children_bi(&self) -> Vector<To>
Returns the children of a type. If to == from then it returns the original element (in contrast to children).
fn transform_bi(&self, op: Arc<dyn Fn(To) -> To>) -> Self
Sourcefn holes_bi(&self) -> impl Iterator<Item = (To, Arc<dyn Fn(To) -> Self>)>
fn holes_bi(&self) -> impl Iterator<Item = (To, Arc<dyn Fn(To) -> Self>)>
Returns an iterator over all direct children of the input, paired with a function that “fills the hole” where the child was with a new value.
Sourcefn contexts_bi(&self) -> impl Iterator<Item = (To, Arc<dyn Fn(To) -> Self>)>
fn contexts_bi(&self) -> impl Iterator<Item = (To, Arc<dyn Fn(To) -> Self>)>
holes_bi, but for universe()
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.