Skip to main content

TimeAxis

Struct TimeAxis 

Source
pub struct TimeAxis {
    pub start: TimePoint,
    pub end: TimePoint,
    pub scale: TimeScale,
    pub tick_width: f32,
}
Expand description

The stretch of time a Scheduler shows, how wide it is and how it is marked.

Fields§

§start: TimePoint

Where it begins.

§end: TimePoint

Where it ends.

§scale: TimeScale

What a tick is.

§tick_width: f32

The width of a tick, in logical pixels. A month is 30 days wide, so all time runs at one speed.

Implementations§

Source§

impl TimeAxis

Source

pub fn days(from: Date, count: u32) -> Self

count days from from, a tick per day.

Source

pub fn weeks(from: Date, count: u32) -> Self

count weeks from the week of from, a tick per week.

Source

pub fn months(from: Date, count: u32) -> Self

count months from the month of from, a tick per month.

Source

pub fn hours(day: Date) -> Self

One day, a tick per hour.

Source

pub fn zoomed_in(&self) -> Option<Self>

The same stretch of time, one step nearer. None when it cannot go nearer.

Source

pub fn zoomed_out(&self) -> Option<Self>

The same stretch of time, one step farther. None when it cannot go farther.

Source

pub fn shifted(&self, steps: i64) -> Self

The same length of time, moved by a whole steps of its length.

Source

pub fn width(&self) -> f32

The whole width, in logical pixels.

Source

pub fn x_of(&self, time: TimePoint) -> f32

Where a moment falls, in logical pixels from the start.

Source

pub fn time_at(&self, x: f32) -> TimePoint

The moment at this position.

Source

pub fn snap_minutes(&self) -> i64

The smallest step an event moves by: a quarter of an hour on the hour scale, a day on the others.

Source

pub fn snap(&self, time: TimePoint) -> TimePoint

The nearest moment an event can start or end at.

Trait Implementations§

Source§

impl Clone for TimeAxis

Source§

fn clone(&self) -> TimeAxis

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for TimeAxis

Source§

impl Debug for TimeAxis

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for TimeAxis

Source§

fn eq(&self, other: &TimeAxis) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TimeAxis

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

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

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> ToOwned for T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more