Struct io_lifetimes::BorrowedSocket
1.63.0 · source · #[repr(transparent)]pub struct BorrowedSocket<'socket> { /* private fields */ }
Expand description
A borrowed socket.
This has a lifetime parameter to tie it to the lifetime of something that owns the socket.
This uses repr(transparent)
and has the representation of a host socket,
so it can be used in FFI in places where a socket is passed as an argument,
it is not captured or consumed, and it never has the value
INVALID_SOCKET
.
This type’s .to_owned()
implementation returns another BorrowedSocket
rather than an OwnedSocket
. It just makes a trivial copy of the raw
socket, which is then borrowed under the same lifetime.
Implementations§
source§impl BorrowedSocket<'_>
impl BorrowedSocket<'_>
const: 1.63.0 · sourcepub const unsafe fn borrow_raw(socket: u64) -> BorrowedSocket<'_>
pub const unsafe fn borrow_raw(socket: u64) -> BorrowedSocket<'_>
Return a BorrowedSocket
holding the given raw socket.
Safety
The resource pointed to by raw
must remain open for the duration of
the returned BorrowedSocket
, and it must not have the value
INVALID_SOCKET
.
source§impl BorrowedSocket<'_>
impl BorrowedSocket<'_>
sourcepub fn try_clone_to_owned(&self) -> Result<OwnedSocket, Error>
pub fn try_clone_to_owned(&self) -> Result<OwnedSocket, Error>
Creates a new OwnedSocket
instance that shares the same underlying
object as the existing BorrowedSocket
instance.
Trait Implementations§
source§impl AsRawSocket for BorrowedSocket<'_>
impl AsRawSocket for BorrowedSocket<'_>
source§fn as_raw_socket(&self) -> u64
fn as_raw_socket(&self) -> u64
source§impl AsSocket for BorrowedSocket<'_>
impl AsSocket for BorrowedSocket<'_>
source§fn as_socket(&self) -> BorrowedSocket<'_>
fn as_socket(&self) -> BorrowedSocket<'_>
source§impl<'socket> Clone for BorrowedSocket<'socket>
impl<'socket> Clone for BorrowedSocket<'socket>
source§fn clone(&self) -> BorrowedSocket<'socket>
fn clone(&self) -> BorrowedSocket<'socket>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for BorrowedSocket<'_>
impl Debug for BorrowedSocket<'_>
impl<'socket> Copy for BorrowedSocket<'socket>
Auto Trait Implementations§
impl<'socket> RefUnwindSafe for BorrowedSocket<'socket>
impl<'socket> Send for BorrowedSocket<'socket>
impl<'socket> Sync for BorrowedSocket<'socket>
impl<'socket> Unpin for BorrowedSocket<'socket>
impl<'socket> UnwindSafe for BorrowedSocket<'socket>
Blanket Implementations§
source§impl<T> AsRawSocketlike for Twhere
T: AsRawSocket,
impl<T> AsRawSocketlike for Twhere T: AsRawSocket,
source§fn as_raw_socketlike(&self) -> u64
fn as_raw_socketlike(&self) -> u64
source§impl<T> AsSocketlike for Twhere
T: AsSocket,
impl<T> AsSocketlike for Twhere T: AsSocket,
source§fn as_socketlike(&self) -> BorrowedSocket<'_>
fn as_socketlike(&self) -> BorrowedSocket<'_>
source§fn as_socketlike_view<Target>(&self) -> SocketlikeView<'_, Target>where
Target: SocketlikeViewType,
fn as_socketlike_view<Target>(&self) -> SocketlikeView<'_, Target>where Target: SocketlikeViewType,
&Target
. Read more