Struct Query

Source
pub struct Query {
    pub response: Response,
    pub scope: Scope,
    pub threshold: Threshold,
    pub triggers: Vec<Trigger>,
    pub id: Option<String>,
}
Expand description

Query represents an uncompiled query. This type is typically interstitial; it cannot perform scans, and has little functionality apart from its ability to compile into a CompiledQuery.

This type is part of the public API, and therefore must comply with the structure defined in the specification.

Fields§

§response: Response

Represents the desired Response of the query when it matches Documents. In other words, this is the set of parameters for the Output.

For more information, see the Response documentation.

§scope: Scope

Represents the documents and content that the query is applicable to. The Scope allows users to specify which URLs their query is applicable to, as well as the type of content—Text or Raw—that should be passed to the triggers.

For more information, see the Scope documentation.

§threshold: Threshold

Represents the composition of trigger matches necessary in order for a match to be made.

For more information, see the Threshold documentation.

§triggers: Vec<Trigger>

Represents the Triggers that will be checked against the document and then processed by the Threshold in order to determine whether a match is made.

For more information, see the Trigger documentation.

§id: Option<String>

Represents the id of the query. This field is optional but highly recommended, as it will be copied to the outputs created by this query.

Trait Implementations§

Source§

impl CompilableTo<CompiledQuery> for Query

Source§

fn compile(&self) -> Result<CompiledQuery, Issue>

Compiles the Query into a CompiledQuery. Like all compilation operations, this is expensive.

Source§

impl Debug for Query

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Query

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Query

Source§

fn eq(&self, other: &Query) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Query

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Validatable for Query

Source§

fn validate(&self) -> Option<Vec<Issue>>

Validates the query, as well as all of its sub-components.

While this is an important mechanism for proper validation (note that some invalid queries will still compile), one should always double-check the results by actually compiling the query and performing a test scan.

Source§

impl StructuralPartialEq for Query

Auto Trait Implementations§

§

impl Freeze for Query

§

impl RefUnwindSafe for Query

§

impl Send for Query

§

impl Sync for Query

§

impl Unpin for Query

§

impl UnwindSafe for Query

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,