[][src]Struct q_debug::fmt::Formatter

pub struct Formatter {}

Implementations

impl Formatter[src]

pub fn header(&self, now: &DateTime<Utc>, log_location: &LogLocation) -> String[src]

pub fn q(&self) -> String[src]

pub fn q_literal<T: Debug>(&self, val: &T) -> String[src]

Returns a log line for a literal value, val.

use q::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)")
);

pub fn q_expr<T: Debug>(&self, val: &T, expr: &str) -> String[src]

Returns a log line for an expression with string representation expr and value val.

use q::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

impl Debug for Formatter[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.