Enum stam::Constraint

source ·
pub enum Constraint<'a> {
Show 24 variants Id(&'a str), Annotation(&'a str, SelectionQualifier, AnnotationDepth, Option<Offset>), TextResource(&'a str, SelectionQualifier, Option<Offset>), DataSet(&'a str, SelectionQualifier), DataKey { set: &'a str, key: &'a str, qualifier: SelectionQualifier, }, KeyVariable(&'a str, SelectionQualifier), DataVariable(&'a str, SelectionQualifier), DataSetVariable(&'a str, SelectionQualifier), ResourceVariable(&'a str, SelectionQualifier, Option<Offset>), TextVariable(&'a str), TextRelation { var: &'a str, operator: TextSelectionOperator, }, KeyValue { set: &'a str, key: &'a str, operator: DataOperator<'a>, qualifier: SelectionQualifier, }, Value(DataOperator<'a>, SelectionQualifier), KeyValueVariable(&'a str, DataOperator<'a>, SelectionQualifier), Text(&'a str, TextMode), Regex(Regex), Union(Vec<Constraint<'a>>), AnnotationVariable(&'a str, SelectionQualifier, AnnotationDepth, Option<Offset>), Annotations(Handles<'a, Annotation>, SelectionQualifier, AnnotationDepth), Data(Handles<'a, AnnotationData>, SelectionQualifier), Keys(Handles<'a, DataKey>, SelectionQualifier), Resources(Handles<'a, TextResource>, SelectionQualifier), TextSelections(Handles<'a, TextSelection>, SelectionQualifier), Limit { begin: isize, end: isize, },
}
Expand description

A constraint is a part of a Query that poses specific selection criteria that must be met. A query can have multiple constraints which must all be satisfied. See the documentation for Query for examples.

Variants§

§

Id(&'a str)

Constrain the selection (type is determined by the query result type) to one instance with a specific identifier (ID keyword in STAMQL).

§

Annotation(&'a str, SelectionQualifier, AnnotationDepth, Option<Offset>)

Constrain by a specific Annotation, referenced by ID (ANNOTATION keyword in STAMQL)

§

TextResource(&'a str, SelectionQualifier, Option<Offset>)

Constrain by a specific TextResource, referenced by ID (RESOURCE keyword in STAMQL)

§

DataSet(&'a str, SelectionQualifier)

Constrain by a specific AnnotationDataSet, referenced by ID (DATASET keyword in STAMQL)

§

DataKey

Constrain by a specific DataKey, referenced by set and key ID (DATA keyword, without operator/value, in STAMQL)

Fields

§set: &'a str
§key: &'a str
§

KeyVariable(&'a str, SelectionQualifier)

Constrain by a specific DataKey, referenced by variable (KEY keyword in STAMQL), the variable name must not carry the ? prefix here.

§

DataVariable(&'a str, SelectionQualifier)

Constrain by a specific AnnotationData, referenced by variable (DATA keyword in STAMQL), the variable name must not carry the ? prefix here.

§

DataSetVariable(&'a str, SelectionQualifier)

Constrain by a specific AnnotationDataSet, referenced by variable (DATASET keyword in STAMQL), the variable name must not carry the ? prefix here.

§

ResourceVariable(&'a str, SelectionQualifier, Option<Offset>)

Constrain by a specific TextResource, referenced by variable (RESOURCE keyword in STAMQL), the variable name must not carry the ? prefix here.

§

TextVariable(&'a str)

Constrain by a specific text selection, referenced by variable (TEXT keyword in STAMQL), the variable name must not carry the ? prefix here.

§

TextRelation

Constrain by a specific text selection and a particular relation textual relation (RELATION keyword in STAMQL), the text selection is referenced by variable (TEXT keyword in STAMQL), the variable name must not carry the ? prefix here.

Fields

§var: &'a str
§

KeyValue

Constrain by a specific DataKey and value, referenced by set and key ID, and a DataOperator (DATA keyword in STAMQL)

Fields

§set: &'a str
§key: &'a str
§operator: DataOperator<'a>
§

Value(DataOperator<'a>, SelectionQualifier)

Constrain by a specific value (VALUE keyword, with operator/value, in STAMQL). This only makes sense in certain contexts like when querying keys.

§

KeyValueVariable(&'a str, DataOperator<'a>, SelectionQualifier)

Constrain by a specific DataKey and value test DataOperator, only the key is referenced by variable, the variable name must not carry the ? prefix here.

§

Text(&'a str, TextMode)

Constrain by textual content (TEXT keyword in STAMQL). The TextMode determines whether comparisons are exact or case-insensitive (TEXT AS NOCASE in STAMQL). See also Constraint::Regex

§

Regex(Regex)

Constrain by textual content via a regular expression (TEXT AS REGEX keyword in STAMQL)

§

Union(Vec<Constraint<'a>>)

Disjunction

§

AnnotationVariable(&'a str, SelectionQualifier, AnnotationDepth, Option<Offset>)

Constrain by a specific Annotation, referenced by variable (Annotation keyword in STAMQL), the variable name must not carry the ? prefix here.

§

Annotations(Handles<'a, Annotation>, SelectionQualifier, AnnotationDepth)

Constrain by any of multiple annotations

§

Data(Handles<'a, AnnotationData>, SelectionQualifier)

Constrain by any of multiple annotation data

§

Keys(Handles<'a, DataKey>, SelectionQualifier)

Constrain by any of multiple data keys

§

Resources(Handles<'a, TextResource>, SelectionQualifier)

Constrain by any of multiple resources

§

TextSelections(Handles<'a, TextSelection>, SelectionQualifier)

Constrain by any of multiple text selections

§

Limit

Constrain to a certain range

Fields

§begin: isize
§end: isize

Implementations§

source§

impl<'a> Constraint<'a>

source

pub fn keyword(&self) -> &'static str

Returns the STAMQL keyword for this constraint

source

pub fn to_string(&self) -> Result<String, StamError>

Serialize the constraint to a (partial) STAMQL String

Trait Implementations§

source§

impl<'a> Clone for Constraint<'a>

source§

fn clone(&self) -> Constraint<'a>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a> Debug for Constraint<'a>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Constraint<'a>

§

impl<'a> RefUnwindSafe for Constraint<'a>

§

impl<'a> Send for Constraint<'a>

§

impl<'a> Sync for Constraint<'a>

§

impl<'a> Unpin for Constraint<'a>

§

impl<'a> UnwindSafe for Constraint<'a>

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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V