Struct datafusion_common::tree_node::Transformed
source · pub struct Transformed<T> {
pub data: T,
pub transformed: bool,
pub tnr: TreeNodeRecursion,
}
Expand description
Result of tree walk / transformation APIs
API users control the transformation by returning:
- The resulting (possibly transformed) node,
transformed
: flag indicating whether any change was made to the nodetnr
:TreeNodeRecursion
specifying how to proceed with the recursion.
At the end of the transformation, the return value will contain:
- The final (possibly transformed) tree,
transformed
: flag indicating whether any change was made to the nodetnr
:TreeNodeRecursion
specifying how the recursion ended.
Example APIs:
Fields§
§data: T
§transformed: bool
§tnr: TreeNodeRecursion
Implementations§
source§impl<T> Transformed<T>
impl<T> Transformed<T>
sourcepub fn new(data: T, transformed: bool, tnr: TreeNodeRecursion) -> Self
pub fn new(data: T, transformed: bool, tnr: TreeNodeRecursion) -> Self
Create a new Transformed
object with the given information.
sourcepub fn yes(data: T) -> Self
pub fn yes(data: T) -> Self
Wrapper for transformed data with TreeNodeRecursion::Continue
statement.
sourcepub fn no(data: T) -> Self
pub fn no(data: T) -> Self
Wrapper for unchanged data with TreeNodeRecursion::Continue
statement.
sourcepub fn update_data<U, F: FnOnce(T) -> U>(self, f: F) -> Transformed<U>
pub fn update_data<U, F: FnOnce(T) -> U>(self, f: F) -> Transformed<U>
Applies an infallible f
to the data of this Transformed
object,
without modifying the transformed
flag.
sourcepub fn map_data<U, F: FnOnce(T) -> Result<U>>(
self,
f: F,
) -> Result<Transformed<U>>
pub fn map_data<U, F: FnOnce(T) -> Result<U>>( self, f: F, ) -> Result<Transformed<U>>
Applies a fallible f
(returns Result
) to the data of this
Transformed
object, without modifying the transformed
flag.
sourcepub fn transform_data<U, F: FnOnce(T) -> Result<Transformed<U>>>(
self,
f: F,
) -> Result<Transformed<U>>
pub fn transform_data<U, F: FnOnce(T) -> Result<Transformed<U>>>( self, f: F, ) -> Result<Transformed<U>>
Applies a fallible transforming f
to the data of this Transformed
object.
The returned Transformed
object has the transformed
flag set if either
self
or the return value of f
have the transformed
flag set.
sourcepub fn transform_children<F: FnOnce(T) -> Result<Transformed<T>>>(
self,
f: F,
) -> Result<Transformed<T>>
pub fn transform_children<F: FnOnce(T) -> Result<Transformed<T>>>( self, f: F, ) -> Result<Transformed<T>>
Maps the Transformed
object to the result of the given f
depending on the
current TreeNodeRecursion
value and the fact that f
is changing the current
node’s children.
sourcepub fn transform_sibling<F: FnOnce(T) -> Result<Transformed<T>>>(
self,
f: F,
) -> Result<Transformed<T>>
pub fn transform_sibling<F: FnOnce(T) -> Result<Transformed<T>>>( self, f: F, ) -> Result<Transformed<T>>
Maps the Transformed
object to the result of the given f
depending on the
current TreeNodeRecursion
value and the fact that f
is changing the current
node’s sibling.
sourcepub fn transform_parent<F: FnOnce(T) -> Result<Transformed<T>>>(
self,
f: F,
) -> Result<Transformed<T>>
pub fn transform_parent<F: FnOnce(T) -> Result<Transformed<T>>>( self, f: F, ) -> Result<Transformed<T>>
Maps the Transformed
object to the result of the given f
depending on the
current TreeNodeRecursion
value and the fact that f
is changing the current
node’s parent.
Trait Implementations§
source§impl<T: Debug> Debug for Transformed<T>
impl<T: Debug> Debug for Transformed<T>
source§impl<T: PartialEq> PartialEq for Transformed<T>
impl<T: PartialEq> PartialEq for Transformed<T>
source§fn eq(&self, other: &Transformed<T>) -> bool
fn eq(&self, other: &Transformed<T>) -> bool
self
and other
values to be equal, and is used
by ==
.