pub enum ValueOrGlob<T> {
Value(T),
Glob(Glob),
}Expand description
Either a concrete value of type T or a wildcard Glob.
Every field on a generated selector struct is wrapped in this enum so that
it can independently be pinned to a specific value or left as a glob to
match anything. This is the core abstraction that allows selectors to
express patterns like Read(Students.*) (specific table, any column) or
Read(*.name) (any table, specific column).
The Default implementation returns Glob, matching the convention that an
unspecified field matches everything.
Variants§
Value(T)
A concrete, pinned value that this selector field must match exactly.
Glob(Glob)
A wildcard that matches any value for this selector field.
Implementations§
Source§impl<T> ValueOrGlob<T>
impl<T> ValueOrGlob<T>
Sourcepub fn new_value(value: impl Into<T>) -> Self
pub fn new_value(value: impl Into<T>) -> Self
Creates a ValueOrGlob::Value by converting the argument into T.
Accepts anything that implements Into<T> so callers can pass owned
values, string slices (when T = String), and other convertible types
without explicit conversion at the call site.
Sourcepub const fn new_glob() -> Self
pub const fn new_glob() -> Self
Creates a ValueOrGlob::Glob, representing a wildcard that matches
any value.
Sourcepub const fn as_value(&self) -> Option<&T>
pub const fn as_value(&self) -> Option<&T>
Returns a reference to the inner value if this is a
Value, or None if it is a glob.
Sourcepub fn into_value(self) -> Option<T>
pub fn into_value(self) -> Option<T>
Consumes self and returns the inner T if this is a
Value, or None if it is a glob.
Trait Implementations§
Source§impl<T: Clone> Clone for ValueOrGlob<T>
impl<T: Clone> Clone for ValueOrGlob<T>
Source§fn clone(&self) -> ValueOrGlob<T>
fn clone(&self) -> ValueOrGlob<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<T: Debug> Debug for ValueOrGlob<T>
impl<T: Debug> Debug for ValueOrGlob<T>
Source§impl<T> Default for ValueOrGlob<T>
Defaults to ValueOrGlob::Glob so that omitted fields match everything.
impl<T> Default for ValueOrGlob<T>
Defaults to ValueOrGlob::Glob so that omitted fields match everything.
Source§impl<T> Display for ValueOrGlob<T>where
T: Display,
impl<T> Display for ValueOrGlob<T>where
T: Display,
Source§impl<T> From<Option<T>> for ValueOrGlob<T>
Converts an Option<T> into a ValueOrGlob: Some(v) becomes
Value(v) and None becomes
Glob, mirroring the semantics of “present means
pinned, absent means match-all.”
impl<T> From<Option<T>> for ValueOrGlob<T>
Converts an Option<T> into a ValueOrGlob: Some(v) becomes
Value(v) and None becomes
Glob, mirroring the semantics of “present means
pinned, absent means match-all.”
Source§impl<T> From<ValueOrGlob<T>> for Stringwhere
T: Display,
Converts a ValueOrGlob to its string representation, enabling .into()
at call sites that expect a String.
impl<T> From<ValueOrGlob<T>> for Stringwhere
T: Display,
Converts a ValueOrGlob to its string representation, enabling .into()
at call sites that expect a String.
Source§fn from(value: ValueOrGlob<T>) -> Self
fn from(value: ValueOrGlob<T>) -> Self
Source§impl<T> FromStr for ValueOrGlob<T>where
T: FromStr,
impl<T> FromStr for ValueOrGlob<T>where
T: FromStr,
Source§impl<T: Hash> Hash for ValueOrGlob<T>
impl<T: Hash> Hash for ValueOrGlob<T>
Source§impl<T: Ord> Ord for ValueOrGlob<T>
impl<T: Ord> Ord for ValueOrGlob<T>
Source§fn cmp(&self, other: &ValueOrGlob<T>) -> Ordering
fn cmp(&self, other: &ValueOrGlob<T>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<T: PartialEq> PartialEq for ValueOrGlob<T>
impl<T: PartialEq> PartialEq for ValueOrGlob<T>
Source§impl<T: PartialOrd> PartialOrd for ValueOrGlob<T>
impl<T: PartialOrd> PartialOrd for ValueOrGlob<T>
Source§impl<T> TryFrom<String> for ValueOrGlob<T>where
T: FromStr,
Parses an owned String into a ValueOrGlob by delegating to
FromStr, enabling value.try_into() at call sites.
impl<T> TryFrom<String> for ValueOrGlob<T>where
T: FromStr,
Parses an owned String into a ValueOrGlob by delegating to
FromStr, enabling value.try_into() at call sites.