Skip to main content

IPCConnection

Struct IPCConnection 

Source
pub struct IPCConnection { /* private fields */ }
Expand description

A connection between an IPC client and server.

Connections are used to exchange data using Execute, Request, Poke, and Advise operations. The connection can be created by the server (in OnAcceptConnection) or returned from a client’s MakeConnection call.

Implementations§

Source§

impl IPCConnection

Source

pub fn builder() -> IPCConnectionBuilder

Create a new connection builder.

Source

pub fn execute(&self, data: &[u8], format: IPCFormat) -> bool

Execute a command on the remote side.

On the server side, this triggers the client’s OnExecute callback. On the client side, this triggers the server’s OnExecute callback.

Source

pub fn execute_string(&self, data: &str) -> bool

Execute a string command (convenience method for text data).

Source

pub fn request(&self, item: &str, format: IPCFormat) -> Option<Vec<u8>>

Request data from the remote side.

Returns the data if the request was successful, None otherwise.

Source

pub fn poke(&self, item: &str, data: &[u8], format: IPCFormat) -> bool

Poke data to the remote side.

Source

pub fn start_advise(&self, item: &str) -> bool

Start an advise loop for the given item.

The server will send updates via the OnAdvise callback when the item changes.

Source

pub fn stop_advise(&self, item: &str) -> bool

Stop an advise loop for the given item.

Source

pub fn advise(&self, item: &str, data: &[u8], format: IPCFormat) -> bool

Send advised data to the client (server-side only).

Source

pub fn disconnect(&self) -> bool

Disconnect the connection.

Source

pub fn is_connected(&self) -> bool

Check if the connection is still connected.

Trait Implementations§

Source§

impl Drop for IPCConnection

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

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, 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, 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.