pub struct PropPredicate {
pub field: String,
pub eq: Option<Value>,
pub in_: Option<Vec<Value>>,
}Expand description
One property test a role’s visibility may carry, beside labels.
Equality and membership only: no ranges, no negation, no nesting. A mask
that can express arbitrary predicates is a query language with a security
boundary attached — every operator added is another shape the resolver has
to be right about, on the deny side, forever. Two operators are enough for
the case that motivates them (status in ["published"]) and small enough to
be obviously correct.
Exactly one of eq and in is set; validate enforces it.
§Value shapes accepted on the way in
A predicate is usually hand-written, so both spellings of a value parse:
the plain JSON scalar ("published", 3, true) and the tagged form the
graph’s own Value serializes as ({"Str": "published"}, {"Int": 3}).
They mean the same thing. Serialization always writes the tagged form, so a
sidecar this binary rewrote is unambiguous no matter which one was typed.
Fields§
§field: StringThe property to test. Never empty.
eq: Option<Value>Single-value form: the property must equal this value.
in_: Option<Vec<Value>>Membership form: the property must equal one of these values. An empty list matches nothing — it is a valid, fully-closed predicate.
Implementations§
Source§impl PropPredicate
impl PropPredicate
Sourcepub fn holds(&self, value: Option<&Value>) -> bool
pub fn holds(&self, value: Option<&Value>) -> bool
Test one node’s property value against the predicate.
visible = keys ∪ { n : label(n) ∈ labels ∧ holds(n) }.
A missing property does not hold: absent is not a match. A node that
never carried the field is outside a narrowed role, which is the
deny-side answer — a role narrowed to status in ["published"] must not
see a document that has no status at all.
Trait Implementations§
Source§impl Clone for PropPredicate
impl Clone for PropPredicate
Source§fn clone(&self) -> PropPredicate
fn clone(&self) -> PropPredicate
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PropPredicate
impl Debug for PropPredicate
Source§impl<'de> Deserialize<'de> for PropPredicate
impl<'de> Deserialize<'de> for PropPredicate
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for PropPredicate
impl PartialEq for PropPredicate
Source§impl Serialize for PropPredicate
impl Serialize for PropPredicate
impl StructuralPartialEq for PropPredicate
Auto Trait Implementations§
impl Freeze for PropPredicate
impl RefUnwindSafe for PropPredicate
impl Send for PropPredicate
impl Sync for PropPredicate
impl Unpin for PropPredicate
impl UnsafeUnpin for PropPredicate
impl UnwindSafe for PropPredicate
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.