pub struct TaskRef(/* private fields */);Expand description
One task named by another task’s Task::delivers or Task::delivered_by.
A string with one of two spellings, decided the way a DependencyEndpoint decides it:
one holding a colon is <source>:<native> and names a task of any source, and one
without is a bare native id naming a task of the source that holds the list. So a
native id holding a colon cannot be named bare, exactly as it cannot in
onetaskgraph.depends_on.
Implementations§
Source§impl TaskRef
impl TaskRef
Sourcepub const DELIVERS_KEY: &'static str = "onetaskgraph.delivers"
pub const DELIVERS_KEY: &'static str = "onetaskgraph.delivers"
The reserved metadata key a source records Task::delivers under when its backend
has no notion of its own.
Spelled once, here, for the reason Repository::METADATA_KEY is.
Sourcepub const DELIVERED_BY_KEY: &'static str = "onetaskgraph.delivered_by"
pub const DELIVERED_BY_KEY: &'static str = "onetaskgraph.delivered_by"
The reserved metadata key a source records Task::delivered_by under when its
backend has no notion of its own.
Sourcepub fn new(id: impl Into<String>) -> Result<Self, String>
pub fn new(id: impl Into<String>) -> Result<Self, String>
One entry, once it is established it is a task id.
§Errors
Returns a message saying why when the id is empty, or when it is qualified with a source name that breaks the pattern or with no native id after the colon.
Sourcepub fn qualified(source: &SourceName, native: &NativeId) -> Self
pub fn qualified(source: &SourceName, native: &NativeId) -> Self
The qualified entry naming native in source.
Sourcepub fn is_qualified(&self) -> bool
pub fn is_qualified(&self) -> bool
Whether the entry names its source in writing.
Sourcepub fn parts<'a>(&'a self, near_source: &'a str) -> (&'a str, &'a str)
pub fn parts<'a>(&'a self, near_source: &'a str) -> (&'a str, &'a str)
The source and the native id this entry names, reading a bare entry as naming a task
of near_source.
Sourcepub fn in_source(&self, near_source: &SourceName) -> Self
pub fn in_source(&self, near_source: &SourceName) -> Self
This entry qualified, reading a bare one as naming a task of near_source.
Sourcepub fn listed(
field: &str,
near: &NativeId,
near_source: Option<&SourceName>,
entries: Vec<Self>,
) -> Result<Vec<Self>, String>
pub fn listed( field: &str, near: &NativeId, near_source: Option<&SourceName>, entries: Vec<Self>, ) -> Result<Vec<Self>, String>
The entries of one task’s list, once it is established that none names the task itself and none repeats.
field is what the list is called where it is stored, for the message. near is the
task holding the list and near_source the configured name of the source holding it,
which is what tells T-1 and work:T-1 apart as the same task. A source that does
not know its own name passes None, and then only a bare entry can be recognised as
naming this task or one of the other entries.
§Errors
Returns a message naming the task and the entry.
Sourcepub fn from_value(
field: &str,
near: &NativeId,
near_source: Option<&SourceName>,
value: Option<&Value>,
) -> Result<Vec<Self>, String>
pub fn from_value( field: &str, near: &NativeId, near_source: Option<&SourceName>, value: Option<&Value>, ) -> Result<Vec<Self>, String>
The entries one task’s list holds, read out of the JSON a source stores it as.
value is None when the source holds no list at all, which is the empty one.
§Errors
Returns a message naming the task and the entry when the value is not a list, when an
entry is not a task id, or when Self::listed refuses the list.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TaskRef
impl<'de> Deserialize<'de> for TaskRef
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for TaskRef
Source§impl JsonSchema for TaskRef
impl JsonSchema for TaskRef
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more