pub struct TaskScheduler {
pub tasks: HashMap<TaskId, ScheduledTask>,
pub task_id_counter: TaskId,
pub queue: TaskExecutionQueue,
}
Fields§
§tasks: HashMap<TaskId, ScheduledTask>
§task_id_counter: TaskId
§queue: TaskExecutionQueue
Implementations§
Source§impl TaskScheduler
impl TaskScheduler
pub fn enqueue<TaskPayload: CandidType>( &mut self, payload: TaskPayload, scheduling_interval: SchedulingOptions, timestamp: u64, ) -> CandidResult<TaskId>
pub fn iterate(&mut self, timestamp: u64) -> Vec<ScheduledTask>
pub fn dequeue(&mut self, task_id: TaskId) -> Option<ScheduledTask>
pub fn is_empty(&self) -> bool
pub fn get_task(&self, task_id: &TaskId) -> Option<&ScheduledTask>
pub fn get_task_mut(&mut self, task_id: &TaskId) -> Option<&mut ScheduledTask>
pub fn get_task_by_id_cloned(&self, task_id: &TaskId) -> Option<ScheduledTask>
pub fn get_tasks_cloned(&self) -> Vec<ScheduledTask>
Trait Implementations§
Source§impl CandidType for TaskScheduler
impl CandidType for TaskScheduler
Source§impl Clone for TaskScheduler
impl Clone for TaskScheduler
Source§fn clone(&self) -> TaskScheduler
fn clone(&self) -> TaskScheduler
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Default for TaskScheduler
impl Default for TaskScheduler
Source§fn default() -> TaskScheduler
fn default() -> TaskScheduler
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for TaskScheduler
impl<'de> Deserialize<'de> for TaskScheduler
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for TaskScheduler
impl RefUnwindSafe for TaskScheduler
impl Send for TaskScheduler
impl Sync for TaskScheduler
impl Unpin for TaskScheduler
impl UnwindSafe for TaskScheduler
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