Struct UnixListener
pub struct UnixListener { /* private fields */ }Expand description
A Unix (domain) socket server, listening for incoming connections once served
using one of the serve methods such as UnixListener::serve.
Note that the underlying socket (file) is only cleaned up
by this listener’s Drop implementation if the listener
was created using the bind_path constructor. Otherwise
it is assumed that the creator of this listener is in charge
of that cleanup.
Implementations§
§impl UnixListener
impl UnixListener
pub fn build(exec: Executor) -> UnixListenerBuilder
pub fn build(exec: Executor) -> UnixListenerBuilder
Create a new UnixListenerBuilder without a state,
which can be used to configure a UnixListener.
pub async fn bind_path(
path: impl AsRef<Path>,
exec: Executor,
) -> Result<UnixListener, Error>
pub async fn bind_path( path: impl AsRef<Path>, exec: Executor, ) -> Result<UnixListener, Error>
Creates a new UnixListener, which will be bound to the specified path.
The returned listener is ready for accepting connections.
pub fn bind_socket(
socket: Socket,
exec: Executor,
) -> Result<UnixListener, Error>
pub fn bind_socket( socket: Socket, exec: Executor, ) -> Result<UnixListener, Error>
Creates a new UnixListener, which will be bound to the specified socket.
The returned listener is ready for accepting connections.
pub async fn bind_socket_opts(
opts: SocketOptions,
exec: Executor,
) -> Result<UnixListener, Box<dyn Error + Send + Sync>>
pub async fn bind_socket_opts( opts: SocketOptions, exec: Executor, ) -> Result<UnixListener, Box<dyn Error + Send + Sync>>
Creates a new TcpListener, which will be bound to the specified (interface) device name.
The returned listener is ready for accepting connections.
§impl UnixListener
impl UnixListener
pub fn local_addr(&self) -> Result<SocketAddr, Error>
pub fn local_addr(&self) -> Result<SocketAddr, Error>
Returns the local address that this listener is bound to.
This can be useful, for example, when binding to port 0 to figure out which port was actually bound.
pub fn from_tokio_unix_listener( listener: UnixListener, exec: Executor, ) -> UnixListener
pub fn try_from_socket( socket: Socket, exec: Executor, ) -> Result<UnixListener, Error>
pub fn try_from_std_unix_listener( listener: UnixListener, exec: Executor, ) -> Result<UnixListener, Error>
§impl UnixListener
impl UnixListener
pub async fn accept(&self) -> Result<(UnixStream, UnixSocketAddress), Error>
pub async fn accept(&self) -> Result<(UnixStream, UnixSocketAddress), Error>
Accept a single connection from this listener, what you can do with whatever you want.
pub async fn serve<S>(self, service: S)
pub async fn serve<S>(self, service: S)
Serve connections from this listener with the given service.
This listener will spawn a task in which the inner service will
handle the incomming connection. Connections will be served
gracefully if the UnixListener is configured with a graceful Executor.
Trait Implementations§
§impl AsFd for UnixListener
impl AsFd for UnixListener
§fn as_fd(&self) -> BorrowedFd<'_>
fn as_fd(&self) -> BorrowedFd<'_>
§impl AsRawFd for UnixListener
impl AsRawFd for UnixListener
Auto Trait Implementations§
impl !Freeze for UnixListener
impl RefUnwindSafe for UnixListener
impl Send for UnixListener
impl Sync for UnixListener
impl Unpin for UnixListener
impl UnwindSafe for UnixListener
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more