Skip to main content

SafeExpression

Struct SafeExpression 

Source
pub struct SafeExpression<R, T> { /* private fields */ }

Implementations§

Source§

impl<R, T> SafeExpression<R, T>
where R: Send + Sync + 'static, T: 'static,

Source

pub fn new( root: R, evaluator: impl Fn(&R) -> Option<T> + Send + Sync + 'static, ) -> Self

Source

pub fn eval(&self) -> Option<T>

Source

pub fn eval_with(&self, root: &R) -> Option<T>

Source

pub fn apply<U>( self, mapper: impl Fn(T) -> U + Send + Sync + 'static, ) -> SafeExpression<R, U>
where U: 'static,

Source

pub fn apply_optional<U>( self, mapper: impl Fn(T) -> Option<U> + Send + Sync + 'static, ) -> SafeExpression<R, U>
where U: 'static,

Source

pub fn or_else(&self, default_value: T) -> T

Source

pub fn or_else_with(&self, default_value: impl FnOnce() -> T) -> T

Source

pub fn or_else_throw<E>(&self, error: impl FnOnce() -> E) -> Result<T, E>

Source

pub fn is_null(&self) -> bool

Source

pub fn is_not_null(&self) -> bool

Source

pub fn is_empty(&self) -> bool
where T: TeaqlEmpty,

Source

pub fn is_not_empty(&self) -> bool
where T: TeaqlEmpty,

Source

pub fn when_is_null(&self, function: impl FnOnce())

Source

pub fn when_is_not_null(&self, consumer: impl FnOnce(T))

Source

pub fn when_is_empty(&self, function: impl FnOnce())
where T: TeaqlEmpty,

Source

pub fn when_not_empty(&self, consumer: impl FnOnce(T))
where T: TeaqlEmpty,

Source§

impl<R> SafeExpression<R, R>
where R: Clone + Send + Sync + 'static,

Source

pub fn value(root: R) -> Self

Source

pub fn root(&self) -> &R

Source§

impl<R, E> SafeExpression<R, E>
where R: Send + Sync + 'static, E: BaseEntity + Clone + 'static,

Source

pub fn entity_id(self) -> SafeExpression<R, u64>

Source

pub fn entity_version(self) -> SafeExpression<R, i64>

Source

pub fn update_entity_id(self, id: u64) -> SafeExpression<R, E>

Source§

impl<R, T> SafeExpression<R, SmartList<T>>
where R: Send + Sync + 'static, T: Clone + 'static,

Source

pub fn size(self) -> SafeExpression<R, usize>

Source

pub fn first(self) -> SafeExpression<R, T>

Source

pub fn get(self, index: usize) -> SafeExpression<R, T>

Trait Implementations§

Source§

impl<R: Clone, T: Clone> Clone for SafeExpression<R, T>

Source§

fn clone(&self) -> SafeExpression<R, T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<R, T> Freeze for SafeExpression<R, T>

§

impl<R, T> !RefUnwindSafe for SafeExpression<R, T>

§

impl<R, T> Send for SafeExpression<R, T>
where R: Sync + Send,

§

impl<R, T> Sync for SafeExpression<R, T>
where R: Sync + Send,

§

impl<R, T> Unpin for SafeExpression<R, T>

§

impl<R, T> UnsafeUnpin for SafeExpression<R, T>

§

impl<R, T> !UnwindSafe for SafeExpression<R, T>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.