Struct polars_time::Duration
source · pub struct Duration {
pub parsed_int: bool,
/* private fields */
}
Fields§
§parsed_int: bool
Implementations§
source§impl Duration
impl Duration
sourcepub fn parse(duration: &str) -> Self
pub fn parse(duration: &str) -> Self
1ns // 1 nanosecond 1us // 1 microsecond 1ms // 1 millisecond 1s // 1 second 1m // 1 minute 1h // 1 hour 1d // 1 day 1w // 1 week 1mo // 1 calendar month 1y // 1 calendar year 1i // 1 index value (only for {Int32, Int64} dtypes
3d12h4m25s // 3 days, 12 hours, 4 minutes, and 25 seconds
Panics if given str is incorrect
pub fn months_only(&self) -> bool
pub fn months(&self) -> i64
pub fn weeks_only(&self) -> bool
pub fn weeks(&self) -> i64
pub fn days_only(&self) -> bool
pub fn days(&self) -> i64
sourcepub fn nanoseconds(&self) -> i64
pub fn nanoseconds(&self) -> i64
Returns the nanoseconds from the Duration
without the weeks or months part.
pub fn truncate_impl<F, G, J>( &self, t: i64, tz: Option<&impl PolarsTimeZone>, nsecs_to_unit: F, timestamp_to_datetime: G, datetime_to_timestamp: J ) -> PolarsResult<i64>where F: Fn(i64) -> i64, G: Fn(i64) -> NaiveDateTime, J: Fn(NaiveDateTime) -> i64,
pub fn truncate_ns( &self, t: i64, tz: Option<&impl PolarsTimeZone> ) -> PolarsResult<i64>
pub fn truncate_us( &self, t: i64, tz: Option<&impl PolarsTimeZone> ) -> PolarsResult<i64>
pub fn truncate_ms( &self, t: i64, tz: Option<&impl PolarsTimeZone> ) -> PolarsResult<i64>
pub fn add_ns( &self, t: i64, tz: Option<&impl PolarsTimeZone> ) -> PolarsResult<i64>
pub fn add_us( &self, t: i64, tz: Option<&impl PolarsTimeZone> ) -> PolarsResult<i64>
pub fn add_ms( &self, t: i64, tz: Option<&impl PolarsTimeZone> ) -> PolarsResult<i64>
Trait Implementations§
source§impl Ord for Duration
impl Ord for Duration
source§impl PartialEq<Duration> for Duration
impl PartialEq<Duration> for Duration
source§impl PartialOrd<Duration> for Duration
impl PartialOrd<Duration> for Duration
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for Duration
impl Eq for Duration
impl StructuralEq for Duration
impl StructuralPartialEq for Duration
Auto Trait Implementations§
impl RefUnwindSafe for Duration
impl Send for Duration
impl Sync for Duration
impl Unpin for Duration
impl UnwindSafe for Duration
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.