Skip to main content

Task

Struct Task 

Source
pub struct Task {
    pub name: String,
    pub workflow_name: String,
    pub start: String,
    pub context: RunContext,
    pub journal: Vec<JournalEvent>,
    pub gates: Vec<String>,
    pub artifacts: BTreeMap<String, String>,
}
Expand description

任务聚合。

Fields§

§name: String§workflow_name: String§start: String§context: RunContext§journal: Vec<JournalEvent>§gates: Vec<String>

等人拍板的事项。

§artifacts: BTreeMap<String, String>

这次执行往哪写产物(声明写成什么就是什么,相对工作区根)。

Implementations§

Source§

impl Task

Source

pub fn of(name: &str, payload: &Yaml) -> Task

从任务文件里的字段读出;name 由调用方给(文件名即任务名)。

Source

pub fn declared(&self, kind: &str) -> Option<String>

这种产物声明了往哪写;没声明给 None

Source

pub fn artifact(&self, kind: &str, context: &RunContext) -> String

这次执行往哪写这种产物(规范「任务 / 语法」里的落点)。

声明了按声明的(相对工作区根);没声明落数据仓的 artifacts/<种类>/<任务名>.md;流水是任务文件本身。

Source

pub fn done_steps(&self, workflow: &Workflow) -> Vec<String>

走过哪几步。

带后缀的流水(·审 / ·判)给这一步投票,不带后缀的(重走一遍) 把结论从头算;工作流上没有的步骤名不算数。

Source

pub fn next_step(&self, workflow: &Workflow) -> Option<String>

第一个没走到的步骤(按工作流里的顺序)。

Source

pub fn state_line(&self, workflow: &Workflow) -> String

状态行:下一步是谁,或者都走过了。

Source

pub fn recorded(&self, at: &str, step: &str, detail: &str, ok: bool) -> Task

记一笔流水:流水只增不改,所以返回新的任务。

Source

pub fn with_gates(&self, notes: &[String]) -> Task

记下闸门项;已有的不重复记。同样返回新的任务。

Source

pub fn to_yaml(&self) -> Yaml

写回任务文件的字段形状。

Trait Implementations§

Source§

impl Clone for Task

Source§

fn clone(&self) -> Task

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 Task

Source§

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

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

impl Eq for Task

Source§

impl PartialEq for Task

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Task

Auto Trait Implementations§

§

impl Freeze for Task

§

impl RefUnwindSafe for Task

§

impl Send for Task

§

impl Sync for Task

§

impl Unpin for Task

§

impl UnsafeUnpin for Task

§

impl UnwindSafe for Task

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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.