#[non_exhaustive]pub struct PreSpawn {
pub command: Command,
pub events: Arc<[Event]>,
/* private fields */
}
Expand description
The environment given to the pre-spawn handler.
This deliberately does not implement Clone to make it hard to move it out of the handler, which you should not do.
The PreSpawn::command()
method is the only way to mutate the command, and the mutex guard it
returns must be dropped before the handler returns.
Fields (Non-exhaustive)
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.command: Command
The command which is about to be spawned.
events: Arc<[Event]>
The collected events which triggered the action this command issues from.
Implementations
sourceimpl PreSpawn
impl PreSpawn
sourcepub async fn command(&self) -> Option<OwnedMutexGuard<TokioCommand>>
pub async fn command(&self) -> Option<OwnedMutexGuard<TokioCommand>>
Get write access to the command that will be spawned.
Keeping the lock alive beyond the end of the handler may cause the command to be cancelled,
but note no guarantees are made on this behaviour. Just don’t do it. See the Action
documentation about handlers for more.
This will always return Some()
under normal circumstances.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for PreSpawn
impl Send for PreSpawn
impl Sync for PreSpawn
impl Unpin for PreSpawn
impl !UnwindSafe for PreSpawn
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more