pub trait FromRawSocket {
// Required method
unsafe fn from_raw_socket(sock: RawSocket) -> Self;
}
Creates I/O objects from raw sockets.
unsafe fn from_raw_socket(sock: RawSocket) -> Self
Constructs a new I/O object from the specified raw socket.
This function is typically used to consume ownership of the socket given, passing responsibility for closing the socket to the returned object. When used in this way, the returned object will take responsibility for closing it when the object goes out of scope.
However, consuming ownership is not strictly required. Use a From<OwnedSocket>::from implementation for an API which strictly consumes ownership.
The socket passed in must:
closesocket.This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
impl FromRawSocket for TcpListener
impl FromRawSocket for TcpStream
impl FromRawSocket for UdpSocket
impl FromRawSocket for OwnedSocket
© 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/trait.FromRawSocket.html