pub struct Builder { /* private fields */ }
Expand description
A thread builder object, similar to thread::Builder
but with real-time capabilities
Warning: works on Linux systems only
Implementations§
source§impl Builder
impl Builder
pub fn new() -> Self
sourcepub fn name<N: Display>(self, name: N) -> Self
pub fn name<N: Display>(self, name: N) -> Self
The task name SHOULD be 15 characters or less to set a proper thread name
sourcepub fn stack_size(self, size: usize) -> Self
pub fn stack_size(self, size: usize) -> Self
Overrides the default stack size
sourcepub fn blocking(self, blocking: bool) -> Self
pub fn blocking(self, blocking: bool) -> Self
A hint for task supervisors that the task blocks the thread (e.g. listens to a socket or has got a big interval in the main loop, does not return any useful result and should not be joined)
For scoped tasks: the task may be still forcibly joined at the end of the scope
sourcepub fn rt_params(self, rt_params: RTParams) -> Self
pub fn rt_params(self, rt_params: RTParams) -> Self
Applies real-time parameters to the task
See RTParams
sourcepub fn spawn<F, T>(self, f: F) -> Result<Task<T>>
pub fn spawn<F, T>(self, f: F) -> Result<Task<T>>
Spawns a task
§Errors
Returns errors if the task real-time parameters were set but have been failed to apply. The task thread is stopped and panicked
sourcepub fn spawn_periodic<F, T>(self, f: F, interval: Interval) -> Result<Task<T>>
pub fn spawn_periodic<F, T>(self, f: F, interval: Interval) -> Result<Task<T>>
Spawns a periodic task
§Errors
Returns errors if the task real-time parameters were set but have been failed to apply. The task thread is stopped and panicked
sourcepub fn spawn_scoped<'scope, 'env, F, T>(
self,
scope: &'scope Scope<'scope, 'env>,
f: F
) -> Result<ScopedTask<'scope, T>>
pub fn spawn_scoped<'scope, 'env, F, T>( self, scope: &'scope Scope<'scope, 'env>, f: F ) -> Result<ScopedTask<'scope, T>>
sourcepub fn spawn_scoped_periodic<'scope, 'env, F, T>(
self,
scope: &'scope Scope<'scope, 'env>,
f: F,
interval: Interval
) -> Result<ScopedTask<'scope, T>>
pub fn spawn_scoped_periodic<'scope, 'env, F, T>( self, scope: &'scope Scope<'scope, 'env>, f: F, interval: Interval ) -> Result<ScopedTask<'scope, T>>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Builder
impl RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl UnwindSafe for Builder
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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>
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>
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 more