Something went wrong. Try again.
Source code for my personal quote bot project.
Something went wrong. Try again.
Rust
12345678910111213141516171819202122232425262728293031323334/// A newtype over [String] to represent a single quote./// [Quote] does not implement [PartialEq] or [Eq] as, on principle, two/// quotes may be comprised of the same contents whilst still/// representing distinct quotes in practice (e.g. two different lines of dialogue which happen to be the same).#[derive(Debug, Clone)]pub struct Quote(String);
impl<S: AsRef<str>> From<S> for Quote { fn from(value: S) -> Self { Self(value.as_ref().to_owned()) }}
impl From<Quote> for String { fn from(value: Quote) -> Self { value.0 }}
impl Quote { pub fn get(&self) -> &str { &self.0 }}
pub trait Message { type Reply;}
#[async_trait::async_trait(?Send)]pub trait Handle<M: Message> { async fn handle(&'_ mut self, msg: M) -> M::Reply;}