pub struct Scheduler { /* private fields */ }Expand description
A timeline of resources: a row for each person, room or account, a time axis across the top, and events as bars that can be dragged along the time and between rows, resized by their ends, and drawn on an empty stretch. Weekends are shaded, and only what is in view gets built, so large plans stay smooth.
The app holds the data: on_change reports where an event would go, and the
app stores it and passes the events again. can_drop can refuse a place.
From the keyboard, Tab reaches the events. Left and Right move one by a step, Up and Down to the next row, Shift with Left and Right resize it, Enter opens it and Delete removes it.
use ravenrs_reactive::State;
use ravenrs_widgets::{Date, Resource, Scheduler, SchedulerEvent, TimeAxis, TimePoint, Ui};
let first = Date::new(2026, 11, 1).unwrap();
let axis = State::new(TimeAxis::days(first, 30));
let start = TimePoint::from_date(first.add_days(4));
let scheduler = Scheduler::new(axis.binding())
.resources([Resource::new(1, "Ana"), Resource::new(2, "Bruno")])
.events([SchedulerEvent::new(7, 1, start, start.plus_days(3), "Férias")])
.on_change(|change| println!("{change:?}"));
let mut ui = Ui::new(scheduler, ravenrs_style::Theme::raven_light());
ui.update();Implementations§
Source§impl Scheduler
impl Scheduler
Sourcepub fn new(axis: Binding<TimeAxis>) -> Scheduler
pub fn new(axis: Binding<TimeAxis>) -> Scheduler
A scheduler over this stretch of time. Zooming and moving through time change axis.
Sourcepub fn resources(
self,
resources: impl IntoIterator<Item = Resource>,
) -> Scheduler
pub fn resources( self, resources: impl IntoIterator<Item = Resource>, ) -> Scheduler
The rows.
Sourcepub fn events(
self,
events: impl IntoIterator<Item = SchedulerEvent>,
) -> Scheduler
pub fn events( self, events: impl IntoIterator<Item = SchedulerEvent>, ) -> Scheduler
The bars. Those on no row are ignored.
Sourcepub fn ranges(
self,
ranges: impl IntoIterator<Item = SchedulerRange>,
) -> Scheduler
pub fn ranges( self, ranges: impl IntoIterator<Item = SchedulerRange>, ) -> Scheduler
Shaded stretches of time across all rows.
Sourcepub fn now(self, now: TimePoint) -> Scheduler
pub fn now(self, now: TimePoint) -> Scheduler
Draws a line at this moment, and offers a button to come back to it.
Sourcepub fn resource_width(self, width: f32) -> Scheduler
pub fn resource_width(self, width: f32) -> Scheduler
The width of the resources column (200 by default).
Sourcepub fn fill_rows(self, fill: bool) -> Scheduler
pub fn fill_rows(self, fill: bool) -> Scheduler
Rows share the height left over, so a few of them do not leave the timeline half empty. Off by default; a row never gets shorter than its bars.
Sourcepub fn card(self, card: bool) -> Scheduler
pub fn card(self, card: bool) -> Scheduler
The look of a full scheduler, as a card among other cards: rounded and with a soft shadow, a tinted header with the month over the days of the week, a line between the rows’ names and the timeline, and today’s column marked. Bars are a soft tint with a stripe of their color. Opens with today in the first column.
Sourcepub fn avatars(self, avatars: bool) -> Scheduler
pub fn avatars(self, avatars: bool) -> Scheduler
Shows the initials of each row’s name beside it, for rows that are people.
Sourcepub fn event_detail(
self,
detail: impl Fn(u64) -> Option<String> + 'static,
) -> Scheduler
pub fn event_detail( self, detail: impl Fn(u64) -> Option<String> + 'static, ) -> Scheduler
A second line on the bars, such as an amount, by the event’s id. Rows get taller.
What a right click on a bar offers, by the event’s id.
What a right click on an empty stretch offers, given the row and the time there.
Sourcepub fn toolbar(self, show: bool) -> Scheduler
pub fn toolbar(self, show: bool) -> Scheduler
The buttons to move through time and zoom (on by default).
Sourcepub fn on_change(self, handler: impl Fn(SchedulerChange) + 'static) -> Scheduler
pub fn on_change(self, handler: impl Fn(SchedulerChange) + 'static) -> Scheduler
An event was moved or resized.
Sourcepub fn on_create(self, handler: impl Fn(SchedulerChange) + 'static) -> Scheduler
pub fn on_create(self, handler: impl Fn(SchedulerChange) + 'static) -> Scheduler
A stretch of time was drawn on a row, by dragging or double-clicking.
Sourcepub fn on_open(self, handler: impl Fn(u64) + 'static) -> Scheduler
pub fn on_open(self, handler: impl Fn(u64) + 'static) -> Scheduler
An event was double-clicked, or Enter was pressed on it.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Scheduler
impl !Send for Scheduler
impl !Sync for Scheduler
impl !UnwindSafe for Scheduler
impl Freeze for Scheduler
impl Unpin for Scheduler
impl UnsafeUnpin for Scheduler
Blanket Implementations§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
fn to_sample_(self) -> U
Source§impl<V> ViewExt for Vwhere
V: View,
impl<V> ViewExt for Vwhere
V: View,
Source§fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
Source§fn background(self, fill: impl Into<Fill>) -> Styled<Self>
fn background(self, fill: impl Into<Fill>) -> Styled<Self>
Source§fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
None keeps the content size.