[][src]Struct fog_pack::Query

pub struct Query { /* fields omitted */ }

A decoded Query, which may be use to check if an Entry matches it or not.

A Query can be produced by calling decode_query on the schema used by the Document being queried. Queries are Entries that have been encoded using encode_query and have a Validator as the contained fog-pack value. See the Validation Spec for more information.

It can be passed an Entry to validate, and will produce a Checklist for further validation if necessary.

Implementations

impl Query[src]

pub fn signed_by(&self) -> Iter<Identity>[src]

Get an iterator over all known signers of the Query. Note: this does not authenticate the originator of the query; at best, it indicates the signers have seen and signed this query at some arbitrary point in the past.

pub fn hash(&self) -> &Hash[src]

Get the Hash of the Query from when it was encoded. This matches the hash of the Query when it was written as an entry.

pub fn doc_hash(&self) -> &Hash[src]

Get the Hash of the document being queried against.

pub fn field(&self) -> &str[src]

Get the Entry field being queried.

pub fn value(&self) -> ValueRef[src]

Retrieve the value stored inside the Query as a ValueRef. This is useful for ancillary parsing - for example, matching query contents against pre-built indices. This value has the same lifetime as the Query; it can be converted to a Value if it needs to outlast the Query.

pub fn validate_entry(&self, entry: &Entry) -> Result<Checklist<()>>[src]

Take an entry and verify if it matches the Query or not. May require additional Take an existing entry and validate it against the Query. On success, a Checklist is returned. Processing the checklist using this Query will complete the checklist and yield an OK(()) result, indicating the Entry matched this Query.

pub fn check_item(&self, doc: &Document, item: &mut ChecklistItem) -> Result<()>[src]

Checks a document against a given ChecklistItem. Marks the item as done on success. Fails if validation fails. This should only be done with items coming from a Checklist provided by a given Query's validate_entry function.

A ChecklistItem comes from a Checklist.

ChecklistItem ./struct.ChecklistItem.html Checklist ./checklist/struct.Checklist.html

Trait Implementations

impl Clone for Query[src]

Auto Trait Implementations

impl !RefUnwindSafe for Query

impl Send for Query

impl Sync for Query

impl Unpin for Query

impl UnwindSafe for Query

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.