pub struct DelegationOrigin<'a> {
pub context_id: String,
pub launched: Option<Arc<dyn Fn(DelegationLaunch) + Send + Sync + 'a>>,
pub stop: Option<Arc<dyn Fn() -> bool + Send + Sync + 'a>>,
}Expand description
The parent’s side of one delegation, beyond the three strings its agent supplied.
Per call rather than per plane: a launch that mints one context id per task has no launch-scoped conversation to name, so the id is only knowable once a task is running.
Fields§
§context_id: StringThe conversation the delegation was made from. Empty when the caller has none, which injects no handle at all rather than one naming a conversation that does not exist.
launched: Option<Arc<dyn Fn(DelegationLaunch) + Send + Sync + 'a>>What to do with the launch notice, or None for a caller that records no
delegation_start. Called on the delegating thread, before the delegation has ended.
A callback rather than a channel because the two callers are not the same shape:
DelegationPlane::start runs on a blocking tokio worker with a task free to drain a
receiver, while plan::execute calls DelegationPlane::delegate directly on a
scheduler thread with no runtime to await on and nothing else running to drain anything.
Invoked in place, both surfaces get the record on disk while the child is still in flight,
which is the whole reason it is a record of its own.
stop: Option<Arc<dyn Fn() -> bool + Send + Sync + 'a>>Whether the task this delegation was made for has been cancelled, or None for a caller
that cannot be. Polled, so it must be cheap and must never block.
Read only by DelegationPlane::delegate, which ends the child itself when it reports
true. DelegationPlane::start ignores it: its caller races its own cancel against the
launch, and holds the child’s handle from then on.
Trait Implementations§
Source§impl<'a> Clone for DelegationOrigin<'a>
impl<'a> Clone for DelegationOrigin<'a>
Source§impl Debug for DelegationOrigin<'_>
Hand-written because DelegationOrigin::launched and DelegationOrigin::stop are trait
objects and cannot derive one.
A callback has no readable identity, so what is printed of it is whether there is one.
impl Debug for DelegationOrigin<'_>
Hand-written because DelegationOrigin::launched and DelegationOrigin::stop are trait
objects and cannot derive one.
A callback has no readable identity, so what is printed of it is whether there is one.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for DelegationOrigin<'a>
impl<'a> !UnwindSafe for DelegationOrigin<'a>
impl<'a> Forget for DelegationOrigin<'a>
impl<'a> Freeze for DelegationOrigin<'a>
impl<'a> Move for DelegationOrigin<'a>
impl<'a> Send for DelegationOrigin<'a>
impl<'a> Sync for DelegationOrigin<'a>
impl<'a> Unpin for DelegationOrigin<'a>
impl<'a> UnsafeUnpin for DelegationOrigin<'a>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 moreSource§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
Source§type NoneType = T
type NoneType = T
NoneValue::null_value produces.