Struct peace_core::FlowId
source · pub struct FlowId(/* private fields */);
Expand description
Identifier or name of a process flow.
Examples are "dev_env"
and "artifact"
in the following snippet:
peace dev_env discover # StatesDiscoverCmd
peace dev_env status # StatesCurrentStoredDisplayCmd
peace dev_env deploy # EnsureCmd
peace dev_env clean # CleanCmd
peace artifact discover # StatesDiscoverCmd
peace artifact status # StatesCurrentStoredDisplayCmd
peace artifact publish # EnsureCmd
Must begin with a letter or underscore, and contain only letters, numbers, and underscores.
§Examples
The following are all examples of valid FlowId
s:
let _snake = flow_id!("snake_case");
let _camel = flow_id!("camelCase");
let _pascal = flow_id!("PascalCase");
Implementations§
source§impl FlowId
impl FlowId
sourcepub fn new(s: &'static str) -> Result<Self, FlowIdInvalidFmt<'_>>
pub fn new(s: &'static str) -> Result<Self, FlowIdInvalidFmt<'_>>
Returns a new FlowId
if the given &str
is valid.
Most users should use the flow_id!
macro as this provides
compile time checks and returns a const
value.
sourcepub fn is_valid_id(proposed_id: &str) -> bool
pub fn is_valid_id(proposed_id: &str) -> bool
Returns whether the provided &str
is a valid station identifier.
Methods from Deref<Target = Cow<'static, str>>§
sourcepub fn is_borrowed(&self) -> bool
🔬This is a nightly-only experimental API. (cow_is_borrowed
)
pub fn is_borrowed(&self) -> bool
cow_is_borrowed
)Returns true if the data is borrowed, i.e. if to_mut
would require additional work.
§Examples
#![feature(cow_is_borrowed)]
use std::borrow::Cow;
let cow = Cow::Borrowed("moo");
assert!(cow.is_borrowed());
let bull: Cow<'_, str> = Cow::Owned("...moo?".to_string());
assert!(!bull.is_borrowed());
sourcepub fn is_owned(&self) -> bool
🔬This is a nightly-only experimental API. (cow_is_borrowed
)
pub fn is_owned(&self) -> bool
cow_is_borrowed
)Returns true if the data is owned, i.e. if to_mut
would be a no-op.
§Examples
#![feature(cow_is_borrowed)]
use std::borrow::Cow;
let cow: Cow<'_, str> = Cow::Owned("moo".to_string());
assert!(cow.is_owned());
let bull = Cow::Borrowed("...moo?");
assert!(!bull.is_owned());
Trait Implementations§
source§impl<'de> Deserialize<'de> for FlowId
impl<'de> Deserialize<'de> for FlowId
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>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq for FlowId
impl PartialEq for FlowId
source§impl Presentable for FlowId
impl Presentable for FlowId
source§fn present<'output, 'life0, 'life1, 'async_trait, PR>(
&'life0 self,
presenter: &'life1 mut PR
) -> Pin<Box<dyn Future<Output = Result<(), PR::Error>> + 'async_trait>>where
PR: Presenter<'output> + 'async_trait,
Self: 'async_trait,
'output: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn present<'output, 'life0, 'life1, 'async_trait, PR>(
&'life0 self,
presenter: &'life1 mut PR
) -> Pin<Box<dyn Future<Output = Result<(), PR::Error>> + 'async_trait>>where
PR: Presenter<'output> + 'async_trait,
Self: 'async_trait,
'output: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Presents this data type to the user.
source§impl TryFrom<&'static str> for FlowId
impl TryFrom<&'static str> for FlowId
§type Error = FlowIdInvalidFmt<'static>
type Error = FlowIdInvalidFmt<'static>
The type returned in the event of a conversion error.
source§impl TryFrom<String> for FlowId
impl TryFrom<String> for FlowId
§type Error = FlowIdInvalidFmt<'static>
type Error = FlowIdInvalidFmt<'static>
The type returned in the event of a conversion error.
impl Eq for FlowId
impl StructuralPartialEq for FlowId
Auto Trait Implementations§
impl RefUnwindSafe for FlowId
impl Send for FlowId
impl Sync for FlowId
impl Unpin for FlowId
impl UnwindSafe for FlowId
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more