pub enum ThreadMode {
Main,
Coop,
Spawn,
Pool,
Coroutine(Box<ThreadMode>),
}Expand description
Threading strategy a server uses to service connections.
Variants§
Main
Run on the calling main thread.
Coop
Run cooperatively, yielding to the host scheduler.
Spawn
Spawn a dedicated thread per connection.
Pool
Service connections from a shared worker pool.
Coroutine(Box<ThreadMode>)
Run the wrapped mode as a coroutine.
Implementations§
Source§impl ThreadMode
impl ThreadMode
Sourcepub fn from_expr(expr: &Expr) -> Result<Self>
pub fn from_expr(expr: &Expr) -> Result<Self>
Parses a thread mode from an expression: a bare symbol (main, coop, spawn,
pool) or a (coroutine <base>) list.
Sourcepub fn is_available_now(&self) -> bool
pub fn is_available_now(&self) -> bool
Returns whether this thread mode can be used in the current environment.
Sourcepub fn is_coroutine(&self) -> bool
pub fn is_coroutine(&self) -> bool
Returns whether this mode is a coroutine variant.
Trait Implementations§
Source§impl Clone for ThreadMode
impl Clone for ThreadMode
Source§fn clone(&self) -> ThreadMode
fn clone(&self) -> ThreadMode
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ThreadMode
impl Debug for ThreadMode
impl Eq for ThreadMode
Source§impl PartialEq for ThreadMode
impl PartialEq for ThreadMode
Source§fn eq(&self, other: &ThreadMode) -> bool
fn eq(&self, other: &ThreadMode) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ThreadMode
Auto Trait Implementations§
impl Freeze for ThreadMode
impl RefUnwindSafe for ThreadMode
impl Send for ThreadMode
impl Sync for ThreadMode
impl Unpin for ThreadMode
impl UnsafeUnpin for ThreadMode
impl UnwindSafe for ThreadMode
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