pub struct RuntimeContext { /* private fields */ }Expand description
RuntimeContext - Runtime’s implementation of Context trait
§Design Features
- Zero vtable: internally uses Gate enum dispatch (not dyn)
- Smart routing: automatically selects Host or Peer based on Dest
- Full implementation: contains complete call/tell logic (encode, send, decode)
- Type safety: generic methods provide compile-time type checking
§Performance
- Gate is an enum, uses static dispatch
- Compiler can fully inline the entire call chain
- Zero virtual function call overhead
Implementations§
Source§impl RuntimeContext
impl RuntimeContext
Sourcepub async fn call_raw(
&self,
target: &Dest,
route_key: String,
payload_type: PayloadType,
payload: Bytes,
timeout_ms: i64,
) -> ActorResult<Bytes>
pub async fn call_raw( &self, target: &Dest, route_key: String, payload_type: PayloadType, payload: Bytes, timeout_ms: i64, ) -> ActorResult<Bytes>
Execute a non-generic RPC request call (useful for language bindings).
Sourcepub async fn tell_raw(
&self,
target: &Dest,
route_key: String,
payload_type: PayloadType,
payload: Bytes,
) -> ActorResult<()>
pub async fn tell_raw( &self, target: &Dest, route_key: String, payload_type: PayloadType, payload: Bytes, ) -> ActorResult<()>
Execute a non-generic RPC message call (fire-and-forget, useful for language bindings).
Sourcepub async fn send_data_stream_with_type(
&self,
target: &Dest,
payload_type: PayloadType,
chunk: DataStream,
) -> ActorResult<()>
pub async fn send_data_stream_with_type( &self, target: &Dest, payload_type: PayloadType, chunk: DataStream, ) -> ActorResult<()>
Send DataStream with an explicit payload type (lane selection).
Convenience wrapper for language bindings that prefer positional payload_type
before chunk. Equivalent to calling Context::send_data_stream directly.
Trait Implementations§
Source§impl Clone for RuntimeContext
impl Clone for RuntimeContext
Source§fn clone(&self) -> RuntimeContext
fn clone(&self) -> RuntimeContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Context for RuntimeContext
impl Context for RuntimeContext
Source§fn request_id(&self) -> &str
fn request_id(&self) -> &str
Get the unique request ID Read more
Source§fn call<'life0, 'life1, 'async_trait, R>(
&'life0 self,
target: &'life1 Dest,
request: R,
) -> Pin<Box<dyn Future<Output = ActorResult<R::Response>> + Send + 'async_trait>>where
R: 'async_trait + RpcRequest,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn call<'life0, 'life1, 'async_trait, R>(
&'life0 self,
target: &'life1 Dest,
request: R,
) -> Pin<Box<dyn Future<Output = ActorResult<R::Response>> + Send + 'async_trait>>where
R: 'async_trait + RpcRequest,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send a type-safe RPC request and wait for response Read more
Source§fn tell<'life0, 'life1, 'async_trait, R>(
&'life0 self,
target: &'life1 Dest,
message: R,
) -> Pin<Box<dyn Future<Output = ActorResult<()>> + Send + 'async_trait>>where
R: 'async_trait + RpcRequest,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn tell<'life0, 'life1, 'async_trait, R>(
&'life0 self,
target: &'life1 Dest,
message: R,
) -> Pin<Box<dyn Future<Output = ActorResult<()>> + Send + 'async_trait>>where
R: 'async_trait + RpcRequest,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send a type-safe one-way message (no response expected) Read more
Source§fn register_stream<'life0, 'async_trait, F>(
&'life0 self,
stream_id: String,
callback: F,
) -> Pin<Box<dyn Future<Output = ActorResult<()>> + Send + 'async_trait>>where
F: Fn(DataStream, ActrId) -> BoxFuture<'static, ActorResult<()>> + Send + Sync + 'static + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
fn register_stream<'life0, 'async_trait, F>(
&'life0 self,
stream_id: String,
callback: F,
) -> Pin<Box<dyn Future<Output = ActorResult<()>> + Send + 'async_trait>>where
F: Fn(DataStream, ActrId) -> BoxFuture<'static, ActorResult<()>> + Send + Sync + 'static + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
Register a DataStream callback for a specific stream Read more
Source§fn unregister_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
stream_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = ActorResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn unregister_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
stream_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = ActorResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Unregister a DataStream callback Read more
Source§fn send_data_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
target: &'life1 Dest,
chunk: DataStream,
payload_type: PayloadType,
) -> Pin<Box<dyn Future<Output = ActorResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send_data_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
target: &'life1 Dest,
chunk: DataStream,
payload_type: PayloadType,
) -> Pin<Box<dyn Future<Output = ActorResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send a DataStream to a destination with explicit lane selection. Read more
Source§fn discover_route_candidate<'life0, 'life1, 'async_trait>(
&'life0 self,
target_type: &'life1 ActrType,
) -> Pin<Box<dyn Future<Output = ActorResult<ActrId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn discover_route_candidate<'life0, 'life1, 'async_trait>(
&'life0 self,
target_type: &'life1 ActrType,
) -> Pin<Box<dyn Future<Output = ActorResult<ActrId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Discover a remote Actor of the specified type via the signaling server. Read more
Source§fn call_raw<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
target: &'life1 ActrId,
route_key: &'life2 str,
payload: Bytes,
) -> Pin<Box<dyn Future<Output = ActorResult<Bytes>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn call_raw<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
target: &'life1 ActrId,
route_key: &'life2 str,
payload: Bytes,
) -> Pin<Box<dyn Future<Output = ActorResult<Bytes>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Send a raw RPC request (untyped bytes) and wait for response Read more
Source§fn register_media_track<'life0, 'async_trait, F>(
&'life0 self,
track_id: String,
callback: F,
) -> Pin<Box<dyn Future<Output = ActorResult<()>> + Send + 'async_trait>>where
F: Fn(MediaSample, ActrId) -> BoxFuture<'static, ActorResult<()>> + Send + Sync + 'static + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
fn register_media_track<'life0, 'async_trait, F>(
&'life0 self,
track_id: String,
callback: F,
) -> Pin<Box<dyn Future<Output = ActorResult<()>> + Send + 'async_trait>>where
F: Fn(MediaSample, ActrId) -> BoxFuture<'static, ActorResult<()>> + Send + Sync + 'static + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
Register a WebRTC native media track callback Read more
Source§fn unregister_media_track<'life0, 'life1, 'async_trait>(
&'life0 self,
track_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = ActorResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn unregister_media_track<'life0, 'life1, 'async_trait>(
&'life0 self,
track_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = ActorResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Unregister a media track callback Read more
Source§fn send_media_sample<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
target: &'life1 Dest,
track_id: &'life2 str,
sample: MediaSample,
) -> Pin<Box<dyn Future<Output = ActorResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn send_media_sample<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
target: &'life1 Dest,
track_id: &'life2 str,
sample: MediaSample,
) -> Pin<Box<dyn Future<Output = ActorResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Send media samples via WebRTC native track Read more
Source§fn add_media_track<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
target: &'life1 Dest,
track_id: &'life2 str,
codec: &'life3 str,
media_type: &'life4 str,
) -> Pin<Box<dyn Future<Output = ActorResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn add_media_track<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
target: &'life1 Dest,
track_id: &'life2 str,
codec: &'life3 str,
media_type: &'life4 str,
) -> Pin<Box<dyn Future<Output = ActorResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Add a media track to the WebRTC connection with the target Read more
Source§fn remove_media_track<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
target: &'life1 Dest,
track_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = ActorResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn remove_media_track<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
target: &'life1 Dest,
track_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = ActorResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Remove a media track from the WebRTC connection with the target. Read more
Auto Trait Implementations§
impl !Freeze for RuntimeContext
impl !RefUnwindSafe for RuntimeContext
impl !UnwindSafe for RuntimeContext
impl Send for RuntimeContext
impl Sync for RuntimeContext
impl Unpin for RuntimeContext
impl UnsafeUnpin for RuntimeContext
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
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> ⓘ
Converts
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> ⓘ
Converts
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