Skip to main content

IpcClientImpl

Struct IpcClientImpl 

Source
pub struct IpcClientImpl<Crypto, Com, Ses>
where Crypto: CryptoProvider<Com, Ses>, Com: CommunicationBackend, Ses: SessionRepository<Crypto::Session>,
{ inner: Arc<IpcClientInner<Crypto, Com, Ses>>, }
Expand description

An IPC client that handles communication between different components and clients. It uses a crypto provider to encrypt and decrypt messages, a communication backend to send and receive messages, and a session repository to persist sessions.

This is the concrete implementation of the IpcClient trait.

Fields§

§inner: Arc<IpcClientInner<Crypto, Com, Ses>>

Implementations§

Source§

impl<Crypto, Com, Ses> IpcClientImpl<Crypto, Com, Ses>
where Crypto: CryptoProvider<Com, Ses>, Com: CommunicationBackend, Ses: SessionRepository<Crypto::Session>,

Source

pub fn new(crypto: Crypto, communication: Com, sessions: Ses) -> Self

Create a new IPC client with the provided crypto provider, communication backend, and session repository.

Trait Implementations§

Source§

impl<Crypto, Com, Ses> Clone for IpcClientImpl<Crypto, Com, Ses>
where Crypto: CryptoProvider<Com, Ses>, Com: CommunicationBackend, Ses: SessionRepository<Crypto::Session>,

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Crypto, Com, Ses> IpcClient for IpcClientImpl<Crypto, Com, Ses>
where Crypto: CryptoProvider<Com, Ses>, Com: CommunicationBackend, Ses: SessionRepository<Crypto::Session>,

Source§

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

Start the IPC client, which will begin listening for incoming messages and processing them.
Source§

fn is_running(&self) -> bool

Check if the IPC client task is currently running.
Source§

fn send<'life0, 'async_trait>( &'life0 self, message: OutgoingMessage, ) -> Pin<Box<dyn Future<Output = Result<(), SendError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Send a message over IPC.
Source§

fn subscribe<'life0, 'async_trait>( &'life0 self, topic: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<IpcClientSubscription, SubscribeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Subscribe to receive messages, optionally filtered by topic. Setting the topic to None will receive all messages.

Auto Trait Implementations§

§

impl<Crypto, Com, Ses> Freeze for IpcClientImpl<Crypto, Com, Ses>

§

impl<Crypto, Com, Ses> !RefUnwindSafe for IpcClientImpl<Crypto, Com, Ses>

§

impl<Crypto, Com, Ses> Send for IpcClientImpl<Crypto, Com, Ses>

§

impl<Crypto, Com, Ses> Sync for IpcClientImpl<Crypto, Com, Ses>

§

impl<Crypto, Com, Ses> Unpin for IpcClientImpl<Crypto, Com, Ses>

§

impl<Crypto, Com, Ses> UnsafeUnpin for IpcClientImpl<Crypto, Com, Ses>

§

impl<Crypto, Com, Ses> !UnwindSafe for IpcClientImpl<Crypto, Com, Ses>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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> IpcClientExt for T
where T: IpcClient + ?Sized,

Source§

fn register_rpc_handler<H>(&self, handler: H) -> impl Future<Output = ()> + Send
where H: RpcHandler + Send + Sync + 'static,

Register a new RPC handler for processing incoming RPC requests. The handler will be executed by the IPC client when an RPC request is received and the response will be sent back over IPC.
Source§

fn send_typed<Payload>( &self, payload: Payload, destination: Endpoint, ) -> impl Future<Output = Result<(), RequestError>> + Send
where Payload: Serialize + PayloadTypeName + Send,

Send a message with a payload of any serializable type to the specified destination.
Source§

fn subscribe_typed<Payload>( &self, ) -> impl Future<Output = Result<IpcClientTypedSubscription<Payload>, SubscribeError>> + Send

Create a subscription to receive messages that can be deserialized into the provided payload type.
Source§

fn request<Request>( &self, request: Request, destination: Endpoint, cancellation_token: Option<CancellationToken>, ) -> impl Future<Output = Result<Request::Response, RequestError>> + Send
where Request: RpcRequest + Send, Request::Response: Send,

Send a request to the specified destination and wait for a response. The destination must have a registered RPC handler for the request type, otherwise an error will be returned by the remote endpoint.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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