Struct polars_time::prelude::Window
source · pub struct Window {
pub offset: Duration,
/* private fields */
}
Expand description
Represents a window in time
Fields§
§offset: Duration
Implementations§
source§impl Window
impl Window
pub fn new(every: Duration, period: Duration, offset: Duration) -> Self
sourcepub fn truncate_ns(&self, t: i64, tz: Option<&Tz>) -> PolarsResult<i64>
pub fn truncate_ns(&self, t: i64, tz: Option<&Tz>) -> PolarsResult<i64>
Truncate the given ns timestamp by the window boundary.
sourcepub fn truncate_us(&self, t: i64, tz: Option<&Tz>) -> PolarsResult<i64>
pub fn truncate_us(&self, t: i64, tz: Option<&Tz>) -> PolarsResult<i64>
Truncate the given us timestamp by the window boundary.
sourcepub fn truncate_ms(&self, t: i64, tz: Option<&Tz>) -> PolarsResult<i64>
pub fn truncate_ms(&self, t: i64, tz: Option<&Tz>) -> PolarsResult<i64>
Truncate the given ms timestamp by the window boundary.
sourcepub fn round_ns(&self, t: i64, tz: Option<&Tz>) -> PolarsResult<i64>
pub fn round_ns(&self, t: i64, tz: Option<&Tz>) -> PolarsResult<i64>
Round the given ns timestamp by the window boundary.
sourcepub fn round_us(&self, t: i64, tz: Option<&Tz>) -> PolarsResult<i64>
pub fn round_us(&self, t: i64, tz: Option<&Tz>) -> PolarsResult<i64>
Round the given us timestamp by the window boundary.
sourcepub fn round_ms(&self, t: i64, tz: Option<&Tz>) -> PolarsResult<i64>
pub fn round_ms(&self, t: i64, tz: Option<&Tz>) -> PolarsResult<i64>
Round the given ms timestamp by the window boundary.
sourcepub fn get_earliest_bounds_ns(
&self,
t: i64,
closed_window: ClosedWindow,
tz: Option<&Tz>
) -> PolarsResult<Bounds>
pub fn get_earliest_bounds_ns( &self, t: i64, closed_window: ClosedWindow, tz: Option<&Tz> ) -> PolarsResult<Bounds>
returns the bounds for the earliest window bounds that contains the given time t. For underlapping windows that do not contain time t, the window directly after time t will be returned.
pub fn get_earliest_bounds_us( &self, t: i64, closed_window: ClosedWindow, tz: Option<&Tz> ) -> PolarsResult<Bounds>
pub fn get_earliest_bounds_ms( &self, t: i64, closed_window: ClosedWindow, tz: Option<&Tz> ) -> PolarsResult<Bounds>
pub fn get_overlapping_bounds_iter<'a>( &'a self, boundary: Bounds, closed_window: ClosedWindow, tu: TimeUnit, tz: Option<&'a Tz>, start_by: StartBy ) -> PolarsResult<BoundsIter<'_>>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Window
impl RefUnwindSafe for Window
impl Send for Window
impl Sync for Window
impl Unpin for Window
impl UnwindSafe for Window
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more