pub struct Smit(/* private fields */);Expand description
A short marker a dog attaches to a sheep for shep flock to paint.
shep stores and prints it, never parses it: ▲ main@a1b2c3 is a
deploy tool’s sentence.
The grammar: non-empty once whitespace is discounted, at most
Self::MAX_CHARS characters, no char::is_control character,
\u{1b} included. Refused, never repaired, and validated here rather
than at the renderer: shep’s own output::width::sanitize_cell keeps
a well-formed CSI sequence, since shep’s colouring is made of them.
Self::MAX_CHARS counts chars, not bytes: a byte cap would refuse a
legitimate CJK smit at roughly a third of its apparent length.
Debug is derived: a smit carries no secret, so there is nothing to
redact.
§Example
use shep_core::protocol::Smit;
assert_eq!("▲ main@a1b2c3".parse::<Smit>()?.as_str(), "▲ main@a1b2c3");
assert!("\u{1b}[2Jgone".parse::<Smit>().is_err()); // no escapesImplementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Smit
Validates on decode: a dog written in another language speaks this wire
directly and never runs core::str::FromStr, so a derived impl would
let \u{1b}[2J reach every listing built from a smit.
impl<'de> Deserialize<'de> for Smit
Validates on decode: a dog written in another language speaks this wire
directly and never runs core::str::FromStr, so a derived impl would
let \u{1b}[2J reach every listing built from a smit.
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
impl Eq for Smit
Source§impl FromStr for Smit
impl FromStr for Smit
Source§fn from_str(text: &str) -> Result<Self, Self::Err>
fn from_str(text: &str) -> Result<Self, Self::Err>
§Errors
SmitError::Emptyif the text is nothing but whitespace.SmitError::TooLongif it is overSelf::MAX_CHARScharacters.SmitError::Unprintableif it holds a control character.
impl StructuralPartialEq for Smit
Auto Trait Implementations§
impl Freeze for Smit
impl RefUnwindSafe for Smit
impl Send for Smit
impl Sync for Smit
impl Unpin for Smit
impl UnsafeUnpin for Smit
impl UnwindSafe for Smit
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,
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.