pub struct RuntimeContext { /* private fields */ }Expand description
Implementations§
Source§impl RuntimeContext
impl RuntimeContext
Sourcepub fn new(
self_id: ActrId,
caller_id: Option<ActrId>,
trace_id: String,
request_id: String,
inproc_gate: OutGate,
outproc_gate: Option<OutGate>,
data_stream_registry: Arc<DataStreamRegistry>,
media_frame_registry: Arc<MediaFrameRegistry>,
) -> Self
pub fn new( self_id: ActrId, caller_id: Option<ActrId>, trace_id: String, request_id: String, inproc_gate: OutGate, outproc_gate: Option<OutGate>, data_stream_registry: Arc<DataStreamRegistry>, media_frame_registry: Arc<MediaFrameRegistry>, ) -> Self
创建新的 RuntimeContext
§参数
self_id: 当前 Actor 的 IDcaller_id: 调用方 Actor ID(可选)trace_id: 分布式追踪 IDrequest_id: 当前请求唯一 IDinproc_gate: 进程内通信 gate(立即可用)outproc_gate: 跨进程通信 gate(可能为 None,等待 WebRTC 初始化)data_stream_registry: DataStream 回调注册表media_frame_registry: MediaTrack 回调注册表
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 · 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,
) -> 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,
) -> 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 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
Auto Trait Implementations§
impl Freeze for RuntimeContext
impl !RefUnwindSafe for RuntimeContext
impl Send for RuntimeContext
impl Sync for RuntimeContext
impl Unpin for RuntimeContext
impl !UnwindSafe 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