Skip to main content

TaskQuery

Struct TaskQuery 

Source
pub struct TaskQuery {
    pub text: Option<TextQuery>,
    pub labels: LabelFilter,
    pub statuses: Vec<StatusCategory>,
    pub project: ProjectFilter,
    pub priorities: Vec<Priority>,
    pub commented_since: Option<DateTime<Utc>>,
    pub metadata: Vec<MetadataMatch>,
    pub origin: Option<String>,
}
Expand description

A filter over a source’s tasks.

Every field narrows; an empty or None field means unfiltered.

Fields§

§text: Option<TextQuery>

Free-text search, when the caller asked for one.

§labels: LabelFilter

Label membership.

§statuses: Vec<StatusCategory>

Status categories to keep. Empty means unfiltered.

§project: ProjectFilter

Which project the task belongs to.

§priorities: Vec<Priority>

Priorities to keep: a task matches when its priority is any one of these. Empty means unfiltered.

Defaulted when absent and left out of the wire when empty, so a plugin written before there were priorities reads exactly the query it read before — and, declaring no Capabilities::filter_by_priority, is never handed one it would have to ignore.

§commented_since: Option<DateTime<Utc>>

Comment activity to keep: a task matches when at least one of its comments was created, or last edited, at or after this instant — its Comment::created_at or Comment::updated_at is at or after it. A task with no comments never matches, and a comment deleted before the query is not a match. None means unfiltered. An RFC 3339 string on the wire.

Defaulted when absent and left out of the wire when None, so a plugin written before there was comment activity reads exactly the query it read before — and, declaring no Capabilities::filter_by_comment_activity, is never handed one it would have to ignore.

§metadata: Vec<MetadataMatch>

Caller-defined metadata values to keep: a task matches when every one of these holds of its Task::metadata. Empty means unfiltered.

Defaulted when absent and left out of the wire when empty, so a plugin written before there were metadata matches reads exactly the query it read before — and, declaring no Capabilities::filter_by_metadata, is never handed one it would have to ignore.

§origin: Option<String>

The copy origin to keep: a task matches when its ORIGIN_KEY metadata entry is a string equal to this, exactly. None means unfiltered.

A qualified id — <source>:<native> — spelled exactly as a copy stores it. A plugin never constructs or interprets one: it compares this string with the one it holds, byte for byte, and nothing else, which is why it is a string here rather than the engine’s own qualified-id type.

Defaulted when absent and left out of the wire when None, on the terms metadata gives, with Capabilities::filter_by_origin.

Implementations§

Source§

impl TaskQuery

Source

pub const ORIGIN_KEY: &'static str = "onetaskgraph.origin"

The reserved metadata key a copied item records the qualified id it was copied from under, which origin is compared with.

The engine owns this key; it is restated here so a source applying the predicate natively and the engine narrowing for one that does not read the same entry. scripts/check-origin-key-spelling.sh holds this spelling to the engine’s own.

Source

pub fn metadata_matches(&self, metadata: &BTreeMap<String, Value>) -> bool

Whether metadata — one task’s — satisfies every metadata match: always when the query carries none.

The one statement of the predicate’s meaning, so a source applying it natively and the engine narrowing for a source that does not cannot answer the same store differently.

Source

pub fn origin_matches(&self, metadata: &BTreeMap<String, Value>) -> bool

Whether metadata — one task’s — satisfies origin: always when the query carries none, and otherwise exactly when its ORIGIN_KEY entry is a string equal to it.

Source

pub fn comments_match<'a>( &self, comments: impl IntoIterator<Item = &'a Comment>, ) -> bool

Whether comments — one task’s — satisfy commented_since: always when the query carries no instant, and otherwise exactly when one of them was created or last edited at or after it.

The one statement of the predicate’s meaning, so a source applying it natively and the engine narrowing for a source that does not cannot answer the same store differently.

Trait Implementations§

Source§

impl Clone for TaskQuery

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for TaskQuery

Source§

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

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

impl Default for TaskQuery

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for TaskQuery

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 JsonSchema for TaskQuery

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl PartialEq for TaskQuery

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for TaskQuery

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 StructuralPartialEq for TaskQuery

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

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

Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> ToOwned for T
where T: Clone,

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.