#[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
impl BorrowedSocket<'_>
source
impl BorrowedSocket<'_>
sourcepub const unsafe fn borrow_raw(socket: RawSocket) -> Self
source
pub const unsafe fn borrow_raw(socket: RawSocket) -> Self
sourceReturn 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
impl AsRawSocket for BorrowedSocket<'_>
source
impl AsRawSocket for BorrowedSocket<'_>
sourcefn as_raw_socket(&self) -> RawSocket
source
fn as_raw_socket(&self) -> RawSocket
sourceExtracts the raw socket. Read more
impl AsSocket for BorrowedSocket<'_>
source
impl AsSocket for BorrowedSocket<'_>
sourceimpl<'socket> Clone for BorrowedSocket<'socket>
source
impl<'socket> Clone for BorrowedSocket<'socket>
sourcefn clone(&self) -> BorrowedSocket<'socket>
source
fn clone(&self) -> BorrowedSocket<'socket>
sourceReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0 · source
fn clone_from(&mut self, source: &Self)
1.0.0 · sourcePerforms copy-assignment from source. Read more
impl Debug for BorrowedSocket<'_>
source
impl Debug for BorrowedSocket<'_>
sourceimpl<'socket> Copy for BorrowedSocket<'socket>
sourceAuto 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
impl<T> BorrowMut<T> for T where
T: ?Sized,
source
impl<T> BorrowMut<T> for T where
T: ?Sized,
sourcefn borrow_mut(&mut self) -> &mut T
const: unstable · source
fn borrow_mut(&mut self) -> &mut T
const: unstable · sourceMutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
source
impl<T> ToOwned for T where
T: Clone,
sourcetype Owned = T
type Owned = T
The resulting type after obtaining ownership.
fn clone_into(&self, target: &mut T)
source
fn clone_into(&self, target: &mut T)
sourceUses borrowed data to replace owned data, usually by cloning. Read more