Skip to main content

TaskRef

Enum TaskRef 

Source
pub enum TaskRef {
    SameProject(TaskName),
    Project(ProjectName, TaskName),
    FanOut(TaskName),
    SiblingFanOut(TaskName),
    Tag(TagName, TaskName),
    SiblingTag(TagName, TaskName),
}
Expand description

A validated task reference.

Construction is via TaskRef::parse. The fmt::Display implementation produces a string that round-trips through TaskRef::parse.

§Examples

use haz_domain::task_ref::TaskRef;

let r = TaskRef::parse("~:compile").unwrap();
assert_eq!(r.to_string(), "~:compile");

let r = TaskRef::parse("[typescript]:compile").unwrap();
assert_eq!(r.to_string(), "[typescript]:compile");

Variants§

§

SameProject(TaskName)

~:<task>. Resolves within the bearing project (REF-002).

§

Project(ProjectName, TaskName)

<project>:<task>. Resolves to a task in the named project (REF-003).

§

FanOut(TaskName)

^:<task>. Resolves to every task with this name across the workspace, including the bearing project (REF-004).

§

SiblingFanOut(TaskName)

^~:<task>. Resolves to every task with this name across the workspace except the bearing project (REF-008).

§

Tag(TagName, TaskName)

[<tag>]:<task>. Resolves to every task with this name whose project carries the named tag, including the bearing project (REF-005).

§

SiblingTag(TagName, TaskName)

[<tag>]~:<task>. Resolves to every task with this name whose project carries the named tag, excluding the bearing project even if it carries the named tag (REF-008).

Implementations§

Source§

impl TaskRef

Source

pub fn parse(s: &str) -> Result<Self, TaskRefError>

Parse s as a TaskRef.

Dispatch follows REF-006: at most three characters of lookahead for ^-prefixed forms, plus scanning past the closing ] for tag forms.

§Errors

Returns a TaskRefError when s violates the grammar (REF-002..REF-006, REF-008) or when any name component violates the identifier rules (REF-001, delegating to ID-001..ID-003):

§Examples
use haz_domain::task_ref::TaskRef;

assert!(TaskRef::parse("~:compile").is_ok());
assert!(TaskRef::parse("lib_core:compile").is_ok());
assert!(TaskRef::parse("^:compile").is_ok());
assert!(TaskRef::parse("^~:compile").is_ok());
assert!(TaskRef::parse("[typescript]:compile").is_ok());
assert!(TaskRef::parse("[typescript]~:compile").is_ok());

assert!(TaskRef::parse("").is_err());
assert!(TaskRef::parse("compile").is_err());
assert!(TaskRef::parse("[tag]compile").is_err());
assert!(TaskRef::parse("[tag]~compile").is_err());
Source

pub fn is_same_project(&self) -> bool

true if this is a same-project reference (~:<task>).

Source

pub fn is_project(&self) -> bool

true if this is a project reference (<project>:<task>).

Source

pub fn is_fan_out(&self) -> bool

true if this is a fan-out reference (^:<task>).

Source

pub fn is_sibling_fan_out(&self) -> bool

true if this is a sibling-fan-out reference (^~:<task>).

Source

pub fn is_tag(&self) -> bool

true if this is a tag reference ([<tag>]:<task>).

Source

pub fn is_sibling_tag(&self) -> bool

true if this is a sibling-tag reference ([<tag>]~:<task>).

Trait Implementations§

Source§

impl Clone for TaskRef

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 TaskRef

Source§

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

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

impl Display for TaskRef

Source§

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

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

impl Eq for TaskRef

Source§

impl Hash for TaskRef

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for TaskRef

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

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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.