mirror of
https://github.com/chronotope/chrono.git
synced 2025-10-02 07:21:41 +00:00
Make StrftimeItems::new
const
This commit is contained in:
parent
d8ec23def8
commit
13ad948ef9
@ -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: &[] }
|
||||
@ -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) }
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user