pub struct ServerJobQueue {
jobs: SyncMutex<Vec<Box<dyn ServerJob>>>,
}Expand description
Tick-owned job queue.
Fields§
§jobs: SyncMutex<Vec<Box<dyn ServerJob>>>Implementations§
Source§impl ServerJobQueue
impl ServerJobQueue
Sourcepub fn spawn(&self, job: impl ServerJob + 'static)
pub fn spawn(&self, job: impl ServerJob + 'static)
Adds a job to be polled on the next server job tick.
Sourcepub fn poll_now_or_spawn(
&self,
server: Weak<Server>,
tick_count: u64,
runs_normally: bool,
job: impl ServerJob + 'static,
) -> JobPoll
pub fn poll_now_or_spawn( &self, server: Weak<Server>, tick_count: u64, runs_normally: bool, job: impl ServerJob + 'static, ) -> JobPoll
Polls a job immediately from a known safe point, queuing it only if it remains pending.
Sourcepub fn cancel_all(&self)
pub fn cancel_all(&self)
Cancels and removes all queued jobs.
Sourcepub fn tick(
&self,
server: Weak<Server>,
tick_count: u64,
runs_normally: bool,
) -> ServerJobTickStats
pub fn tick( &self, server: Weak<Server>, tick_count: u64, runs_normally: bool, ) -> ServerJobTickStats
Polls queued jobs from the server game tick.
fn tick_with_context( &self, context: &mut ServerJobContext, ) -> ServerJobTickStats
fn poll_now_or_spawn_with_context( &self, context: &mut ServerJobContext, job: impl ServerJob + 'static, ) -> JobPoll
Trait Implementations§
Source§impl Default for ServerJobQueue
impl Default for ServerJobQueue
Source§fn default() -> ServerJobQueue
fn default() -> ServerJobQueue
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for ServerJobQueue
impl !RefUnwindSafe for ServerJobQueue
impl !UnwindSafe for ServerJobQueue
impl Send for ServerJobQueue
impl Sync for ServerJobQueue
impl Unpin for ServerJobQueue
impl UnsafeUnpin for ServerJobQueue
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreWraps this value in an
Arc<SyncMutex<>>