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