use std::fmt::Display; use std::str::FromStr; #[derive(Debug)] pub struct ErrorVec { errors: Vec, } impl From> for Vec { fn from(e: ErrorVec) -> Self { e.errors } } impl From> for ErrorVec { fn from(e: Vec) -> Self { ErrorVec { errors: e } } } // has to be implemented for Dioxus server functions impl Display for ErrorVec { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!( f, "{}", self.errors .iter() .map(|e| e.to_string()) .collect::>() .join("\n") ) } } // has to be implemented for Dioxus server functions impl FromStr for ErrorVec { type Err = (); fn from_str(s: &str) -> Result { Ok(ErrorVec { errors: Vec::new() }) } }