pub struct Formatter {}Implementations§
Source§impl Formatter
impl Formatter
pub fn header(&self, now: &DateTime<Utc>, log_location: &LogLocation) -> String
pub fn q(&self) -> String
Sourcepub fn q_literal<T: Debug>(&self, val: &T) -> String
pub fn q_literal<T: Debug>(&self, val: &T) -> String
Returns a log line for a literal value, val.
use q_debug::fmt::Formatter;
let fmt = Formatter {};
assert_eq!(
fmt.q_literal(&String::from("Test message")),
String::from("> \"Test message\"")
);
assert_eq!(
fmt.q_literal(&Some(42)),
String::from("> Some(42)")
);Sourcepub fn q_expr<T: Debug>(&self, val: &T, expr: &str) -> String
pub fn q_expr<T: Debug>(&self, val: &T, expr: &str) -> String
Returns a log line for an expression with string representation expr
and value val.
use q_debug::fmt::Formatter;
let fmt = Formatter {};
assert_eq!(
fmt.q_expr(&3, &String::from("my_var")),
String::from("> my_var = 3")
);
assert_eq!(
fmt.q_expr(&5, &String::from("2 + 3")),
String::from("> 2 + 3 = 5")
);Trait Implementations§
Auto Trait Implementations§
impl Freeze for Formatter
impl RefUnwindSafe for Formatter
impl Send for Formatter
impl Sync for Formatter
impl Unpin for Formatter
impl UnwindSafe for Formatter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more