Struct rustix::fd::BorrowedFd
source · [−]#[repr(transparent)]pub struct BorrowedFd<'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
.
Implementations
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
.
Trait Implementations
Extracts the underlying raw socket from this object.
Borrows the 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
Returns the raw value.
Borrows the reference.
pub fn as_socketlike_view<Target>(&self) -> SocketlikeView<'_, Target> where
Target: FromSocketlike + IntoSocketlike,
pub fn as_socketlike_view<Target>(&self) -> SocketlikeView<'_, Target> where
Target: FromSocketlike + IntoSocketlike,
Return a borrowing view of a resource which dereferences to a &Target
or &mut Target
. Read more
Mutably borrows from an owned value. Read more