pub struct Listener { /* private fields */ }
rfcomm
only.Expand description
An RFCOMM socket server, listening for Stream connections.
Implementations
sourceimpl Listener
impl Listener
sourcepub async fn bind(sa: SocketAddr) -> Result<Self>
pub async fn bind(sa: SocketAddr) -> Result<Self>
Creates a new Listener, which will be bound to the specified socket address.
Specify SocketAddr::any for any local adapter address with a dynamically allocated channel.
This will not register an SDP record for this channel. Register a Bluetooth RFCOMM profile instead, if you need a service record.
sourcepub async fn accept(&self) -> Result<(Stream, SocketAddr)>
pub async fn accept(&self) -> Result<(Stream, SocketAddr)>
Accepts a new incoming connection from this listener.
sourcepub fn poll_accept(
&self,
cx: &mut Context<'_>
) -> Poll<Result<(Stream, SocketAddr)>>
pub fn poll_accept(
&self,
cx: &mut Context<'_>
) -> Poll<Result<(Stream, SocketAddr)>>
Polls to accept a new incoming connection to this listener.
sourcepub unsafe fn from_raw_fd(fd: RawFd) -> Result<Self>
pub unsafe fn from_raw_fd(fd: RawFd) -> Result<Self>
Constructs a new Listener from the given raw file descriptor.
The file descriptor must have been set to non-blocking mode.
This function consumes ownership of the specified file descriptor. The returned object will take responsibility for closing it when the object goes out of scope.
Safety
If the passed file descriptor is invalid, undefined behavior may occur.
Trait Implementations
sourceimpl FromRawFd for Listener
impl FromRawFd for Listener
sourceunsafe fn from_raw_fd(fd: RawFd) -> Self
unsafe fn from_raw_fd(fd: RawFd) -> Self
Constructs a new instance of Self
from the given raw file
descriptor.
The file descriptor must have been set to non-blocking mode.
Panics
Panics when the conversion fails. Use Listener::from_raw_fd for a non-panicking variant.
Auto Trait Implementations
impl !RefUnwindSafe for Listener
impl Send for Listener
impl Sync for Listener
impl Unpin for Listener
impl !UnwindSafe for Listener
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more