Struct polars_time::prelude::Window
source · [−]pub struct Window { /* private fields */ }
Expand description
Represents a window in time
Implementations
sourceimpl Window
impl Window
pub fn new(every: Duration, period: Duration, offset: Duration) -> Self
sourcepub fn truncate_ns(&self, t: i64) -> i64
pub fn truncate_ns(&self, t: i64) -> i64
Truncate the given ns timestamp by the window boundary.
sourcepub fn truncate_us(&self, t: i64) -> i64
pub fn truncate_us(&self, t: i64) -> i64
Truncate the given ns timestamp by the window boundary.
pub fn truncate_no_offset_ns(&self, t: i64) -> i64
pub fn truncate_no_offset_us(&self, t: i64) -> i64
pub fn truncate_ms(&self, t: i64) -> i64
pub fn truncate_no_offset_ms(&self, t: i64) -> i64
sourcepub fn get_earliest_bounds_ns(&self, t: i64) -> Bounds
pub fn get_earliest_bounds_ns(&self, t: i64) -> 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.
For every
larger than 1day
we just take the given timestamp t
as start as truncation
does not seems intuitive.
Below 1 day, it make sense to truncate to:
- days
- hours
- 15 minutes
- etc.
But for 2w3d, it does not make sense to start it on a different lower bound, so we start at t
pub fn get_earliest_bounds_us(&self, t: i64) -> Bounds
pub fn get_earliest_bounds_ms(&self, t: i64) -> Bounds
pub fn get_overlapping_bounds_iter(
&self,
boundary: Bounds,
tu: TimeUnit
) -> BoundsIterⓘNotable traits for BoundsIterimpl Iterator for BoundsIter type Item = Bounds;
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Window
impl Send for Window
impl Sync for Window
impl Unpin for Window
impl UnwindSafe for Window
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more