pub enum OutGate {
InprocOut(Arc<InprocOutGate>),
OutprocOut(Arc<OutprocOutGate>),
}Expand description
OutGate - 出站消息门枚举
§设计原则
- 使用 enum dispatch 而非 trait object,避免虚函数调用
- 零成本抽象:编译时准确确定类型
- 完全独立:仅用于出站(Outbound),不包含任何入站路由逻辑
§性能
OutGate::send_request() 内部:
match self {
OutGate::InprocOut(gate) => gate.send_request(...), // ← 静态分发
OutGate::OutprocOut(gate) => gate.send_request(...), // ← 静态分发
}
性能:
- 无虚函数表查找
- 编译器完全内联
- CPU 分支预测命中率 >95%Variants§
InprocOut(Arc<InprocOutGate>)
InprocOut - 进程内传输(零序列化,出站)
OutprocOut(Arc<OutprocOutGate>)
OutprocOut - 跨进程传输(Protobuf 序列化,出站)
Implementations§
Source§impl OutGate
impl OutGate
Sourcepub async fn send_request(
&self,
target: &ActrId,
envelope: RpcEnvelope,
) -> ActorResult<Bytes>
pub async fn send_request( &self, target: &ActrId, envelope: RpcEnvelope, ) -> ActorResult<Bytes>
Sourcepub async fn send_request_with_type(
&self,
target_id: &ActrId,
payload_type: PayloadType,
envelope: RpcEnvelope,
) -> ActorResult<Bytes>
pub async fn send_request_with_type( &self, target_id: &ActrId, payload_type: PayloadType, envelope: RpcEnvelope, ) -> ActorResult<Bytes>
发送请求并等待响应(显式指定 PayloadType)
Sourcepub async fn send_message(
&self,
target: &ActrId,
envelope: RpcEnvelope,
) -> ActorResult<()>
pub async fn send_message( &self, target: &ActrId, envelope: RpcEnvelope, ) -> ActorResult<()>
Sourcepub async fn send_message_with_type(
&self,
target: &ActrId,
payload_type: PayloadType,
envelope: RpcEnvelope,
) -> ActorResult<()>
pub async fn send_message_with_type( &self, target: &ActrId, payload_type: PayloadType, envelope: RpcEnvelope, ) -> ActorResult<()>
发送单向消息(显式指定 PayloadType)
Sourcepub async fn send_media_sample(
&self,
target: &ActrId,
track_id: &str,
sample: MediaSample,
) -> ActorResult<()>
pub async fn send_media_sample( &self, target: &ActrId, track_id: &str, sample: MediaSample, ) -> ActorResult<()>
Sourcepub async fn send_data_stream(
&self,
target: &ActrId,
payload_type: PayloadType,
data: Bytes,
) -> ActorResult<()>
pub async fn send_data_stream( &self, target: &ActrId, payload_type: PayloadType, data: Bytes, ) -> ActorResult<()>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for OutGate
impl !RefUnwindSafe for OutGate
impl Send for OutGate
impl Sync for OutGate
impl Unpin for OutGate
impl !UnwindSafe for OutGate
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