pub struct ObserverChannel { /* private fields */ }Expand description
Bounded-mpsc observer trampoline. Constructed by each language
binding’s set_observer implementation; installed on the mesh
via super::super::MeshNode::set_rpc_observer.
The substrate dispatch path’s RpcObserver::on_call pays only
Arc::clone + try_send + atomic counter on overflow — every
allocation / GIL-acquisition / TSFN call defers to the worker
drained off the dispatch thread.
Implementations§
Source§impl ObserverChannel
impl ObserverChannel
Sourcepub fn install<F>(runtime: &Handle, dispatch: F) -> Self
pub fn install<F>(runtime: &Handle, dispatch: F) -> Self
Build a bounded channel + spawn a drain worker on the given
runtime handle. dispatch runs once per drained event on
the worker task — bindings put their language-specific
invocation here (TSFN, GIL acquisition + Python call, C
function-pointer call).
The worker exits cleanly when the channel closes (every
ObserverChannel is dropped + no more senders exist).
Trait Implementations§
Source§impl RpcObserver for ObserverChannel
impl RpcObserver for ObserverChannel
Source§fn on_call(&self, evt: RpcCallEvent)
fn on_call(&self, evt: RpcCallEvent)
Fired once per observed RPC boundary. Must be cheap —
the dispatch thread blocks until the call returns.
Auto Trait Implementations§
impl Freeze for ObserverChannel
impl RefUnwindSafe for ObserverChannel
impl Send for ObserverChannel
impl Sync for ObserverChannel
impl Unpin for ObserverChannel
impl UnsafeUnpin for ObserverChannel
impl UnwindSafe for ObserverChannel
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