Skip to content

Commit

Permalink
Make write_rfc3339 available in no_std
Browse files Browse the repository at this point in the history
  • Loading branch information
pitdicker committed Aug 5, 2023
1 parent 68782ba commit fa86d27
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
16 changes: 6 additions & 10 deletions src/format/formatting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,17 @@ use core::borrow::Borrow;
use core::fmt;
use core::fmt::Write;

use crate::datetime::SecondsFormat;
#[cfg(any(feature = "alloc", feature = "std"))]
use crate::naive::{NaiveDate, NaiveDateTime, NaiveTime};
use crate::offset::Offset;
use crate::{Datelike, FixedOffset, NaiveDateTime, Timelike};
#[cfg(any(feature = "alloc", feature = "std"))]
use crate::offset::{FixedOffset, Offset};
#[cfg(any(feature = "alloc", feature = "std"))]
use crate::{Datelike, SecondsFormat, Timelike, Weekday};
use crate::{NaiveDate, NaiveTime, Weekday};

use super::locales;
use super::{Colons, OffsetFormat, OffsetPrecision, Pad};
#[cfg(any(feature = "alloc", feature = "std"))]
use super::{
Colons, Fixed, InternalFixed, InternalInternal, Item, Locale, Numeric, OffsetFormat,
OffsetPrecision, Pad,
};
use super::{Fixed, InternalFixed, InternalInternal, Item, Locale, Numeric};
use locales::*;

/// A *temporary* object which can be used as an argument to `format!` or others.
Expand Down Expand Up @@ -447,7 +445,6 @@ fn format_inner(
}
}

#[cfg(any(feature = "alloc", feature = "std"))]
impl OffsetFormat {
/// Writes an offset from UTC with the format defined by `self`.
fn format(&self, w: &mut impl Write, off: FixedOffset) -> fmt::Result {
Expand Down Expand Up @@ -528,7 +525,6 @@ impl OffsetFormat {
}

/// Writes the date, time and offset to the string. same as `%Y-%m-%dT%H:%M:%S%.f%:z`
#[cfg(any(feature = "alloc", feature = "std"))]
#[inline]
pub(crate) fn write_rfc3339(
w: &mut impl Write,
Expand Down
5 changes: 3 additions & 2 deletions src/format/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,12 @@ pub(crate) mod locales;

pub(crate) use formatting::write_hundreds;
#[cfg(any(feature = "alloc", feature = "std"))]
pub(crate) use formatting::write_rfc2822;
pub(crate) use formatting::write_rfc3339;
#[cfg(any(feature = "alloc", feature = "std"))]
pub use formatting::{format, format_item, DelayedFormat};
#[cfg(feature = "unstable-locales")]
pub use formatting::{format_item_localized, format_localized};
#[cfg(any(feature = "alloc", feature = "std"))]
pub(crate) use formatting::{write_rfc2822, write_rfc3339};
#[cfg(feature = "unstable-locales")]
pub use locales::Locale;
#[cfg(not(feature = "unstable-locales"))]
Expand Down

0 comments on commit fa86d27

Please sign in to comment.