Skip to main content

TaskUpdate

Struct TaskUpdate 

Source
pub struct TaskUpdate {
    pub title: Option<String>,
    pub content: Option<String>,
    pub status: Option<Status>,
    pub priority: Option<Priority>,
    pub metadata_set: BTreeMap<MetadataKey, Value>,
    pub metadata_remove: BTreeSet<MetadataKey>,
    pub delivers: Option<Vec<TaskRef>>,
    pub depends_on: Option<Vec<DependencyEdge>>,
    pub repositories: Option<Vec<Repository>>,
    pub assignees: Option<Vec<String>>,
    pub duplicate_of: Option<TaskRef>,
}
Expand description

A targeted update of one existing task. A member left None (or empty) leaves that field exactly as the source holds it.

Labels and project membership are deliberately outside it — an existing item is never moved, and no caller writes labels this way — and so is creation, which is a copy’s. Its repositories list is a field of the item like its title, and is replaced whole.

Fields§

§title: Option<String>

The task’s title.

§content: Option<String>

Task::content exactly as a read reports it; a metadata block the source keeps in the same backend field is kept byte for byte.

§status: Option<Status>

Name and category. A source that keeps status names stores the name; one that maps by category (GitHub Projects) writes its mapped option, exactly as write_task does, and refuses a category it has disabled in the same words.

§priority: Option<Priority>

The task’s priority; none clears it.

§metadata_set: BTreeMap<MetadataKey, Value>

Keys added or replaced; every other key is kept.

§metadata_remove: BTreeSet<MetadataKey>

Keys removed; a key the task does not hold is no write. Refused when it names a key metadata_set also names.

§delivers: Option<Vec<TaskRef>>

Replaces the list; the engine keeps each ticket’s delivered_by in step.

§depends_on: Option<Vec<DependencyEdge>>

Replaces the task’s forward dependency edges (from is this task); the source sends only the difference.

§repositories: Option<Vec<Repository>>

Replaces the task’s Task::repositories whole; an empty list clears it. Where the item’s issue lives is never moved by it: it is the list the item names, as a read reports it.

§assignees: Option<Vec<String>>

Replaces every person the task is assigned to with exactly these — empty unassigns. The engine names at most one, and only to a source declaring Capabilities::assignees. A source refuses a person it cannot assign, naming them, rather than writing the rest without them.

§duplicate_of: Option<TaskRef>

Close the task as a duplicate of this one, the survivor — a decision its caller made, which the store never makes on its own. Valid only beside a cancelled status, or with no status named, when it implies cancelled; any other status is refused by consistent, writing nothing.

A source closes it natively where its backend can — GitHub’s duplicate closure, Linear’s duplicate relation — and every source records the typed duplicate link in the task’s metadata, so a later read reports it cancelled with that link.

Implementations§

Source§

impl TaskUpdate

Source

pub fn is_empty(&self) -> bool

Whether this update names no field at all.

Source

pub fn names(&self, field: UpdatedField) -> bool

Whether this update names field, which is the only way a source may report it written.

Source

pub fn effective_status(&self) -> Option<Status>

The status this update writes: the one it names, or cancelled for an update closing the task as a duplicate that names none.

Source

pub fn contradictions(&self) -> Vec<&MetadataKey>

Every metadata key this update both sets and removes, in order.

An update naming one is refused before anything is written: which of the two it meant is not something a source may guess.

Source

pub fn consistent(&self) -> Result<(), SourceError>

The refusal of an update that both sets and removes a key, or Ok when it does not.

Spelled once here, so every source and the engine refuse it in the same words.

§Errors

Returns SourceError::Refused naming every such key, and for an update closing the task as a duplicate beside a status other than cancelled.

Source

pub fn applied_to(&self, task: &Task) -> Task

task as it reads once this update is applied to it: every named field replaced, every named metadata key set or removed, and everything else exactly as it was.

depends_on is not a member of a Task, so it is not applied here.

Source

pub fn changed(&self, before: &Task, after: &Task) -> BTreeSet<UpdatedField>

The fields this update names whose value differs between before and after — which, for a source that compares before it writes, is exactly what it wrote.

UpdatedField::DependsOn is never among them: a Task carries no edges, so a source says whether it wrote those itself.

Source

pub async fn rewrite<S: TaskSource + ?Sized>( &self, source: &S, id: &NativeId, ) -> Result<Option<TaskUpdateOutcome>, SourceError>

Apply this update to the task id of source by rewriting it: read it, apply the update, and — only when anything differs — write_task it with its target set, then read it back. None when source holds no such task.

This is what TaskSource::update_task does for a source that does not override it, and it is public so a host forwarding the call to a peer that does not declare the targeted update can fall back to exactly it. It is correct and not minimal: a write it makes rewrites the whole item, and a source that can send less owes an override.

The forward edges are read whenever they are needed — to compare against a named depends_on, or to carry unchanged through a rewrite a named depends_on does not replace — because a write_task replaces them.

§Errors

Returns SourceError::Refused for an update that both sets and removes a key, SourceError::Malformed when the write answers an id other than id or the task could not be read back after it, and whatever the source’s own read or write fails with.

Trait Implementations§

Source§

impl Clone for TaskUpdate

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 TaskUpdate

Source§

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

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

impl Default for TaskUpdate

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for TaskUpdate

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 TaskUpdate

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 TaskUpdate

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 TaskUpdate

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 TaskUpdate

Auto Trait Implementations§

§

impl Forget for TaskUpdate

§

impl Freeze for TaskUpdate

§

impl Move for TaskUpdate

§

impl RefUnwindSafe for TaskUpdate

§

impl Send for TaskUpdate
where RawVecInner: Send, NodeRef<Owned, MetadataKey, Value, LeafOrInternal>: Send, BoxRaw<(MetadataKey, Value)>: Send, NodeRef<Owned, MetadataKey, SetValZST, LeafOrInternal>: Send, BoxRaw<(MetadataKey, SetValZST)>: Send,

§

impl Sync for TaskUpdate
where RawVecInner: Sync, NodeRef<Owned, MetadataKey, Value, LeafOrInternal>: Sync, BoxRaw<(MetadataKey, Value)>: Sync, NodeRef<Owned, MetadataKey, SetValZST, LeafOrInternal>: Sync, BoxRaw<(MetadataKey, SetValZST)>: Sync,

§

impl Unpin for TaskUpdate
where *const u8 is !null: Unpin, *const LeafNode<MetadataKey, Value> is !null: Unpin, Box<(MetadataKey, Value)>: Unpin, *const LeafNode<MetadataKey, SetValZST> is !null: Unpin, Box<(MetadataKey, SetValZST)>: Unpin,

§

impl UnsafeUnpin for TaskUpdate

§

impl UnwindSafe for TaskUpdate

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

Source§

type Output = T

Should always be Self
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.