Struct sqlx::types::chrono::NaiveDate [−][src]
pub struct NaiveDate { /* fields omitted */ }
Expand description
ISO 8601 calendar date without timezone. Allows for every proleptic Gregorian date from Jan 1, 262145 BCE to Dec 31, 262143 CE. Also supports the conversion from ISO 8601 ordinal and week date.
Calendar Date
The ISO 8601 calendar date follows the proleptic Gregorian calendar. It is like a normal civil calendar but note some slight differences:
-
Dates before the Gregorian calendar’s inception in 1582 are defined via the extrapolation. Be careful, as historical dates are often noted in the Julian calendar and others and the transition to Gregorian may differ across countries (as late as early 20C).
(Some example: Both Shakespeare from Britain and Cervantes from Spain seemingly died on the same calendar date—April 23, 1616—but in the different calendar. Britain used the Julian calendar at that time, so Shakespeare’s death is later.)
-
ISO 8601 calendars has the year 0, which is 1 BCE (a year before 1 CE). If you need a typical BCE/BC and CE/AD notation for year numbers, use the
Datelike::year_ce
method.
Week Date
The ISO 8601 week date is a triple of year number, week number and day of the week with the following rules:
-
A week consists of Monday through Sunday, and is always numbered within some year. The week number ranges from 1 to 52 or 53 depending on the year.
-
The week 1 of given year is defined as the first week containing January 4 of that year, or equivalently, the first week containing four or more days in that year.
-
The year number in the week date may not correspond to the actual Gregorian year. For example, January 3, 2016 (Sunday) was on the last (53rd) week of 2015.
Chrono’s date types default to the ISO 8601 calendar date,
but Datelike::iso_week
and
Datelike::weekday
methods
can be used to get the corresponding week date.
Ordinal Date
The ISO 8601 ordinal date is a pair of year number and day of the year (“ordinal”). The ordinal number ranges from 1 to 365 or 366 depending on the year. The year number is the same as that of the calendar date.
This is currently the internal format of Chrono’s date types.
Implementations
impl NaiveDate
[src]
impl NaiveDate
[src]pub fn from_ymd(year: i32, month: u32, day: u32) -> NaiveDate
[src]
pub fn from_ymd(year: i32, month: u32, day: u32) -> NaiveDate
[src]Makes a new NaiveDate
from the calendar date
(year, month and day).
Panics on the out-of-range date, invalid month and/or day.
Example
use chrono::{NaiveDate, Datelike, Weekday}; let d = NaiveDate::from_ymd(2015, 3, 14); assert_eq!(d.year(), 2015); assert_eq!(d.month(), 3); assert_eq!(d.day(), 14); assert_eq!(d.ordinal(), 73); // day of year assert_eq!(d.iso_week().year(), 2015); assert_eq!(d.iso_week().week(), 11); assert_eq!(d.weekday(), Weekday::Sat); assert_eq!(d.num_days_from_ce(), 735671); // days since January 1, 1 CE
pub fn from_ymd_opt(year: i32, month: u32, day: u32) -> Option<NaiveDate>
[src]
pub fn from_ymd_opt(year: i32, month: u32, day: u32) -> Option<NaiveDate>
[src]Makes a new NaiveDate
from the calendar date
(year, month and day).
Returns None
on the out-of-range date, invalid month and/or day.
Example
use chrono::NaiveDate; let from_ymd_opt = NaiveDate::from_ymd_opt; assert!(from_ymd_opt(2015, 3, 14).is_some()); assert!(from_ymd_opt(2015, 0, 14).is_none()); assert!(from_ymd_opt(2015, 2, 29).is_none()); assert!(from_ymd_opt(-4, 2, 29).is_some()); // 5 BCE is a leap year assert!(from_ymd_opt(400000, 1, 1).is_none()); assert!(from_ymd_opt(-400000, 1, 1).is_none());
pub fn from_yo(year: i32, ordinal: u32) -> NaiveDate
[src]
pub fn from_yo(year: i32, ordinal: u32) -> NaiveDate
[src]Makes a new NaiveDate
from the ordinal date
(year and day of the year).
Panics on the out-of-range date and/or invalid day of year.
Example
use chrono::{NaiveDate, Datelike, Weekday}; let d = NaiveDate::from_yo(2015, 73); assert_eq!(d.ordinal(), 73); assert_eq!(d.year(), 2015); assert_eq!(d.month(), 3); assert_eq!(d.day(), 14); assert_eq!(d.iso_week().year(), 2015); assert_eq!(d.iso_week().week(), 11); assert_eq!(d.weekday(), Weekday::Sat); assert_eq!(d.num_days_from_ce(), 735671); // days since January 1, 1 CE
pub fn from_yo_opt(year: i32, ordinal: u32) -> Option<NaiveDate>
[src]
pub fn from_yo_opt(year: i32, ordinal: u32) -> Option<NaiveDate>
[src]Makes a new NaiveDate
from the ordinal date
(year and day of the year).
Returns None
on the out-of-range date and/or invalid day of year.
Example
use chrono::NaiveDate; let from_yo_opt = NaiveDate::from_yo_opt; assert!(from_yo_opt(2015, 100).is_some()); assert!(from_yo_opt(2015, 0).is_none()); assert!(from_yo_opt(2015, 365).is_some()); assert!(from_yo_opt(2015, 366).is_none()); assert!(from_yo_opt(-4, 366).is_some()); // 5 BCE is a leap year assert!(from_yo_opt(400000, 1).is_none()); assert!(from_yo_opt(-400000, 1).is_none());
pub fn from_isoywd(year: i32, week: u32, weekday: Weekday) -> NaiveDate
[src]
pub fn from_isoywd(year: i32, week: u32, weekday: Weekday) -> NaiveDate
[src]Makes a new NaiveDate
from the ISO week date
(year, week number and day of the week).
The resulting NaiveDate
may have a different year from the input year.
Panics on the out-of-range date and/or invalid week number.
Example
use chrono::{NaiveDate, Datelike, Weekday}; let d = NaiveDate::from_isoywd(2015, 11, Weekday::Sat); assert_eq!(d.iso_week().year(), 2015); assert_eq!(d.iso_week().week(), 11); assert_eq!(d.weekday(), Weekday::Sat); assert_eq!(d.year(), 2015); assert_eq!(d.month(), 3); assert_eq!(d.day(), 14); assert_eq!(d.ordinal(), 73); // day of year assert_eq!(d.num_days_from_ce(), 735671); // days since January 1, 1 CE
pub fn from_isoywd_opt(
year: i32,
week: u32,
weekday: Weekday
) -> Option<NaiveDate>
[src]
pub fn from_isoywd_opt(
year: i32,
week: u32,
weekday: Weekday
) -> Option<NaiveDate>
[src]Makes a new NaiveDate
from the ISO week date
(year, week number and day of the week).
The resulting NaiveDate
may have a different year from the input year.
Returns None
on the out-of-range date and/or invalid week number.
Example
use chrono::{NaiveDate, Weekday}; let from_ymd = NaiveDate::from_ymd; let from_isoywd_opt = NaiveDate::from_isoywd_opt; assert_eq!(from_isoywd_opt(2015, 0, Weekday::Sun), None); assert_eq!(from_isoywd_opt(2015, 10, Weekday::Sun), Some(from_ymd(2015, 3, 8))); assert_eq!(from_isoywd_opt(2015, 30, Weekday::Mon), Some(from_ymd(2015, 7, 20))); assert_eq!(from_isoywd_opt(2015, 60, Weekday::Mon), None); assert_eq!(from_isoywd_opt(400000, 10, Weekday::Fri), None); assert_eq!(from_isoywd_opt(-400000, 10, Weekday::Sat), None);
The year number of ISO week date may differ from that of the calendar date.
// Mo Tu We Th Fr Sa Su // 2014-W52 22 23 24 25 26 27 28 has 4+ days of new year, // 2015-W01 29 30 31 1 2 3 4 <- so this is the first week assert_eq!(from_isoywd_opt(2014, 52, Weekday::Sun), Some(from_ymd(2014, 12, 28))); assert_eq!(from_isoywd_opt(2014, 53, Weekday::Mon), None); assert_eq!(from_isoywd_opt(2015, 1, Weekday::Mon), Some(from_ymd(2014, 12, 29))); // 2015-W52 21 22 23 24 25 26 27 has 4+ days of old year, // 2015-W53 28 29 30 31 1 2 3 <- so this is the last week // 2016-W01 4 5 6 7 8 9 10 assert_eq!(from_isoywd_opt(2015, 52, Weekday::Sun), Some(from_ymd(2015, 12, 27))); assert_eq!(from_isoywd_opt(2015, 53, Weekday::Sun), Some(from_ymd(2016, 1, 3))); assert_eq!(from_isoywd_opt(2015, 54, Weekday::Mon), None); assert_eq!(from_isoywd_opt(2016, 1, Weekday::Mon), Some(from_ymd(2016, 1, 4)));
pub fn from_num_days_from_ce(days: i32) -> NaiveDate
[src]
pub fn from_num_days_from_ce(days: i32) -> NaiveDate
[src]Makes a new NaiveDate
from a day’s number in the proleptic Gregorian calendar, with
January 1, 1 being day 1.
Panics if the date is out of range.
Example
use chrono::{NaiveDate, Datelike, Weekday}; let d = NaiveDate::from_num_days_from_ce(735671); assert_eq!(d.num_days_from_ce(), 735671); // days since January 1, 1 CE assert_eq!(d.year(), 2015); assert_eq!(d.month(), 3); assert_eq!(d.day(), 14); assert_eq!(d.ordinal(), 73); // day of year assert_eq!(d.iso_week().year(), 2015); assert_eq!(d.iso_week().week(), 11); assert_eq!(d.weekday(), Weekday::Sat);
While not directly supported by Chrono,
it is easy to convert from the Julian day number
(January 1, 4713 BCE in the Julian calendar being Day 0)
to Gregorian with this method.
(Note that this panics when jd
is out of range.)
use chrono::NaiveDate; fn jd_to_date(jd: i32) -> NaiveDate { // keep in mind that the Julian day number is 0-based // while this method requires an 1-based number. NaiveDate::from_num_days_from_ce(jd - 1721425) } // January 1, 4713 BCE in Julian = November 24, 4714 BCE in Gregorian assert_eq!(jd_to_date(0), NaiveDate::from_ymd(-4713, 11, 24)); assert_eq!(jd_to_date(1721426), NaiveDate::from_ymd(1, 1, 1)); assert_eq!(jd_to_date(2450000), NaiveDate::from_ymd(1995, 10, 9)); assert_eq!(jd_to_date(2451545), NaiveDate::from_ymd(2000, 1, 1));
pub fn from_num_days_from_ce_opt(days: i32) -> Option<NaiveDate>
[src]
pub fn from_num_days_from_ce_opt(days: i32) -> Option<NaiveDate>
[src]Makes a new NaiveDate
from a day’s number in the proleptic Gregorian calendar, with
January 1, 1 being day 1.
Returns None
if the date is out of range.
Example
use chrono::NaiveDate; let from_ndays_opt = NaiveDate::from_num_days_from_ce_opt; let from_ymd = NaiveDate::from_ymd; assert_eq!(from_ndays_opt(730_000), Some(from_ymd(1999, 9, 3))); assert_eq!(from_ndays_opt(1), Some(from_ymd(1, 1, 1))); assert_eq!(from_ndays_opt(0), Some(from_ymd(0, 12, 31))); assert_eq!(from_ndays_opt(-1), Some(from_ymd(0, 12, 30))); assert_eq!(from_ndays_opt(100_000_000), None); assert_eq!(from_ndays_opt(-100_000_000), None);
pub fn from_weekday_of_month(
year: i32,
month: u32,
weekday: Weekday,
n: u8
) -> NaiveDate
[src]
pub fn from_weekday_of_month(
year: i32,
month: u32,
weekday: Weekday,
n: u8
) -> NaiveDate
[src]Makes a new NaiveDate
by counting the number of occurrences of a particular day-of-week
since the beginning of the given month. For instance, if you want the 2nd Friday of March
2017, you would use NaiveDate::from_weekday_of_month(2017, 3, Weekday::Fri, 2)
.
Panics
The resulting NaiveDate
is guaranteed to be in month
. If n
is larger than the number
of weekday
in month
(eg. the 6th Friday of March 2017) then this function will panic.
n
is 1-indexed. Passing n=0
will cause a panic.
Example
use chrono::{NaiveDate, Weekday}; let from_weekday_of_month = NaiveDate::from_weekday_of_month; let from_ymd = NaiveDate::from_ymd; assert_eq!(from_weekday_of_month(2018, 8, Weekday::Wed, 1), from_ymd(2018, 8, 1)); assert_eq!(from_weekday_of_month(2018, 8, Weekday::Fri, 1), from_ymd(2018, 8, 3)); assert_eq!(from_weekday_of_month(2018, 8, Weekday::Tue, 2), from_ymd(2018, 8, 14)); assert_eq!(from_weekday_of_month(2018, 8, Weekday::Fri, 4), from_ymd(2018, 8, 24)); assert_eq!(from_weekday_of_month(2018, 8, Weekday::Fri, 5), from_ymd(2018, 8, 31));
pub fn from_weekday_of_month_opt(
year: i32,
month: u32,
weekday: Weekday,
n: u8
) -> Option<NaiveDate>
[src]
pub fn from_weekday_of_month_opt(
year: i32,
month: u32,
weekday: Weekday,
n: u8
) -> Option<NaiveDate>
[src]Makes a new NaiveDate
by counting the number of occurrences of a particular day-of-week
since the beginning of the given month. For instance, if you want the 2nd Friday of March
2017, you would use NaiveDate::from_weekday_of_month(2017, 3, Weekday::Fri, 2)
. n
is 1-indexed.
use chrono::{NaiveDate, Weekday}; assert_eq!(NaiveDate::from_weekday_of_month_opt(2017, 3, Weekday::Fri, 2), NaiveDate::from_ymd_opt(2017, 3, 10))
Returns None
if n
out-of-range; ie. if n
is larger than the number of weekday
in
month
(eg. the 6th Friday of March 2017), or if n == 0
.
pub fn parse_from_str(s: &str, fmt: &str) -> Result<NaiveDate, ParseError>
[src]
pub fn parse_from_str(s: &str, fmt: &str) -> Result<NaiveDate, ParseError>
[src]Parses a string with the specified format string and returns a new NaiveDate
.
See the format::strftime
module
on the supported escape sequences.
Example
use chrono::NaiveDate; let parse_from_str = NaiveDate::parse_from_str; assert_eq!(parse_from_str("2015-09-05", "%Y-%m-%d"), Ok(NaiveDate::from_ymd(2015, 9, 5))); assert_eq!(parse_from_str("5sep2015", "%d%b%Y"), Ok(NaiveDate::from_ymd(2015, 9, 5)));
Time and offset is ignored for the purpose of parsing.
assert_eq!(parse_from_str("2014-5-17T12:34:56+09:30", "%Y-%m-%dT%H:%M:%S%z"), Ok(NaiveDate::from_ymd(2014, 5, 17)));
Out-of-bound dates or insufficient fields are errors.
assert!(parse_from_str("2015/9", "%Y/%m").is_err()); assert!(parse_from_str("2015/9/31", "%Y/%m/%d").is_err());
All parsed fields should be consistent to each other, otherwise it’s an error.
assert!(parse_from_str("Sat, 09 Aug 2013", "%a, %d %b %Y").is_err());
pub fn and_time(&self, time: NaiveTime) -> NaiveDateTime
[src]
pub fn and_time(&self, time: NaiveTime) -> NaiveDateTime
[src]Makes a new NaiveDateTime
from the current date and given NaiveTime
.
Example
use chrono::{NaiveDate, NaiveTime, NaiveDateTime}; let d = NaiveDate::from_ymd(2015, 6, 3); let t = NaiveTime::from_hms_milli(12, 34, 56, 789); let dt: NaiveDateTime = d.and_time(t); assert_eq!(dt.date(), d); assert_eq!(dt.time(), t);
pub fn and_hms(&self, hour: u32, min: u32, sec: u32) -> NaiveDateTime
[src]
pub fn and_hms(&self, hour: u32, min: u32, sec: u32) -> NaiveDateTime
[src]Makes a new NaiveDateTime
from the current date, hour, minute and second.
No leap second is allowed here;
use NaiveDate::and_hms_*
methods with a subsecond parameter instead.
Panics on invalid hour, minute and/or second.
Example
use chrono::{NaiveDate, NaiveDateTime, Datelike, Timelike, Weekday}; let d = NaiveDate::from_ymd(2015, 6, 3); let dt: NaiveDateTime = d.and_hms(12, 34, 56); assert_eq!(dt.year(), 2015); assert_eq!(dt.weekday(), Weekday::Wed); assert_eq!(dt.second(), 56);
pub fn and_hms_opt(
&self,
hour: u32,
min: u32,
sec: u32
) -> Option<NaiveDateTime>
[src]
pub fn and_hms_opt(
&self,
hour: u32,
min: u32,
sec: u32
) -> Option<NaiveDateTime>
[src]Makes a new NaiveDateTime
from the current date, hour, minute and second.
No leap second is allowed here;
use NaiveDate::and_hms_*_opt
methods with a subsecond parameter instead.
Returns None
on invalid hour, minute and/or second.
Example
use chrono::NaiveDate; let d = NaiveDate::from_ymd(2015, 6, 3); assert!(d.and_hms_opt(12, 34, 56).is_some()); assert!(d.and_hms_opt(12, 34, 60).is_none()); // use `and_hms_milli_opt` instead assert!(d.and_hms_opt(12, 60, 56).is_none()); assert!(d.and_hms_opt(24, 34, 56).is_none());
pub fn and_hms_milli(
&self,
hour: u32,
min: u32,
sec: u32,
milli: u32
) -> NaiveDateTime
[src]
pub fn and_hms_milli(
&self,
hour: u32,
min: u32,
sec: u32,
milli: u32
) -> NaiveDateTime
[src]Makes a new NaiveDateTime
from the current date, hour, minute, second and millisecond.
The millisecond part can exceed 1,000 in order to represent the leap second.
Panics on invalid hour, minute, second and/or millisecond.
Example
use chrono::{NaiveDate, NaiveDateTime, Datelike, Timelike, Weekday}; let d = NaiveDate::from_ymd(2015, 6, 3); let dt: NaiveDateTime = d.and_hms_milli(12, 34, 56, 789); assert_eq!(dt.year(), 2015); assert_eq!(dt.weekday(), Weekday::Wed); assert_eq!(dt.second(), 56); assert_eq!(dt.nanosecond(), 789_000_000);
pub fn and_hms_milli_opt(
&self,
hour: u32,
min: u32,
sec: u32,
milli: u32
) -> Option<NaiveDateTime>
[src]
pub fn and_hms_milli_opt(
&self,
hour: u32,
min: u32,
sec: u32,
milli: u32
) -> Option<NaiveDateTime>
[src]Makes a new NaiveDateTime
from the current date, hour, minute, second and millisecond.
The millisecond part can exceed 1,000 in order to represent the leap second.
Returns None
on invalid hour, minute, second and/or millisecond.
Example
use chrono::NaiveDate; let d = NaiveDate::from_ymd(2015, 6, 3); assert!(d.and_hms_milli_opt(12, 34, 56, 789).is_some()); assert!(d.and_hms_milli_opt(12, 34, 59, 1_789).is_some()); // leap second assert!(d.and_hms_milli_opt(12, 34, 59, 2_789).is_none()); assert!(d.and_hms_milli_opt(12, 34, 60, 789).is_none()); assert!(d.and_hms_milli_opt(12, 60, 56, 789).is_none()); assert!(d.and_hms_milli_opt(24, 34, 56, 789).is_none());
pub fn and_hms_micro(
&self,
hour: u32,
min: u32,
sec: u32,
micro: u32
) -> NaiveDateTime
[src]
pub fn and_hms_micro(
&self,
hour: u32,
min: u32,
sec: u32,
micro: u32
) -> NaiveDateTime
[src]Makes a new NaiveDateTime
from the current date, hour, minute, second and microsecond.
The microsecond part can exceed 1,000,000 in order to represent the leap second.
Panics on invalid hour, minute, second and/or microsecond.
Example
use chrono::{NaiveDate, NaiveDateTime, Datelike, Timelike, Weekday}; let d = NaiveDate::from_ymd(2015, 6, 3); let dt: NaiveDateTime = d.and_hms_micro(12, 34, 56, 789_012); assert_eq!(dt.year(), 2015); assert_eq!(dt.weekday(), Weekday::Wed); assert_eq!(dt.second(), 56); assert_eq!(dt.nanosecond(), 789_012_000);
pub fn and_hms_micro_opt(
&self,
hour: u32,
min: u32,
sec: u32,
micro: u32
) -> Option<NaiveDateTime>
[src]
pub fn and_hms_micro_opt(
&self,
hour: u32,
min: u32,
sec: u32,
micro: u32
) -> Option<NaiveDateTime>
[src]Makes a new NaiveDateTime
from the current date, hour, minute, second and microsecond.
The microsecond part can exceed 1,000,000 in order to represent the leap second.
Returns None
on invalid hour, minute, second and/or microsecond.
Example
use chrono::NaiveDate; let d = NaiveDate::from_ymd(2015, 6, 3); assert!(d.and_hms_micro_opt(12, 34, 56, 789_012).is_some()); assert!(d.and_hms_micro_opt(12, 34, 59, 1_789_012).is_some()); // leap second assert!(d.and_hms_micro_opt(12, 34, 59, 2_789_012).is_none()); assert!(d.and_hms_micro_opt(12, 34, 60, 789_012).is_none()); assert!(d.and_hms_micro_opt(12, 60, 56, 789_012).is_none()); assert!(d.and_hms_micro_opt(24, 34, 56, 789_012).is_none());
pub fn and_hms_nano(
&self,
hour: u32,
min: u32,
sec: u32,
nano: u32
) -> NaiveDateTime
[src]
pub fn and_hms_nano(
&self,
hour: u32,
min: u32,
sec: u32,
nano: u32
) -> NaiveDateTime
[src]Makes a new NaiveDateTime
from the current date, hour, minute, second and nanosecond.
The nanosecond part can exceed 1,000,000,000 in order to represent the leap second.
Panics on invalid hour, minute, second and/or nanosecond.
Example
use chrono::{NaiveDate, NaiveDateTime, Datelike, Timelike, Weekday}; let d = NaiveDate::from_ymd(2015, 6, 3); let dt: NaiveDateTime = d.and_hms_nano(12, 34, 56, 789_012_345); assert_eq!(dt.year(), 2015); assert_eq!(dt.weekday(), Weekday::Wed); assert_eq!(dt.second(), 56); assert_eq!(dt.nanosecond(), 789_012_345);
pub fn and_hms_nano_opt(
&self,
hour: u32,
min: u32,
sec: u32,
nano: u32
) -> Option<NaiveDateTime>
[src]
pub fn and_hms_nano_opt(
&self,
hour: u32,
min: u32,
sec: u32,
nano: u32
) -> Option<NaiveDateTime>
[src]Makes a new NaiveDateTime
from the current date, hour, minute, second and nanosecond.
The nanosecond part can exceed 1,000,000,000 in order to represent the leap second.
Returns None
on invalid hour, minute, second and/or nanosecond.
Example
use chrono::NaiveDate; let d = NaiveDate::from_ymd(2015, 6, 3); assert!(d.and_hms_nano_opt(12, 34, 56, 789_012_345).is_some()); assert!(d.and_hms_nano_opt(12, 34, 59, 1_789_012_345).is_some()); // leap second assert!(d.and_hms_nano_opt(12, 34, 59, 2_789_012_345).is_none()); assert!(d.and_hms_nano_opt(12, 34, 60, 789_012_345).is_none()); assert!(d.and_hms_nano_opt(12, 60, 56, 789_012_345).is_none()); assert!(d.and_hms_nano_opt(24, 34, 56, 789_012_345).is_none());
pub fn succ(&self) -> NaiveDate
[src]
pub fn succ(&self) -> NaiveDate
[src]Makes a new NaiveDate
for the next calendar date.
Panics when self
is the last representable date.
Example
use chrono::NaiveDate; assert_eq!(NaiveDate::from_ymd(2015, 6, 3).succ(), NaiveDate::from_ymd(2015, 6, 4)); assert_eq!(NaiveDate::from_ymd(2015, 6, 30).succ(), NaiveDate::from_ymd(2015, 7, 1)); assert_eq!(NaiveDate::from_ymd(2015, 12, 31).succ(), NaiveDate::from_ymd(2016, 1, 1));
pub fn succ_opt(&self) -> Option<NaiveDate>
[src]
pub fn succ_opt(&self) -> Option<NaiveDate>
[src]Makes a new NaiveDate
for the next calendar date.
Returns None
when self
is the last representable date.
Example
use chrono::NaiveDate; use chrono::naive::MAX_DATE; assert_eq!(NaiveDate::from_ymd(2015, 6, 3).succ_opt(), Some(NaiveDate::from_ymd(2015, 6, 4))); assert_eq!(MAX_DATE.succ_opt(), None);
pub fn pred(&self) -> NaiveDate
[src]
pub fn pred(&self) -> NaiveDate
[src]Makes a new NaiveDate
for the previous calendar date.
Panics when self
is the first representable date.
Example
use chrono::NaiveDate; assert_eq!(NaiveDate::from_ymd(2015, 6, 3).pred(), NaiveDate::from_ymd(2015, 6, 2)); assert_eq!(NaiveDate::from_ymd(2015, 6, 1).pred(), NaiveDate::from_ymd(2015, 5, 31)); assert_eq!(NaiveDate::from_ymd(2015, 1, 1).pred(), NaiveDate::from_ymd(2014, 12, 31));
pub fn pred_opt(&self) -> Option<NaiveDate>
[src]
pub fn pred_opt(&self) -> Option<NaiveDate>
[src]Makes a new NaiveDate
for the previous calendar date.
Returns None
when self
is the first representable date.
Example
use chrono::NaiveDate; use chrono::naive::MIN_DATE; assert_eq!(NaiveDate::from_ymd(2015, 6, 3).pred_opt(), Some(NaiveDate::from_ymd(2015, 6, 2))); assert_eq!(MIN_DATE.pred_opt(), None);
pub fn checked_add_signed(self, rhs: Duration) -> Option<NaiveDate>
[src]
pub fn checked_add_signed(self, rhs: Duration) -> Option<NaiveDate>
[src]Adds the days
part of given Duration
to the current date.
Returns None
when it will result in overflow.
Example
use chrono::{Duration, NaiveDate}; use chrono::naive::MAX_DATE; let d = NaiveDate::from_ymd(2015, 9, 5); assert_eq!(d.checked_add_signed(Duration::days(40)), Some(NaiveDate::from_ymd(2015, 10, 15))); assert_eq!(d.checked_add_signed(Duration::days(-40)), Some(NaiveDate::from_ymd(2015, 7, 27))); assert_eq!(d.checked_add_signed(Duration::days(1_000_000_000)), None); assert_eq!(d.checked_add_signed(Duration::days(-1_000_000_000)), None); assert_eq!(MAX_DATE.checked_add_signed(Duration::days(1)), None);
pub fn checked_sub_signed(self, rhs: Duration) -> Option<NaiveDate>
[src]
pub fn checked_sub_signed(self, rhs: Duration) -> Option<NaiveDate>
[src]Subtracts the days
part of given Duration
from the current date.
Returns None
when it will result in overflow.
Example
use chrono::{Duration, NaiveDate}; use chrono::naive::MIN_DATE; let d = NaiveDate::from_ymd(2015, 9, 5); assert_eq!(d.checked_sub_signed(Duration::days(40)), Some(NaiveDate::from_ymd(2015, 7, 27))); assert_eq!(d.checked_sub_signed(Duration::days(-40)), Some(NaiveDate::from_ymd(2015, 10, 15))); assert_eq!(d.checked_sub_signed(Duration::days(1_000_000_000)), None); assert_eq!(d.checked_sub_signed(Duration::days(-1_000_000_000)), None); assert_eq!(MIN_DATE.checked_sub_signed(Duration::days(1)), None);
pub fn signed_duration_since(self, rhs: NaiveDate) -> Duration
[src]
pub fn signed_duration_since(self, rhs: NaiveDate) -> Duration
[src]Subtracts another NaiveDate
from the current date.
Returns a Duration
of integral numbers.
This does not overflow or underflow at all,
as all possible output fits in the range of Duration
.
Example
use chrono::{Duration, NaiveDate}; let from_ymd = NaiveDate::from_ymd; let since = NaiveDate::signed_duration_since; assert_eq!(since(from_ymd(2014, 1, 1), from_ymd(2014, 1, 1)), Duration::zero()); assert_eq!(since(from_ymd(2014, 1, 1), from_ymd(2013, 12, 31)), Duration::days(1)); assert_eq!(since(from_ymd(2014, 1, 1), from_ymd(2014, 1, 2)), Duration::days(-1)); assert_eq!(since(from_ymd(2014, 1, 1), from_ymd(2013, 9, 23)), Duration::days(100)); assert_eq!(since(from_ymd(2014, 1, 1), from_ymd(2013, 1, 1)), Duration::days(365)); assert_eq!(since(from_ymd(2014, 1, 1), from_ymd(2010, 1, 1)), Duration::days(365*4 + 1)); assert_eq!(since(from_ymd(2014, 1, 1), from_ymd(1614, 1, 1)), Duration::days(365*400 + 97));
pub fn format_with_items<'a, I, B>(&self, items: I) -> DelayedFormat<I> where
I: Iterator<Item = B> + Clone,
B: Borrow<Item<'a>>,
[src]
pub fn format_with_items<'a, I, B>(&self, items: I) -> DelayedFormat<I> where
I: Iterator<Item = B> + Clone,
B: Borrow<Item<'a>>,
[src]Formats the date with the specified formatting items.
Otherwise it is the same as the ordinary format
method.
The Iterator
of items should be Clone
able,
since the resulting DelayedFormat
value may be formatted multiple times.
Example
use chrono::NaiveDate; use chrono::format::strftime::StrftimeItems; let fmt = StrftimeItems::new("%Y-%m-%d"); let d = NaiveDate::from_ymd(2015, 9, 5); assert_eq!(d.format_with_items(fmt.clone()).to_string(), "2015-09-05"); assert_eq!(d.format("%Y-%m-%d").to_string(), "2015-09-05");
The resulting DelayedFormat
can be formatted directly via the Display
trait.
assert_eq!(format!("{}", d.format_with_items(fmt)), "2015-09-05");
pub fn format(&self, fmt: &'a str) -> DelayedFormat<StrftimeItems<'a>>
[src]
pub fn format(&self, fmt: &'a str) -> DelayedFormat<StrftimeItems<'a>>
[src]Formats the date with the specified format string.
See the format::strftime
module
on the supported escape sequences.
This returns a DelayedFormat
,
which gets converted to a string only when actual formatting happens.
You may use the to_string
method to get a String
,
or just feed it into print!
and other formatting macros.
(In this way it avoids the redundant memory allocation.)
A wrong format string does not issue an error immediately.
Rather, converting or formatting the DelayedFormat
fails.
You are recommended to immediately use DelayedFormat
for this reason.
Example
use chrono::NaiveDate; let d = NaiveDate::from_ymd(2015, 9, 5); assert_eq!(d.format("%Y-%m-%d").to_string(), "2015-09-05"); assert_eq!(d.format("%A, %-d %B, %C%y").to_string(), "Saturday, 5 September, 2015");
The resulting DelayedFormat
can be formatted directly via the Display
trait.
assert_eq!(format!("{}", d.format("%Y-%m-%d")), "2015-09-05"); assert_eq!(format!("{}", d.format("%A, %-d %B, %C%y")), "Saturday, 5 September, 2015");
pub fn iter_days(&self) -> NaiveDateDaysIterator
[src]
pub fn iter_days(&self) -> NaiveDateDaysIterator
[src]Returns an iterator that steps by days until the last representable date.
Example
let expected = [ NaiveDate::from_ymd(2016, 2, 27), NaiveDate::from_ymd(2016, 2, 28), NaiveDate::from_ymd(2016, 2, 29), NaiveDate::from_ymd(2016, 3, 1), ]; let mut count = 0; for (idx, d) in NaiveDate::from_ymd(2016, 2, 27).iter_days().take(4).enumerate() { assert_eq!(d, expected[idx]); count += 1; } assert_eq!(count, 4);
pub fn iter_weeks(&self) -> NaiveDateWeeksIterator
[src]
pub fn iter_weeks(&self) -> NaiveDateWeeksIterator
[src]Returns an iterator that steps by weeks until the last representable date.
Example
let expected = [ NaiveDate::from_ymd(2016, 2, 27), NaiveDate::from_ymd(2016, 3, 5), NaiveDate::from_ymd(2016, 3, 12), NaiveDate::from_ymd(2016, 3, 19), ]; let mut count = 0; for (idx, d) in NaiveDate::from_ymd(2016, 2, 27).iter_weeks().take(4).enumerate() { assert_eq!(d, expected[idx]); count += 1; } assert_eq!(count, 4);
Trait Implementations
impl Add<Duration> for NaiveDate
[src]
impl Add<Duration> for NaiveDate
[src]An addition of Duration
to NaiveDate
discards the fractional days,
rounding to the closest integral number of days towards Duration::zero()
.
Panics on underflow or overflow.
Use NaiveDate::checked_add_signed
to detect that.
Example
use chrono::{Duration, NaiveDate}; let from_ymd = NaiveDate::from_ymd; assert_eq!(from_ymd(2014, 1, 1) + Duration::zero(), from_ymd(2014, 1, 1)); assert_eq!(from_ymd(2014, 1, 1) + Duration::seconds(86399), from_ymd(2014, 1, 1)); assert_eq!(from_ymd(2014, 1, 1) + Duration::seconds(-86399), from_ymd(2014, 1, 1)); assert_eq!(from_ymd(2014, 1, 1) + Duration::days(1), from_ymd(2014, 1, 2)); assert_eq!(from_ymd(2014, 1, 1) + Duration::days(-1), from_ymd(2013, 12, 31)); assert_eq!(from_ymd(2014, 1, 1) + Duration::days(364), from_ymd(2014, 12, 31)); assert_eq!(from_ymd(2014, 1, 1) + Duration::days(365*4 + 1), from_ymd(2018, 1, 1)); assert_eq!(from_ymd(2014, 1, 1) + Duration::days(365*400 + 97), from_ymd(2414, 1, 1));
impl AddAssign<Duration> for NaiveDate
[src]
impl AddAssign<Duration> for NaiveDate
[src]pub fn add_assign(&mut self, rhs: Duration)
[src]
pub fn add_assign(&mut self, rhs: Duration)
[src]Performs the +=
operation. Read more
impl Datelike for NaiveDate
[src]
impl Datelike for NaiveDate
[src]pub fn year(&self) -> i32
[src]
pub fn year(&self) -> i32
[src]Returns the year number in the calendar date.
Example
use chrono::{NaiveDate, Datelike}; assert_eq!(NaiveDate::from_ymd(2015, 9, 8).year(), 2015); assert_eq!(NaiveDate::from_ymd(-308, 3, 14).year(), -308); // 309 BCE
pub fn month(&self) -> u32
[src]
pub fn month(&self) -> u32
[src]Returns the month number starting from 1.
The return value ranges from 1 to 12.
Example
use chrono::{NaiveDate, Datelike}; assert_eq!(NaiveDate::from_ymd(2015, 9, 8).month(), 9); assert_eq!(NaiveDate::from_ymd(-308, 3, 14).month(), 3);
pub fn month0(&self) -> u32
[src]
pub fn month0(&self) -> u32
[src]Returns the month number starting from 0.
The return value ranges from 0 to 11.
Example
use chrono::{NaiveDate, Datelike}; assert_eq!(NaiveDate::from_ymd(2015, 9, 8).month0(), 8); assert_eq!(NaiveDate::from_ymd(-308, 3, 14).month0(), 2);
pub fn day(&self) -> u32
[src]
pub fn day(&self) -> u32
[src]Returns the day of month starting from 1.
The return value ranges from 1 to 31. (The last day of month differs by months.)
Example
use chrono::{NaiveDate, Datelike}; assert_eq!(NaiveDate::from_ymd(2015, 9, 8).day(), 8); assert_eq!(NaiveDate::from_ymd(-308, 3, 14).day(), 14);
Combined with NaiveDate::pred
,
one can determine the number of days in a particular month.
(Note that this panics when year
is out of range.)
use chrono::{NaiveDate, Datelike}; fn ndays_in_month(year: i32, month: u32) -> u32 { // the first day of the next month... let (y, m) = if month == 12 { (year + 1, 1) } else { (year, month + 1) }; let d = NaiveDate::from_ymd(y, m, 1); // ...is preceded by the last day of the original month d.pred().day() } assert_eq!(ndays_in_month(2015, 8), 31); assert_eq!(ndays_in_month(2015, 9), 30); assert_eq!(ndays_in_month(2015, 12), 31); assert_eq!(ndays_in_month(2016, 2), 29); assert_eq!(ndays_in_month(2017, 2), 28);
pub fn day0(&self) -> u32
[src]
pub fn day0(&self) -> u32
[src]Returns the day of month starting from 0.
The return value ranges from 0 to 30. (The last day of month differs by months.)
Example
use chrono::{NaiveDate, Datelike}; assert_eq!(NaiveDate::from_ymd(2015, 9, 8).day0(), 7); assert_eq!(NaiveDate::from_ymd(-308, 3, 14).day0(), 13);
pub fn ordinal(&self) -> u32
[src]
pub fn ordinal(&self) -> u32
[src]Returns the day of year starting from 1.
The return value ranges from 1 to 366. (The last day of year differs by years.)
Example
use chrono::{NaiveDate, Datelike}; assert_eq!(NaiveDate::from_ymd(2015, 9, 8).ordinal(), 251); assert_eq!(NaiveDate::from_ymd(-308, 3, 14).ordinal(), 74);
Combined with NaiveDate::pred
,
one can determine the number of days in a particular year.
(Note that this panics when year
is out of range.)
use chrono::{NaiveDate, Datelike}; fn ndays_in_year(year: i32) -> u32 { // the first day of the next year... let d = NaiveDate::from_ymd(year + 1, 1, 1); // ...is preceded by the last day of the original year d.pred().ordinal() } assert_eq!(ndays_in_year(2015), 365); assert_eq!(ndays_in_year(2016), 366); assert_eq!(ndays_in_year(2017), 365); assert_eq!(ndays_in_year(2000), 366); assert_eq!(ndays_in_year(2100), 365);
pub fn ordinal0(&self) -> u32
[src]
pub fn ordinal0(&self) -> u32
[src]Returns the day of year starting from 0.
The return value ranges from 0 to 365. (The last day of year differs by years.)
Example
use chrono::{NaiveDate, Datelike}; assert_eq!(NaiveDate::from_ymd(2015, 9, 8).ordinal0(), 250); assert_eq!(NaiveDate::from_ymd(-308, 3, 14).ordinal0(), 73);
pub fn weekday(&self) -> Weekday
[src]
pub fn weekday(&self) -> Weekday
[src]Returns the day of week.
Example
use chrono::{NaiveDate, Datelike, Weekday}; assert_eq!(NaiveDate::from_ymd(2015, 9, 8).weekday(), Weekday::Tue); assert_eq!(NaiveDate::from_ymd(-308, 3, 14).weekday(), Weekday::Fri);
pub fn with_year(&self, year: i32) -> Option<NaiveDate>
[src]
pub fn with_year(&self, year: i32) -> Option<NaiveDate>
[src]Makes a new NaiveDate
with the year number changed.
Returns None
when the resulting NaiveDate
would be invalid.
Example
use chrono::{NaiveDate, Datelike}; assert_eq!(NaiveDate::from_ymd(2015, 9, 8).with_year(2016), Some(NaiveDate::from_ymd(2016, 9, 8))); assert_eq!(NaiveDate::from_ymd(2015, 9, 8).with_year(-308), Some(NaiveDate::from_ymd(-308, 9, 8)));
A leap day (February 29) is a good example that this method can return None
.
assert!(NaiveDate::from_ymd(2016, 2, 29).with_year(2015).is_none()); assert!(NaiveDate::from_ymd(2016, 2, 29).with_year(2020).is_some());
pub fn with_month(&self, month: u32) -> Option<NaiveDate>
[src]
pub fn with_month(&self, month: u32) -> Option<NaiveDate>
[src]Makes a new NaiveDate
with the month number (starting from 1) changed.
Returns None
when the resulting NaiveDate
would be invalid.
Example
use chrono::{NaiveDate, Datelike}; assert_eq!(NaiveDate::from_ymd(2015, 9, 8).with_month(10), Some(NaiveDate::from_ymd(2015, 10, 8))); assert_eq!(NaiveDate::from_ymd(2015, 9, 8).with_month(13), None); // no month 13 assert_eq!(NaiveDate::from_ymd(2015, 9, 30).with_month(2), None); // no February 30
pub fn with_month0(&self, month0: u32) -> Option<NaiveDate>
[src]
pub fn with_month0(&self, month0: u32) -> Option<NaiveDate>
[src]Makes a new NaiveDate
with the month number (starting from 0) changed.
Returns None
when the resulting NaiveDate
would be invalid.
Example
use chrono::{NaiveDate, Datelike}; assert_eq!(NaiveDate::from_ymd(2015, 9, 8).with_month0(9), Some(NaiveDate::from_ymd(2015, 10, 8))); assert_eq!(NaiveDate::from_ymd(2015, 9, 8).with_month0(12), None); // no month 13 assert_eq!(NaiveDate::from_ymd(2015, 9, 30).with_month0(1), None); // no February 30
pub fn with_day(&self, day: u32) -> Option<NaiveDate>
[src]
pub fn with_day(&self, day: u32) -> Option<NaiveDate>
[src]Makes a new NaiveDate
with the day of month (starting from 1) changed.
Returns None
when the resulting NaiveDate
would be invalid.
Example
use chrono::{NaiveDate, Datelike}; assert_eq!(NaiveDate::from_ymd(2015, 9, 8).with_day(30), Some(NaiveDate::from_ymd(2015, 9, 30))); assert_eq!(NaiveDate::from_ymd(2015, 9, 8).with_day(31), None); // no September 31
pub fn with_day0(&self, day0: u32) -> Option<NaiveDate>
[src]
pub fn with_day0(&self, day0: u32) -> Option<NaiveDate>
[src]Makes a new NaiveDate
with the day of month (starting from 0) changed.
Returns None
when the resulting NaiveDate
would be invalid.
Example
use chrono::{NaiveDate, Datelike}; assert_eq!(NaiveDate::from_ymd(2015, 9, 8).with_day0(29), Some(NaiveDate::from_ymd(2015, 9, 30))); assert_eq!(NaiveDate::from_ymd(2015, 9, 8).with_day0(30), None); // no September 31
pub fn with_ordinal(&self, ordinal: u32) -> Option<NaiveDate>
[src]
pub fn with_ordinal(&self, ordinal: u32) -> Option<NaiveDate>
[src]Makes a new NaiveDate
with the day of year (starting from 1) changed.
Returns None
when the resulting NaiveDate
would be invalid.
Example
use chrono::{NaiveDate, Datelike}; assert_eq!(NaiveDate::from_ymd(2015, 1, 1).with_ordinal(60), Some(NaiveDate::from_ymd(2015, 3, 1))); assert_eq!(NaiveDate::from_ymd(2015, 1, 1).with_ordinal(366), None); // 2015 had only 365 days assert_eq!(NaiveDate::from_ymd(2016, 1, 1).with_ordinal(60), Some(NaiveDate::from_ymd(2016, 2, 29))); assert_eq!(NaiveDate::from_ymd(2016, 1, 1).with_ordinal(366), Some(NaiveDate::from_ymd(2016, 12, 31)));
pub fn with_ordinal0(&self, ordinal0: u32) -> Option<NaiveDate>
[src]
pub fn with_ordinal0(&self, ordinal0: u32) -> Option<NaiveDate>
[src]Makes a new NaiveDate
with the day of year (starting from 0) changed.
Returns None
when the resulting NaiveDate
would be invalid.
Example
use chrono::{NaiveDate, Datelike}; assert_eq!(NaiveDate::from_ymd(2015, 1, 1).with_ordinal0(59), Some(NaiveDate::from_ymd(2015, 3, 1))); assert_eq!(NaiveDate::from_ymd(2015, 1, 1).with_ordinal0(365), None); // 2015 had only 365 days assert_eq!(NaiveDate::from_ymd(2016, 1, 1).with_ordinal0(59), Some(NaiveDate::from_ymd(2016, 2, 29))); assert_eq!(NaiveDate::from_ymd(2016, 1, 1).with_ordinal0(365), Some(NaiveDate::from_ymd(2016, 12, 31)));
fn year_ce(&self) -> (bool, u32)
[src]
fn year_ce(&self) -> (bool, u32)
[src]Returns the absolute year number starting from 1 with a boolean flag, which is false when the year predates the epoch (BCE/BC) and true otherwise (CE/AD). Read more
fn num_days_from_ce(&self) -> i32
[src]
fn num_days_from_ce(&self) -> i32
[src]Counts the days in the proleptic Gregorian calendar, with January 1, Year 1 (CE) as day 1. Read more
impl Debug for NaiveDate
[src]
impl Debug for NaiveDate
[src]The Debug
output of the naive date d
is the same as
d.format("%Y-%m-%d")
.
The string printed can be readily parsed via the parse
method on str
.
Example
use chrono::NaiveDate; assert_eq!(format!("{:?}", NaiveDate::from_ymd(2015, 9, 5)), "2015-09-05"); assert_eq!(format!("{:?}", NaiveDate::from_ymd( 0, 1, 1)), "0000-01-01"); assert_eq!(format!("{:?}", NaiveDate::from_ymd(9999, 12, 31)), "9999-12-31");
ISO 8601 requires an explicit sign for years before 1 BCE or after 9999 CE.
assert_eq!(format!("{:?}", NaiveDate::from_ymd( -1, 1, 1)), "-0001-01-01"); assert_eq!(format!("{:?}", NaiveDate::from_ymd(10000, 12, 31)), "+10000-12-31");
impl Display for NaiveDate
[src]
impl Display for NaiveDate
[src]The Display
output of the naive date d
is the same as
d.format("%Y-%m-%d")
.
The string printed can be readily parsed via the parse
method on str
.
Example
use chrono::NaiveDate; assert_eq!(format!("{}", NaiveDate::from_ymd(2015, 9, 5)), "2015-09-05"); assert_eq!(format!("{}", NaiveDate::from_ymd( 0, 1, 1)), "0000-01-01"); assert_eq!(format!("{}", NaiveDate::from_ymd(9999, 12, 31)), "9999-12-31");
ISO 8601 requires an explicit sign for years before 1 BCE or after 9999 CE.
assert_eq!(format!("{}", NaiveDate::from_ymd( -1, 1, 1)), "-0001-01-01"); assert_eq!(format!("{}", NaiveDate::from_ymd(10000, 12, 31)), "+10000-12-31");
impl<'_> Encode<'_, MySql> for NaiveDate
[src]
impl<'_> Encode<'_, MySql> for NaiveDate
[src]pub fn encode_by_ref(&self, buf: &mut Vec<u8, Global>) -> IsNull
[src]
pub fn encode_by_ref(&self, buf: &mut Vec<u8, Global>) -> IsNull
[src]Writes the value of self
into buf
without moving self
. Read more
pub fn size_hint(&self) -> usize
[src]
#[must_use]fn encode(self, buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer) -> IsNull
[src]
#[must_use]fn encode(self, buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer) -> IsNull
[src]Writes the value of self
into buf
in the expected format for the database.
fn produces(&self) -> Option<<DB as Database>::TypeInfo>
[src]
impl<'_> Encode<'_, Postgres> for NaiveDate
[src]
impl<'_> Encode<'_, Postgres> for NaiveDate
[src]pub fn encode_by_ref(&self, buf: &mut PgArgumentBuffer) -> IsNull
[src]
pub fn encode_by_ref(&self, buf: &mut PgArgumentBuffer) -> IsNull
[src]Writes the value of self
into buf
without moving self
. Read more
pub fn size_hint(&self) -> usize
[src]
#[must_use]fn encode(self, buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer) -> IsNull
[src]
#[must_use]fn encode(self, buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer) -> IsNull
[src]Writes the value of self
into buf
in the expected format for the database.
fn produces(&self) -> Option<<DB as Database>::TypeInfo>
[src]
impl<'_> Encode<'_, Sqlite> for NaiveDate
[src]
impl<'_> Encode<'_, Sqlite> for NaiveDate
[src]pub fn encode_by_ref(
&self,
buf: &mut Vec<SqliteArgumentValue<'_>, Global>
) -> IsNull
[src]
pub fn encode_by_ref(
&self,
buf: &mut Vec<SqliteArgumentValue<'_>, Global>
) -> IsNull
[src]Writes the value of self
into buf
without moving self
. Read more
#[must_use]fn encode(self, buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer) -> IsNull
[src]
#[must_use]fn encode(self, buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer) -> IsNull
[src]Writes the value of self
into buf
in the expected format for the database.
fn produces(&self) -> Option<<DB as Database>::TypeInfo>
[src]
fn size_hint(&self) -> usize
[src]
impl FromStr for NaiveDate
[src]
impl FromStr for NaiveDate
[src]Parsing a str
into a NaiveDate
uses the same format,
%Y-%m-%d
, as in Debug
and Display
.
Example
use chrono::NaiveDate; let d = NaiveDate::from_ymd(2015, 9, 18); assert_eq!("2015-09-18".parse::<NaiveDate>(), Ok(d)); let d = NaiveDate::from_ymd(12345, 6, 7); assert_eq!("+12345-6-7".parse::<NaiveDate>(), Ok(d)); assert!("foo".parse::<NaiveDate>().is_err());
type Err = ParseError
type Err = ParseError
The associated error which can be returned from parsing.
impl Ord for NaiveDate
[src]
impl Ord for NaiveDate
[src]impl PartialOrd<NaiveDate> for NaiveDate
[src]
impl PartialOrd<NaiveDate> for NaiveDate
[src]pub fn partial_cmp(&self, other: &NaiveDate) -> Option<Ordering>
[src]
pub fn partial_cmp(&self, other: &NaiveDate) -> Option<Ordering>
[src]This method returns an ordering between self
and other
values if one exists. Read more
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Sub<Duration> for NaiveDate
[src]
impl Sub<Duration> for NaiveDate
[src]A subtraction of Duration
from NaiveDate
discards the fractional days,
rounding to the closest integral number of days towards Duration::zero()
.
It is the same as the addition with a negated Duration
.
Panics on underflow or overflow.
Use NaiveDate::checked_sub_signed
to detect that.
Example
use chrono::{Duration, NaiveDate}; let from_ymd = NaiveDate::from_ymd; assert_eq!(from_ymd(2014, 1, 1) - Duration::zero(), from_ymd(2014, 1, 1)); assert_eq!(from_ymd(2014, 1, 1) - Duration::seconds(86399), from_ymd(2014, 1, 1)); assert_eq!(from_ymd(2014, 1, 1) - Duration::seconds(-86399), from_ymd(2014, 1, 1)); assert_eq!(from_ymd(2014, 1, 1) - Duration::days(1), from_ymd(2013, 12, 31)); assert_eq!(from_ymd(2014, 1, 1) - Duration::days(-1), from_ymd(2014, 1, 2)); assert_eq!(from_ymd(2014, 1, 1) - Duration::days(364), from_ymd(2013, 1, 2)); assert_eq!(from_ymd(2014, 1, 1) - Duration::days(365*4 + 1), from_ymd(2010, 1, 1)); assert_eq!(from_ymd(2014, 1, 1) - Duration::days(365*400 + 97), from_ymd(1614, 1, 1));
impl Sub<NaiveDate> for NaiveDate
[src]
impl Sub<NaiveDate> for NaiveDate
[src]Subtracts another NaiveDate
from the current date.
Returns a Duration
of integral numbers.
This does not overflow or underflow at all,
as all possible output fits in the range of Duration
.
The implementation is a wrapper around
NaiveDate::signed_duration_since
.
Example
use chrono::{Duration, NaiveDate}; let from_ymd = NaiveDate::from_ymd; assert_eq!(from_ymd(2014, 1, 1) - from_ymd(2014, 1, 1), Duration::zero()); assert_eq!(from_ymd(2014, 1, 1) - from_ymd(2013, 12, 31), Duration::days(1)); assert_eq!(from_ymd(2014, 1, 1) - from_ymd(2014, 1, 2), Duration::days(-1)); assert_eq!(from_ymd(2014, 1, 1) - from_ymd(2013, 9, 23), Duration::days(100)); assert_eq!(from_ymd(2014, 1, 1) - from_ymd(2013, 1, 1), Duration::days(365)); assert_eq!(from_ymd(2014, 1, 1) - from_ymd(2010, 1, 1), Duration::days(365*4 + 1)); assert_eq!(from_ymd(2014, 1, 1) - from_ymd(1614, 1, 1), Duration::days(365*400 + 97));
impl SubAssign<Duration> for NaiveDate
[src]
impl SubAssign<Duration> for NaiveDate
[src]pub fn sub_assign(&mut self, rhs: Duration)
[src]
pub fn sub_assign(&mut self, rhs: Duration)
[src]Performs the -=
operation. Read more
impl Type<MySql> for NaiveDate
[src]
impl Type<MySql> for NaiveDate
[src]pub fn type_info() -> MySqlTypeInfo
[src]
pub fn type_info() -> MySqlTypeInfo
[src]Returns the canonical SQL type for this Rust type. Read more
impl Type<Postgres> for NaiveDate
[src]
impl Type<Postgres> for NaiveDate
[src]pub fn type_info() -> PgTypeInfo
[src]
pub fn type_info() -> PgTypeInfo
[src]Returns the canonical SQL type for this Rust type. Read more
impl Type<Sqlite> for NaiveDate
[src]
impl Type<Sqlite> for NaiveDate
[src]pub fn type_info() -> SqliteTypeInfo
[src]
pub fn type_info() -> SqliteTypeInfo
[src]Returns the canonical SQL type for this Rust type. Read more
pub fn compatible(ty: &SqliteTypeInfo) -> bool
[src]
pub fn compatible(ty: &SqliteTypeInfo) -> bool
[src]Determines if this Rust type is compatible with the given SQL type. Read more
impl Copy for NaiveDate
[src]
impl Eq for NaiveDate
[src]
impl StructuralEq for NaiveDate
[src]
impl StructuralPartialEq for NaiveDate
[src]
Auto Trait Implementations
impl RefUnwindSafe for NaiveDate
impl Send for NaiveDate
impl Sync for NaiveDate
impl Unpin for NaiveDate
impl UnwindSafe for NaiveDate
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]pub fn equivalent(&self, key: &K) -> bool
[src]
pub fn equivalent(&self, key: &K) -> bool
[src]Compare self to key
and return true
if they are equal.
impl<T> FmtForward for T
impl<T> FmtForward for T
fn fmt_binary(self) -> FmtBinary<Self> where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self> where
Self: Binary,
Causes self
to use its Binary
implementation when Debug
-formatted.
fn fmt_display(self) -> FmtDisplay<Self> where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self> where
Self: Display,
Causes self
to use its Display
implementation when
Debug
-formatted. Read more
fn fmt_lower_exp(self) -> FmtLowerExp<Self> where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self> where
Self: LowerExp,
Causes self
to use its LowerExp
implementation when
Debug
-formatted. Read more
fn fmt_lower_hex(self) -> FmtLowerHex<Self> where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self> where
Self: LowerHex,
Causes self
to use its LowerHex
implementation when
Debug
-formatted. Read more
fn fmt_octal(self) -> FmtOctal<Self> where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self> where
Self: Octal,
Causes self
to use its Octal
implementation when Debug
-formatted.
fn fmt_pointer(self) -> FmtPointer<Self> where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self> where
Self: Pointer,
Causes self
to use its Pointer
implementation when
Debug
-formatted. Read more
fn fmt_upper_exp(self) -> FmtUpperExp<Self> where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self> where
Self: UpperExp,
Causes self
to use its UpperExp
implementation when
Debug
-formatted. Read more
fn fmt_upper_hex(self) -> FmtUpperHex<Self> where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self> where
Self: UpperHex,
Causes self
to use its UpperHex
implementation when
Debug
-formatted. Read more
impl<T> Pipe for T where
T: ?Sized,
impl<T> Pipe for T where
T: ?Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
Pipes by value. This is generally the method you want to use. Read more
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R where
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R where
R: 'a,
Borrows self
and passes that borrow into the pipe function. Read more
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R where
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R where
R: 'a,
Mutably borrows self
and passes that borrow into the pipe function. Read more
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R where
Self: Borrow<B>,
R: 'a,
B: 'a + ?Sized,
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R where
Self: Borrow<B>,
R: 'a,
B: 'a + ?Sized,
Borrows self
, then passes self.borrow()
into the pipe function. Read more
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> R where
Self: BorrowMut<B>,
R: 'a,
B: 'a + ?Sized,
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> R where
Self: BorrowMut<B>,
R: 'a,
B: 'a + ?Sized,
Mutably borrows self
, then passes self.borrow_mut()
into the pipe
function. Read more
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R where
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R where
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
Borrows self
, then passes self.as_ref()
into the pipe function.
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R where
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R where
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
Mutably borrows self
, then passes self.as_mut()
into the pipe
function. Read more
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
Borrows self
, then passes self.deref()
into the pipe function.
impl<T> PipeAsRef for T
impl<T> PipeAsRef for T
fn pipe_as_ref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: AsRef<T>,
T: 'a,
R: 'a,
fn pipe_as_ref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: AsRef<T>,
T: 'a,
R: 'a,
Pipes a trait borrow into a function that cannot normally be called in suffix position. Read more
fn pipe_as_mut<'a, T, R>(&'a mut self, func: impl FnOnce(&'a mut T) -> R) -> R where
Self: AsMut<T>,
T: 'a,
R: 'a,
fn pipe_as_mut<'a, T, R>(&'a mut self, func: impl FnOnce(&'a mut T) -> R) -> R where
Self: AsMut<T>,
T: 'a,
R: 'a,
Pipes a trait mutable borrow into a function that cannot normally be called in suffix position. Read more
impl<T> PipeBorrow for T
impl<T> PipeBorrow for T
fn pipe_borrow<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: Borrow<T>,
T: 'a,
R: 'a,
fn pipe_borrow<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: Borrow<T>,
T: 'a,
R: 'a,
Pipes a trait borrow into a function that cannot normally be called in suffix position. Read more
fn pipe_borrow_mut<'a, T, R>(
&'a mut self,
func: impl FnOnce(&'a mut T) -> R
) -> R where
Self: BorrowMut<T>,
T: 'a,
R: 'a,
fn pipe_borrow_mut<'a, T, R>(
&'a mut self,
func: impl FnOnce(&'a mut T) -> R
) -> R where
Self: BorrowMut<T>,
T: 'a,
R: 'a,
Pipes a trait mutable borrow into a function that cannot normally be called in suffix position. Read more
impl<T> PipeDeref for T
impl<T> PipeDeref for T
fn pipe_deref<'a, R>(&'a self, func: impl FnOnce(&'a Self::Target) -> R) -> R where
Self: Deref,
R: 'a,
fn pipe_deref<'a, R>(&'a self, func: impl FnOnce(&'a Self::Target) -> R) -> R where
Self: Deref,
R: 'a,
Pipes a dereference into a function that cannot normally be called in suffix position. Read more
fn pipe_deref_mut<'a, R>(
&'a mut self,
func: impl FnOnce(&'a mut Self::Target) -> R
) -> R where
Self: DerefMut,
R: 'a,
fn pipe_deref_mut<'a, R>(
&'a mut self,
func: impl FnOnce(&'a mut Self::Target) -> R
) -> R where
Self: DerefMut,
R: 'a,
Pipes a mutable dereference into a function that cannot normally be called in suffix position. Read more
impl<T> PipeRef for T
impl<T> PipeRef for T
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self
impl<T> Tap for T
impl<T> Tap for T
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
Immutable access to the Borrow<B>
of a value. Read more
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
Mutable access to the BorrowMut<B>
of a value. Read more
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self where
Self: AsRef<R>,
R: ?Sized,
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self where
Self: AsRef<R>,
R: ?Sized,
Immutable access to the AsRef<R>
view of a value. Read more
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
Mutable access to the AsMut<R>
view of a value. Read more
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self where
Self: Deref<Target = T>,
T: ?Sized,
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self where
Self: Deref<Target = T>,
T: ?Sized,
Immutable access to the Deref::Target
of a value. Read more
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self where
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self where
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
Mutable access to the Deref::Target
of a value. Read more
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls .tap()
only in debug builds, and is erased in release builds.
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls .tap_mut()
only in debug builds, and is erased in release
builds. Read more
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
Calls .tap_borrow()
only in debug builds, and is erased in release
builds. Read more
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
Calls .tap_borrow_mut()
only in debug builds, and is erased in release
builds. Read more
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self where
Self: AsRef<R>,
R: ?Sized,
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self where
Self: AsRef<R>,
R: ?Sized,
Calls .tap_ref()
only in debug builds, and is erased in release
builds. Read more
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
Calls .tap_ref_mut()
only in debug builds, and is erased in release
builds. Read more
impl<T> Tap for T
impl<T> Tap for T
fn tap<F, R>(self, func: F) -> Self where
F: FnOnce(&Self) -> R,
fn tap<F, R>(self, func: F) -> Self where
F: FnOnce(&Self) -> R,
Provides immutable access for inspection. Read more
fn tap_dbg<F, R>(self, func: F) -> Self where
F: FnOnce(&Self) -> R,
fn tap_dbg<F, R>(self, func: F) -> Self where
F: FnOnce(&Self) -> R,
Calls tap
in debug builds, and does nothing in release builds.
fn tap_mut<F, R>(self, func: F) -> Self where
F: FnOnce(&mut Self) -> R,
fn tap_mut<F, R>(self, func: F) -> Self where
F: FnOnce(&mut Self) -> R,
Provides mutable access for modification. Read more
fn tap_mut_dbg<F, R>(self, func: F) -> Self where
F: FnOnce(&mut Self) -> R,
fn tap_mut_dbg<F, R>(self, func: F) -> Self where
F: FnOnce(&mut Self) -> R,
Calls tap_mut
in debug builds, and does nothing in release builds.
impl<T, U> TapAsRef<U> for T where
U: ?Sized,
impl<T, U> TapAsRef<U> for T where
U: ?Sized,
fn tap_ref<F, R>(self, func: F) -> Self where
Self: AsRef<T>,
F: FnOnce(&T) -> R,
fn tap_ref<F, R>(self, func: F) -> Self where
Self: AsRef<T>,
F: FnOnce(&T) -> R,
Provides immutable access to the reference for inspection.
fn tap_ref_dbg<F, R>(self, func: F) -> Self where
Self: AsRef<T>,
F: FnOnce(&T) -> R,
fn tap_ref_dbg<F, R>(self, func: F) -> Self where
Self: AsRef<T>,
F: FnOnce(&T) -> R,
Calls tap_ref
in debug builds, and does nothing in release builds.
fn tap_ref_mut<F, R>(self, func: F) -> Self where
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_ref_mut<F, R>(self, func: F) -> Self where
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
Provides mutable access to the reference for modification.
fn tap_ref_mut_dbg<F, R>(self, func: F) -> Self where
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_ref_mut_dbg<F, R>(self, func: F) -> Self where
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
Calls tap_ref_mut
in debug builds, and does nothing in release builds.
impl<T, U> TapBorrow<U> for T where
U: ?Sized,
impl<T, U> TapBorrow<U> for T where
U: ?Sized,
fn tap_borrow<F, R>(self, func: F) -> Self where
Self: Borrow<T>,
F: FnOnce(&T) -> R,
fn tap_borrow<F, R>(self, func: F) -> Self where
Self: Borrow<T>,
F: FnOnce(&T) -> R,
Provides immutable access to the borrow for inspection. Read more
fn tap_borrow_dbg<F, R>(self, func: F) -> Self where
Self: Borrow<T>,
F: FnOnce(&T) -> R,
fn tap_borrow_dbg<F, R>(self, func: F) -> Self where
Self: Borrow<T>,
F: FnOnce(&T) -> R,
Calls tap_borrow
in debug builds, and does nothing in release builds.
fn tap_borrow_mut<F, R>(self, func: F) -> Self where
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_borrow_mut<F, R>(self, func: F) -> Self where
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
Provides mutable access to the borrow for modification.
fn tap_borrow_mut_dbg<F, R>(self, func: F) -> Self where
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_borrow_mut_dbg<F, R>(self, func: F) -> Self where
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
Calls tap_borrow_mut
in debug builds, and does nothing in release
builds. Read more
impl<T> TapDeref for T
impl<T> TapDeref for T
fn tap_deref<F, R>(self, func: F) -> Self where
Self: Deref,
F: FnOnce(&Self::Target) -> R,
fn tap_deref<F, R>(self, func: F) -> Self where
Self: Deref,
F: FnOnce(&Self::Target) -> R,
Immutably dereferences self
for inspection.
fn tap_deref_dbg<F, R>(self, func: F) -> Self where
Self: Deref,
F: FnOnce(&Self::Target) -> R,
fn tap_deref_dbg<F, R>(self, func: F) -> Self where
Self: Deref,
F: FnOnce(&Self::Target) -> R,
Calls tap_deref
in debug builds, and does nothing in release builds.
fn tap_deref_mut<F, R>(self, func: F) -> Self where
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
fn tap_deref_mut<F, R>(self, func: F) -> Self where
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
Mutably dereferences self
for modification.
fn tap_deref_mut_dbg<F, R>(self, func: F) -> Self where
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
fn tap_deref_mut_dbg<F, R>(self, func: F) -> Self where
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
Calls tap_deref_mut
in debug builds, and does nothing in release
builds. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,