Skip to main content

TaskWriter

Trait TaskWriter 

Source
pub trait TaskWriter:
    TaskReader
    + Send
    + Sync {
    // Required methods
    fn create_task<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        title: &'life1 str,
        body: &'life2 str,
        labels: &'life3 [String],
    ) -> Pin<Box<dyn Future<Output = Result<ExternalId>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn set_labels<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        id: &'life1 ExternalId,
        labels: &'life2 [String],
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn remove_label<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        id: &'life1 ExternalId,
        label: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_sub_issues<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 ExternalId,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ExternalId>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn update_status<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 ExternalId,
        status: Status,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn create_sub_task<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
        &'life0 self,
        parent_id: &'life1 ExternalId,
        title: &'life2 str,
        body: &'life3 str,
        labels: &'life4 [String],
    ) -> Pin<Box<dyn Future<Output = Result<ExternalId>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait { ... }
    fn ensure_status_label<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _label: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

Creating tasks and moving their status and labels

Required Methods§

Source

fn create_task<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, title: &'life1 str, body: &'life2 str, labels: &'life3 [String], ) -> Pin<Box<dyn Future<Output = Result<ExternalId>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Create a task in the external system.

Source

fn set_labels<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: &'life1 ExternalId, labels: &'life2 [String], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Add metadata labels / tags (additive — does not remove existing labels). The GitHub backend uses POST /repos/{repo}/issues/{number}/labels, which appends to the existing label set.

Source

fn remove_label<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: &'life1 ExternalId, label: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Remove a label / tag.

Source

fn get_sub_issues<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 ExternalId, ) -> Pin<Box<dyn Future<Output = Result<Vec<ExternalId>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get sub-issues (children) of a task.

Returns the list of external IDs for sub-issues. Empty list means no sub-issues or sub-issues not supported.

Provided Methods§

Source

fn update_status<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 ExternalId, status: Status, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Update task status using idempotent remove + add operations.

Default implementation retries up to 3 times with a fresh snapshot on each attempt to narrow the TOCTOU window. Backends that provide a native atomic status-update endpoint can override this.

The retry loop:

  1. Fetches a fresh label snapshot via get_task.
  2. Removes all status:* labels except the target via remove_label.
  3. Adds the target label via set_labels.

Note: labels removed in a previous attempt are already gone — the retry re-evaluates the current state rather than undoing prior work.

Source

fn create_sub_task<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, parent_id: &'life1 ExternalId, title: &'life2 str, body: &'life3 str, labels: &'life4 [String], ) -> Pin<Box<dyn Future<Output = Result<ExternalId>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Create a child task and link it as a sub-issue of the parent.

Creates the task via create_task, then attempts to establish a native sub-issue relationship. Falls back to parent:{id} label if the native link fails.

Source

fn ensure_status_label<'life0, 'life1, 'async_trait>( &'life0 self, _label: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Ensure a status label exists in the backend system.

Called by the default update_status before applying labels. GitHub overrides this to auto-create labels on the repo. Default is a no-op.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§