//! Sanitisers use super::*; use std::{ error, fmt, }; mod sentance; pub use sentance::*; mod word; pub use word::*; pub mod filter; /* pub fn take_sentance(from: &mut T, to: &mut U) -> Result { todo!() }*/ #[derive(Debug)] pub enum Error { Word(WordError), Sentance(SentanceError), } impl error::Error for Error{} impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Self::Word(_) => write!(f, "couldn't extract word"), Self::Sentance(_) => write!(f, "couldn't extract sentance"), } } } impl From for Error { #[inline] fn from(from: WordError) -> Self { Self::Word(from) } } impl From for Error { #[inline] fn from(from: SentanceError) -> Self { Self::Sentance(from) } } #[cfg(test)] mod tests { use super::*; #[test] fn sentance() { let string = r#"Hello world. I am a string, that is a string. Strings, I love them!!! Owo uwu"#; let sentances = Sentance::new_iter(string); for sentance in sentances { let words = Word::new(sentance); println!("Word in {:?} -> {:?}", sentance, words); } } }