Struct Bootstrapper

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

A bootstrap helper.

This creates a unix socket that is linked to the file system so that a Receiver can connect to it. It lets you send one or more messages to the connected receiver.

The bootstrapper lets you send both to raw and typed receivers on the other side. To send to a raw one use the send_raw method.

Implementations§

Source§

impl Bootstrapper

Source

pub fn new() -> Result<Bootstrapper>

Creates a bootstrapper at a random socket in /tmp.

Source

pub fn bind<P: AsRef<Path>>(p: P) -> Result<Bootstrapper>

Creates a bootstrapper at a specific socket path.

Source

pub fn path(&self) -> &Path

Returns the path of the socket.

Source

pub async fn send_raw(&self, data: &[u8], fds: &[RawFd]) -> Result<usize>

Sends a raw value into the boostrapper.

This can be called multiple times to send more than one value into the inner socket. On the other side a RawReceiver must be used.

Source

pub async fn send<T: Serialize + DeserializeOwned>(&self, data: T) -> Result<()>

Sends a value into the boostrapper.

This can be called multiple times to send more than one value into the inner socket. On the other side a correctly typed Receiver must be used.

This requires the serde feature.

Trait Implementations§

Source§

impl Debug for Bootstrapper

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for Bootstrapper

Source§

fn drop(&mut self)

Executes the destructor for this type. 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.
Source§

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

Source§

fn vzip(self) -> V