Source code for my personal quote bot project.
at actor-rewrite 24 lines 637 B view raw
1/// A newtype over [String] to represent a single quote. 2/// [Quote] does not implement [PartialEq] or [Eq] as, on principle, two 3/// quotes may be comprised of the same contents whilst still 4/// representing distinct quotes in practice (e.g. two different lines of dialogue which happen to be the same). 5#[derive(Debug, Clone)] 6pub struct Quote(String); 7 8impl<S: AsRef<str>> From<S> for Quote { 9 fn from(value: S) -> Self { 10 Self(value.as_ref().to_owned()) 11 } 12} 13 14impl From<Quote> for String { 15 fn from(value: Quote) -> Self { 16 value.0 17 } 18} 19 20impl Quote { 21 pub fn get(&self) -> &str { 22 &self.0 23 } 24}