pub fn as_rfc3339_nanos(t: &DateTime<Utc>) -> String {
    use chrono::format::{Fixed, Item, Numeric::*, Pad::Zero};

    const PREFIX: &[Item<'_>] = &[
        Item::Numeric(Year, Zero),
        Item::Literal("-"),
        Item::Numeric(Month, Zero),
        Item::Literal("-"),
        Item::Numeric(Day, Zero),
        Item::Literal("T"),
        Item::Numeric(Hour, Zero),
        Item::Literal(":"),
        Item::Numeric(Minute, Zero),
        Item::Literal(":"),
        Item::Numeric(Second, Zero),
    ];

    const NANOS: &[Item<'_>] = &[Item::Fixed(Fixed::Nanosecond)];

    // Format as RFC339 without nanoseconds nor timezone marker
    let prefix = t.format_with_items(PREFIX.iter());

    // Format nanoseconds with dot, leading zeros, and variable number of trailing zeros
    let nanos = t.format_with_items(NANOS.iter()).to_string();

    // Trim trailing zeros and remove leftover dot if any
    let nanos_trimmed = nanos.trim_end_matches('0').trim_end_matches('.');

    format!("{}{}Z", prefix, nanos_trimmed)
}
/// Serialization helper for converting a `DateTime<Utc>` object to a string.
///
/// This reproduces the behavior of Go's `time.RFC3339Nano` format,
/// ie. a RFC3339 date-time with left-padded subsecond digits without
///     trailing zeros and no trailing dot.
Serialization helper for converting a `DateTime` object to a string.
This reproduces the behavior of Go's `time.RFC3339Nano` format,
ie. a RFC3339 date-time with left-padded subsecond digits without
trailing zeros and no trailing dot.
Serialization helper for converting a ` DateTime ` object to a string . This reproduces the behavior of Go ' s ` time . RFC3339Nano ` format ie . a RFC3339 date - time with left - padded subsecond digits without trailing zeros and no trailing dot .
pub fn as_rfc3339_nanos(t: &DateTime<Utc>) -> String {
    use chrono::format::{Fixed, Item, Numeric::*, Pad::Zero};
    const PREFIX: &[Item<'_>] = &[
        Item::Numeric(Year, Zero),
        Item::Literal("-"),
        Item::Numeric(Month, Zero),
        Item::Literal("-"),
        Item::Numeric(Day, Zero),
        Item::Literal("T"),
        Item::Numeric(Hour, Zero),
        Item::Literal(":"),
        Item::Numeric(Minute, Zero),
        Item::Literal(":"),
        Item::Numeric(Second, Zero),
    ];
    const NANOS: &[Item<'_>] = &[Item::Fixed(Fixed::Nanosecond)];
    // Format as RFC339 without nanoseconds nor timezone marker
    let prefix = t.format_with_items(PREFIX.iter());
    // Format nanoseconds with dot, leading zeros, and variable number of trailing zeros
    let nanos = t.format_with_items(NANOS.iter()).to_string();
    // Trim trailing zeros and remove leftover dot if any
    let nanos_trimmed = nanos.trim_end_matches('0').trim_end_matches('.');
    format!("{}{}Z", prefix, nanos_trimmed)
}
pub fn as_rfc3339_nanos ( t : & DateTime < Utc > ) -> String { use chrono :: format :: { Fixed , Item , Numeric :: * , Pad :: Zero } ; const PREFIX : & [ Item < ' _ > ] = & [ Item :: Numeric ( Year , Zero ) , Item :: Literal ( " " ) , Item :: Numeric ( Month , Zero ) , Item :: Literal ( " " ) , Item :: Numeric ( Day , Zero ) , Item :: Literal ( " " ) , Item :: Numeric ( Hour , Zero ) , Item :: Literal ( " " ) , Item :: Numeric ( Minute , Zero ) , Item :: Literal ( " " ) , Item :: Numeric ( Second , Zero ) , ] ; const NANOS : & [ Item < ' _ > ] = & [ Item :: Fixed ( Fixed :: Nanosecond ) ] ; // Format as RFC339 without nanoseconds nor timezone marker let prefix = t . format_with_items ( PREFIX . iter ( ) ) ; // Format nanoseconds with dot, leading zeros, and variable number of trailing zeros let nanos = t . format_with_items ( NANOS . iter ( ) ) . to_string ( ) ; // Trim trailing zeros and remove leftover dot if any let nanos_trimmed = nanos . trim_end_matches ( '0' ) . trim_end_matches ( '.' ) ; format ! ( " " prefix nanos_trimmed ) }
Serialization helper for converting a `DateTime<Utc>` object to a string.
Serialization helper for converting a ` DateTime<Utc > ` object to a string .
t
&DateTime<Utc>