Struct polars_time::Window

source ·
pub struct Window {
    pub offset: Duration,
    /* private fields */
}
Expand description

Represents a window in time

Fields§

§offset: Duration

Implementations§

source§

impl Window

source

pub fn new(every: Duration, period: Duration, offset: Duration) -> Self

source

pub fn truncate_ns( &self, t: i64, tz: Option<&impl PolarsTimeZone> ) -> PolarsResult<i64>

Truncate the given ns timestamp by the window boundary.

source

pub fn truncate_no_offset_ns( &self, t: i64, tz: Option<&impl PolarsTimeZone> ) -> PolarsResult<i64>

source

pub fn truncate_us( &self, t: i64, tz: Option<&impl PolarsTimeZone> ) -> PolarsResult<i64>

Truncate the given us timestamp by the window boundary.

source

pub fn truncate_no_offset_us( &self, t: i64, tz: Option<&impl PolarsTimeZone> ) -> PolarsResult<i64>

source

pub fn truncate_ms( &self, t: i64, tz: Option<&impl PolarsTimeZone> ) -> PolarsResult<i64>

source

pub fn truncate_no_offset_ms( &self, t: i64, tz: Option<&impl PolarsTimeZone> ) -> PolarsResult<i64>

source

pub fn round_ns( &self, t: i64, tz: Option<&impl PolarsTimeZone> ) -> PolarsResult<i64>

Round the given ns timestamp by the window boundary.

source

pub fn round_us( &self, t: i64, tz: Option<&impl PolarsTimeZone> ) -> PolarsResult<i64>

Round the given us timestamp by the window boundary.

source

pub fn round_ms( &self, t: i64, tz: Option<&impl PolarsTimeZone> ) -> PolarsResult<i64>

Round the given ms timestamp by the window boundary.

source

pub fn get_earliest_bounds_ns( &self, t: i64, tz: Option<&impl PolarsTimeZone> ) -> 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.

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

source

pub fn get_earliest_bounds_us( &self, t: i64, tz: Option<&impl PolarsTimeZone> ) -> PolarsResult<Bounds>

source

pub fn get_earliest_bounds_ms( &self, t: i64, tz: Option<&impl PolarsTimeZone> ) -> PolarsResult<Bounds>

source

pub fn get_overlapping_bounds_iter<'a, T: PolarsTimeZone>( &self, boundary: Bounds, tu: TimeUnit, tz: Option<&'a T>, start_by: StartBy ) -> PolarsResult<BoundsIter<'a, T>>

Trait Implementations§

source§

impl Clone for Window

source§

fn clone(&self) -> Window

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Copy for Window

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for Twhere T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Pointable for T

source§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

source§

fn vzip(self) -> V