Skip to main content

BindEndpoint

Trait BindEndpoint 

Source
pub trait BindEndpoint<S: ?Sized>: Send + Sync {
    type Listener: Send;

    // Required method
    fn bind(
        &self,
        scheduler: &S,
        options: BindOptions,
        cancellation: &Cancellation,
    ) -> impl Future<Output = OperationResult<Vec<Self::Listener>>> + Send;
}
Expand description

A reusable description of how to create listeners. Consumers need not know how addresses are resolved or sockets are created. Binding may produce multiple listeners, for example one per IP family.

Required Associated Types§

Source

type Listener: Send

One bound listener, owned by the caller on success. Its representation belongs to the endpoint implementation.

Required Methods§

Source

fn bind( &self, scheduler: &S, options: BindOptions, cancellation: &Cancellation, ) -> impl Future<Output = OperationResult<Vec<Self::Listener>>> + Send

Bind and start listening on every address. Success returns a nonempty collection; failure transfers no listeners to the caller. Futures are lazy. Await completion after cooperative cancellation to finish asynchronous rollback; dropping a pending future provides ordinary destruction only.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§