Skip to content

Commit

Permalink
Make StrftimeItems::new const
Browse files Browse the repository at this point in the history
  • Loading branch information
pitdicker committed Jun 23, 2023
1 parent ae4e8b2 commit 8f4d363
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/format/strftime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ pub struct StrftimeItems<'a> {
impl<'a> StrftimeItems<'a> {
/// Creates a new parsing iterator from the `strftime`-like format string.
#[must_use]
pub fn new(s: &'a str) -> StrftimeItems<'a> {
pub const fn new(s: &'a str) -> StrftimeItems<'a> {
#[cfg(not(feature = "unstable-locales"))]
{
StrftimeItems { remainder: s, queue: &[] }
Expand All @@ -235,7 +235,7 @@ impl<'a> StrftimeItems<'a> {
#[cfg(feature = "unstable-locales")]
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-locales")))]
#[must_use]
pub fn new_with_locale(s: &'a str, locale: Locale) -> StrftimeItems<'a> {
pub const fn new_with_locale(s: &'a str, locale: Locale) -> StrftimeItems<'a> {
StrftimeItems { remainder: s, queue: &[], locale_str: "", locale: Some(locale) }
}
}
Expand Down

0 comments on commit 8f4d363

Please sign in to comment.