Struct std::os::windows::io::BorrowedSocket
#[repr(transparent)]pub struct BorrowedSocket<'socket> { /* fields omitted */ }
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
impl BorrowedSocket<'_>
pub unsafe fn borrow_raw_socket(socket: RawSocket) -> Self
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
impl AsRawSocket for BorrowedSocket<'_>
fn as_raw_socket(&self) -> RawSocket
Extracts the underlying raw socket from this object.
impl AsSocket for BorrowedSocket<'_>
fn as_socket(&self) -> BorrowedSocket<'_>
Borrows the socket.
impl<'socket> Clone for BorrowedSocket<'socket>
fn clone(&self) -> BorrowedSocket<'socket>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
impl Debug for BorrowedSocket<'_>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Formats the value using the given formatter. Read more
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
impl<T> From<T> for T
pub fn from(t: T) -> T
Performs the conversion.
pub fn into(self) -> U
Performs the conversion.
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
toowned_clone_into #41263)recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
Performs the conversion.
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
Performs the conversion.
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/os/windows/io/struct.BorrowedSocket.html