pub struct Window {
pub offset: Duration,
/* private fields */
}Available on crate feature
temporal only.Expand description
Represents a window in time
Fields§
§offset: DurationImplementations§
Source§impl Window
impl Window
pub fn new(every: Duration, period: Duration, offset: Duration) -> Window
Sourcepub fn truncate(
&self,
tu: TimeUnit,
t: i64,
tz: Option<&Tz>,
) -> Result<i64, PolarsError>
pub fn truncate( &self, tu: TimeUnit, t: i64, tz: Option<&Tz>, ) -> Result<i64, PolarsError>
Truncate the given timestamp in tu by the window boundary.
Sourcepub fn round(
&self,
tu: TimeUnit,
t: i64,
tz: Option<&Tz>,
) -> Result<i64, PolarsError>
pub fn round( &self, tu: TimeUnit, t: i64, tz: Option<&Tz>, ) -> Result<i64, PolarsError>
Round the given timestamp in tu by the window boundary.
Sourcepub fn get_earliest_bounds(
&self,
tu: TimeUnit,
t: i64,
closed_window: ClosedWindow,
tz: Option<&Tz>,
) -> Result<Bounds, PolarsError>
pub fn get_earliest_bounds( &self, tu: TimeUnit, t: i64, closed_window: ClosedWindow, tz: Option<&Tz>, ) -> Result<Bounds, PolarsError>
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_overlapping_bounds_iter<'a>( &'a self, boundary: Bounds, closed_window: ClosedWindow, tu: TimeUnit, tz: Option<&'a Tz>, start_by: StartBy, origin: Option<i64>, ) -> Result<BoundsIter<'a>, PolarsError>
Sourcepub fn first_window_start(
&self,
t0: i64,
closed_window: ClosedWindow,
tu: TimeUnit,
tz: Option<&Tz>,
start_by: StartBy,
) -> Result<i64, PolarsError>
pub fn first_window_start( &self, t0: i64, closed_window: ClosedWindow, tu: TimeUnit, tz: Option<&Tz>, start_by: StartBy, ) -> Result<i64, PolarsError>
The start of the first window for data whose first value is t0, as placed by
start_by, every and offset.
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 UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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