Struct filter_ast::Tree [−][src]
A compound node in a filter expression, consisting of a logical operator and a set of child expressions.
Implementations
impl<T> Tree<T>
[src]
pub fn new(operator: Logic, rules: Vec<T>) -> Self
[src]
pub fn operator(&self) -> Logic
[src]
pub fn rules(&self) -> &[T]
[src]
pub fn from_iter(operator: Logic, rules: impl Iterator<Item = T>) -> Self
[src]
Create an instance by collecting the rules from an iterator.
Example
let rules = vec![ Clause::new("name", "=", "jim"), Clause::new("age", ">", "10") ]; let tree = Tree::from_iter( Logic::And, rules.into_iter().filter(|f| *f.field() != "age") ); assert_eq!(1, tree.rules().len());
pub fn map<U, F>(self, transform: F) -> Tree<U> where
F: Fn(T) -> U,
[src]
F: Fn(T) -> U,
Create a new tree by applying a transform to all its rules.
Example
let tree = Tree::new(Logic::Or, vec![1, 2]); let tree2 = tree.map(|x| x * 10); assert_eq!(Tree::new(Logic::Or, vec![10, 20]), tree2);
impl<T: Ord> Tree<T>
[src]
Trait Implementations
impl<T: Clone> Clone for Tree<T>
[src]
impl<T: Debug> Debug for Tree<T>
[src]
impl<T: Eq> Eq for Tree<T>
[src]
impl<F, P, O> From<Tree<Expr<F, P, O>>> for Expr<F, P, O>
[src]
Convert into Tree
variant.
impl<T: PartialEq> PartialEq<Tree<T>> for Tree<T>
[src]
impl<T> StructuralEq for Tree<T>
[src]
impl<T> StructuralPartialEq for Tree<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Tree<T> where
T: RefUnwindSafe,
[src]
T: RefUnwindSafe,
impl<T> Send for Tree<T> where
T: Send,
[src]
T: Send,
impl<T> Sync for Tree<T> where
T: Sync,
[src]
T: Sync,
impl<T> Unpin for Tree<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> UnwindSafe for Tree<T> where
T: UnwindSafe,
[src]
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,