1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
pub use lucene_query_builder_rs_derive::*; use std::fmt; pub enum Operator { Or, And, End, } pub struct QueryString(pub String); impl fmt::Display for QueryString { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { if self.0.contains(' ') { write!(f, "\"{}\"", self.0) } else { write!(f, "{}", self.0) } } } impl fmt::Display for Operator { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Self::Or => write!(f, " OR "), Self::And => write!(f, " AND "), Self::End => write!(f, ""), } } }