[−][src]Struct lunatic::process::Process
A Process
consists of its own stack and heap. It can only share data with other processes
through message passing.
Dropping a Process
cancels it. To drop the Task handle without canceling it, use detach()
instead.
Implementations
impl Process
[src]
pub fn spawn_with<T>(context: T, function: fn(_: T)) -> Process where
T: Serialize + DeserializeOwned,
[src]
T: Serialize + DeserializeOwned,
Spawns a new process from a function and context.
-
function
is the starting point of the new process. The new process doesn't share memory with its parent, because of this the function can't capture anything from parents. -
context
is data that we want to pass to the newly spawned process. It needs to be serializable.
Safety: Rust doesn't have a concept of "separate" memories and you will still be able to reference global static variables, but IT'S NOT SAFE to do so.
pub fn detach(self)
[src]
Detaches the Process
to let it keep running in the background.
pub fn join(self) -> Result<(), ()>
[src]
Waits on a Process
to finish.
Returns an error if the process failed.
pub fn sleep(milliseconds: u64)
[src]
Suspends the current process for milliseconds
.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Process
[src]
impl Send for Process
[src]
impl Sync for Process
[src]
impl Unpin for Process
[src]
impl UnwindSafe for Process
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,