pub struct CmpInOut<TMsg, TService>where
TMsg: MsgDataBound,
TService: ServiceBound,{
pub cache: Cache<TMsg>,
/* private fields */
}
Expand description
Подключение компонента к внутренней шине сообщений исполнителя
Fields§
§cache: Cache<TMsg>
Ссылка на кэш TODO - проверить, скорее всего можно сделать приватным
Implementations§
Source§impl<TMsg, TService> CmpInOut<TMsg, TService>where
TMsg: MsgDataBound,
TService: ServiceBound,
impl<TMsg, TService> CmpInOut<TMsg, TService>where
TMsg: MsgDataBound,
TService: ServiceBound,
Sourcepub fn new(
input: Receiver<Message<TMsg>>,
output: Sender<Message<TMsg>>,
cache: Cache<TMsg>,
name: &str,
id: Uuid,
auth_perm: AuthPermissions,
fn_auth: fn(_: Message<TMsg>, _: &AuthPermissions) -> Option<Message<TMsg>>,
service: TService,
) -> Self
pub fn new( input: Receiver<Message<TMsg>>, output: Sender<Message<TMsg>>, cache: Cache<TMsg>, name: &str, id: Uuid, auth_perm: AuthPermissions, fn_auth: fn(_: Message<TMsg>, _: &AuthPermissions) -> Option<Message<TMsg>>, service: TService, ) -> Self
Создание подключения к внутренней шине сообщений исполнителя
Sourcepub fn clone_with_new_id(&self, name: &str, auth_perm: AuthPermissions) -> Self
pub fn clone_with_new_id(&self, name: &str, auth_perm: AuthPermissions) -> Self
Клонировать и присвоить новый идентификатор
Необходимо вызывать в начале исполнения компонента, чтобы у каждого компонента был уникальный id
Sourcepub async fn recv_input(&mut self) -> Result<Message<TMsg>, ComponentError>
pub async fn recv_input(&mut self) -> Result<Message<TMsg>, ComponentError>
Получение сообщений со входа
Sourcepub async fn recv_cache_all(&self) -> Vec<Message<TMsg>>
pub async fn recv_cache_all(&self) -> Vec<Message<TMsg>>
Возвращает копию сообщений из кеша
Sourcepub async fn recv_cache_msg(&self, key: &str) -> Option<Message<TMsg>>
pub async fn recv_cache_msg(&self, key: &str) -> Option<Message<TMsg>>
Возвращает сообщение из кеша по ключу
Sourcepub async fn send_output(
&self,
msg: Message<TMsg>,
) -> Result<(), ComponentError>
pub async fn send_output( &self, msg: Message<TMsg>, ) -> Result<(), ComponentError>
Отправка сообщений на выход
Sourcepub fn send_output_blocking(
&self,
msg: Message<TMsg>,
) -> Result<(), ComponentError>
pub fn send_output_blocking( &self, msg: Message<TMsg>, ) -> Result<(), ComponentError>
Отправка исходящих сообщений, в синхронном окружении
Sourcepub fn max_capacity(&self) -> usize
pub fn max_capacity(&self) -> usize
Возвращает максимальный размер очереди сообщений
Trait Implementations§
Source§impl<TMsg, TService> Clone for CmpInOut<TMsg, TService>where
TMsg: MsgDataBound,
TService: ServiceBound,
impl<TMsg, TService> Clone for CmpInOut<TMsg, TService>where
TMsg: MsgDataBound,
TService: ServiceBound,
Auto Trait Implementations§
impl<TMsg, TService> Freeze for CmpInOut<TMsg, TService>where
TService: Freeze,
impl<TMsg, TService> !RefUnwindSafe for CmpInOut<TMsg, TService>
impl<TMsg, TService> Send for CmpInOut<TMsg, TService>
impl<TMsg, TService> Sync for CmpInOut<TMsg, TService>
impl<TMsg, TService> Unpin for CmpInOut<TMsg, TService>where
TService: Unpin,
impl<TMsg, TService> !UnwindSafe for CmpInOut<TMsg, TService>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Erasable for T
impl<T> Erasable for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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