pub struct CommandName(/* private fields */);Expand description
One half of a command name: kebab-cased, [a-z0-9-] only.
A command is two of these, <group> <command> — vouchers update. Which
path segment each half is taken from is the grouping rule a bless step
runs; this type is only what the user types.
A bless step writes both into its reduced model, so a name comes back off a
blob as well as out of a document. Both doors are the same door: serde
reads it as a String and runs it through CommandName::new, so a blob
cannot smuggle in a name a document could not have produced.
Implementations§
Source§impl CommandName
impl CommandName
Sourcepub fn new(origin: &'static str, raw: &str) -> Result<Self, NameError>
pub fn new(origin: &'static str, raw: &str) -> Result<Self, NameError>
renderVoucher becomes render-voucher; anything that will not reduce to
[a-z0-9-] is rejected rather than mangled.
origin is what the raw name was read off, and it is there for the
error: a document whose own words cannot be spelled is told which word.
pub fn as_str(&self) -> &str
Trait Implementations§
Source§impl Clone for CommandName
impl Clone for CommandName
Source§fn clone(&self) -> CommandName
fn clone(&self) -> CommandName
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CommandName
impl Debug for CommandName
Source§impl<'de> Deserialize<'de> for CommandName
impl<'de> Deserialize<'de> for CommandName
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>,
Source§impl Display for CommandName
impl Display for CommandName
impl Eq for CommandName
Source§impl From<CommandName> for String
impl From<CommandName> for String
Source§fn from(name: CommandName) -> Self
fn from(name: CommandName) -> Self
Source§impl Hash for CommandName
impl Hash for CommandName
Source§impl Ord for CommandName
impl Ord for CommandName
Source§fn cmp(&self, other: &CommandName) -> Ordering
fn cmp(&self, other: &CommandName) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for CommandName
impl PartialEq for CommandName
Source§impl PartialOrd for CommandName
impl PartialOrd for CommandName
Source§impl Serialize for CommandName
impl Serialize for CommandName
impl StructuralPartialEq for CommandName
Auto Trait Implementations§
impl Freeze for CommandName
impl RefUnwindSafe for CommandName
impl Send for CommandName
impl Sync for CommandName
impl Unpin for CommandName
impl UnsafeUnpin for CommandName
impl UnwindSafe for CommandName
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.