pub struct When { /* private fields */ }Expand description
Implementations§
Source§impl When
impl When
Sourcepub fn parse(source: &str) -> Result<Self, WhenError>
pub fn parse(source: &str) -> Result<Self, WhenError>
Parse an expression. An empty or whitespace-only string is always true.
§Errors
When a token or parenthesis is missing or unexpected.
Sourcepub fn source(&self) -> &str
pub fn source(&self) -> &str
The source text, or an empty string for an always-true expression.
Sourcepub fn evaluate(&self, context: &WhenContext) -> bool
pub fn evaluate(&self, context: &WhenContext) -> bool
Evaluate the expression against context.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for When
Available on crate feature serde only.
impl<'de> Deserialize<'de> for When
Available on crate feature
serde only.Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
impl Eq for When
impl StructuralPartialEq for When
Auto Trait Implementations§
impl Forget for When
impl Freeze for Whenwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const Expression is !null: Freeze,
PhantomData<Expression>: Freeze,
impl Move for When
impl RefUnwindSafe for When
impl Send for When
impl Sync for When
impl Unpin for When
impl UnsafeUnpin for Whenwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const Expression is !null: UnsafeUnpin,
PhantomData<Expression>: UnsafeUnpin,
impl UnwindSafe for Whenwhere
RawVecInner: UnwindSafe,
BoxRaw<Expression>: UnwindSafe,
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Key for Twhere
T: Clone,
impl<T> Key for Twhere
T: Clone,
Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more