pub enum Guard {
Attr {
ns: Ns,
key: Option<String>,
val: Option<String>,
},
}Expand description
One namespaced guard predicate. Every guard in the language is a namespace plus an optional subject plus an optional value; the single disjointness rule compares the whole triple, so no domain ever needs its own table.
Construction (fixed by the parser, never hand-built):
os/bool carry the value ([os:linux]), env carries the
variable as subject ([env:MODE], [env:MODE=dev]).
family:unix and family:windows are accepted aliases lowered
at parse to any(os:macos, os:linux) and os:windows
respectively, so every platform check executes uniformly under
the os: namespace.
Variants§
Implementations§
Source§impl Guard
impl Guard
Sourcepub fn is_disjoint_from(&self, other: &Guard) -> bool
pub fn is_disjoint_from(&self, other: &Guard) -> bool
The one disjointness rule for the entire guard language:
same namespace, same subject, both valued, different values.
Everything else overlaps — different namespaces are
independent axes, different subjects are independent
variables, and a missing value is a presence claim compatible
with any value. No per-domain tables: os:macos vs
os:linux, env:MODE=dev vs env:MODE=prod, and
bool:true vs bool:false all decide here.
Trait Implementations§
Source§impl Display for Guard
impl Display for Guard
Source§fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
Bare form without brackets (the step renderer adds them):
[os:linux] prints os:linux, [env:MODE=dev]
prints eq(env:MODE, dev), [env:MODE] prints env:MODE.
The eq() spelling roundtrips through the parser; the rest
print verbatim. Roundtrips by construction.
impl Eq for Guard
impl StructuralPartialEq for Guard
Auto Trait Implementations§
impl Forget for Guard
impl Freeze for Guard
impl Move for Guard
impl RefUnwindSafe for Guard
impl Send for Guard
impl Sync for Guard
impl Unpin for Guard
impl UnsafeUnpin for Guard
impl UnwindSafe for Guard
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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
key and return true if they are equal.