Skip to main content

BothEventCombiner

Struct BothEventCombiner 

Source
pub struct BothEventCombiner<S: CommunicationService, R: CommunicationService> { /* private fields */ }
Expand description

详见 SplitCombiner
SplitCombiner 的区别在于
BothEventCombiner 会将 send_side 的所有事件均并入原事件通道
因此,BothEventCombiner 不存在 processor task

Implementations§

Source§

impl<S: CommunicationService, R: CommunicationService> BothEventCombiner<S, R>

Source

pub fn new(send_side: S, read_side: R) -> Self

Trait Implementations§

Source§

impl<S: CommunicationService, R: CommunicationService> CommunicationService for BothEventCombiner<S, R>

Source§

fn install( &mut self, api_receiver: InternalAPIReceiver, event_sender: InternalEventSender, )

安装服务
该方法仅进行服务的依赖注入,并不真正创建任务
应具备幂等性
Source§

fn uninstall(&mut self)

卸载服务
服务应回收安装后产生的一切副作用和安装时注入的依赖
应具备幂等性
Source§

fn stop(&self)

停止服务
不同于 uninstall 方法 ,stop 方法仅需要回收安装后产生的副作用,并不需要回收安装时注入的依赖
应具备幂等性
Source§

fn start<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ServiceStartResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

开始服务
服务内应保证任务在服务的生命周期内最多存在一个
由于在服务生命周期内最多存在一个任务,所以该方法 应具备幂等性
Source§

fn restart<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ServiceStartResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

重启服务
不具备幂等性
Source§

impl<S: CommunicationService, R: CommunicationService> Drop for BothEventCombiner<S, R>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<S, R> Freeze for BothEventCombiner<S, R>
where S: Freeze, R: Freeze,

§

impl<S, R> RefUnwindSafe for BothEventCombiner<S, R>

§

impl<S, R> Send for BothEventCombiner<S, R>

§

impl<S, R> Sync for BothEventCombiner<S, R>

§

impl<S, R> Unpin for BothEventCombiner<S, R>
where S: Unpin, R: Unpin,

§

impl<S, R> UnsafeUnpin for BothEventCombiner<S, R>
where S: UnsafeUnpin, R: UnsafeUnpin,

§

impl<S, R> UnwindSafe for BothEventCombiner<S, R>
where S: UnwindSafe, R: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoService for T
where T: CommunicationService + 'static,

Source§

fn into(self) -> impl CommunicationService + 'static

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more