Skip to main content

ConnectOptions

Struct ConnectOptions 

Source
pub struct ConnectOptions<'n> { /* private fields */ }
Expand description

Client-side builder for local socket streams, including Stream.

Implementations§

Source§

impl ConnectOptions<'_>

Creation and ownership.

Source

pub fn new() -> Self

Returns a default set of client options.

Source§

impl<'n> ConnectOptions<'n>

Option setters.

Source

pub fn name(self, name: Name<'n>) -> Self

Sets the name the client will connect to.

Source

pub fn wait_mode(self, wait_mode: ConnectWaitMode) -> Self

Sets the wait mode of the connection operation.

This defaults to unbounded waiting.

§Platform-specific behavior
§Unix

Number of additional fcntls if SOCK_NONBLOCK is available:

wait_mode \ nonblocking_streamfalsetrue
Unbounded01
Timeout10
Deferred10

Number of additional fcntls if SOCK_NONBLOCK is not available:

wait_mode \ nonblocking_streamfalsetrue
Unbounded01
Timeout21
Deferred21
§Windows

WaitMode::Timeout has no effect in that attempting to connect to an overloaded named pipe will always return an error as soon as possible. If the named pipe is across the network, this may entail blocking on network activity for a duration that exceeds the specified timeout.

WaitMode::Deferred is not supported, and an error will be returned by connect_* if it is used.

Source

pub fn nonblocking_stream(self, nonblocking: bool) -> Self

Sets whether the resulting connection is to have its reads and writes be nonblocking or not.

This is disabled by default.

§Platform-specific behavior
§Unix

See wait_mode.

§Windows

The same as .set_nonblocking(true) immediately after creation.

Source§

impl ConnectOptions<'_>

Stream constructors.

Source

pub fn connect_sync(&self) -> Result<Stream>

Creates a Stream by connecting to the specified local socket name.

On platforms where there are multiple available implementations, this dispatches to the appropriate implementation based on where the name points to.

Source

pub fn connect_sync_as<S: Stream>(&self) -> Result<S>

Creates the given type of stream by connecting to the specified local socket name.

Source

pub fn connect_tokio( &self, ) -> impl Future<Output = Result<TokioStream>> + Send + Sync + '_

Available on crate feature tokio only.

Creates a Tokio Stream by connecting to the specified local socket name.

On platforms where there are multiple available implementations, this dispatches to the appropriate implementation based on where the name points to.

Source

pub fn connect_tokio_as<S: Stream>( &self, ) -> impl Future<Output = Result<S>> + Send + Sync + '_

Available on crate feature tokio only.

Creates the given type of Tokio stream by connecting to the specified local socket name.

Trait Implementations§

Source§

impl Debug for ConnectOptions<'_>

Source§

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

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

impl Default for ConnectOptions<'_>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl TryClone for ConnectOptions<'_>

Source§

fn try_clone(&self) -> Result<Self>

Clones self, possibly returning an error.

Auto Trait Implementations§

§

impl<'n> Freeze for ConnectOptions<'n>

§

impl<'n> RefUnwindSafe for ConnectOptions<'n>

§

impl<'n> Send for ConnectOptions<'n>

§

impl<'n> Sync for ConnectOptions<'n>

§

impl<'n> Unpin for ConnectOptions<'n>

§

impl<'n> UnsafeUnpin for ConnectOptions<'n>

§

impl<'n> UnwindSafe for ConnectOptions<'n>

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.