/third_party/rust/crates/io-lifetimes/src/ |
H A D | impls_mio.rs | 6 use crate::{AsFd, BorrowedFd, FromFd, IntoFd, OwnedFd}; 35 fn into_fd(self) -> OwnedFd { in into_fd() 36 unsafe { OwnedFd::from_raw_fd(self.into_raw_fd()) } in into_fd() 41 impl From<mio::net::TcpStream> for OwnedFd { 67 fn from_fd(owned: OwnedFd) -> Self { in from_fd() 73 impl From<OwnedFd> for mio::net::TcpStream { 75 fn from(owned: OwnedFd) -> Self { in from() 115 fn into_fd(self) -> OwnedFd { in into_fd() 116 unsafe { OwnedFd::from_raw_fd(self.into_raw_fd()) } in into_fd() 121 impl From<mio::net::TcpListener> for OwnedFd { [all...] |
H A D | impls_std.rs | 8 use crate::{BorrowedFd, OwnedFd}; 45 impl AsFd for OwnedFd { 69 impl IntoFd for OwnedFd { 71 fn into_fd(self) -> OwnedFd { in into_fd() 93 impl FromFd for OwnedFd { 95 fn from_fd(owned: OwnedFd) -> Self { in from_fd() 151 fn into_fd(self) -> OwnedFd { in into_fd() 152 unsafe { OwnedFd::from_raw_fd(self.into_raw_fd()) } in into_fd() 157 impl From<std::fs::File> for OwnedFd { 183 fn from_fd(owned: OwnedFd) [all...] |
H A D | impls_async_std.rs | 6 use crate::{AsFd, BorrowedFd, FromFd, IntoFd, OwnedFd}; 42 fn into_fd(self) -> OwnedFd { in into_fd() 43 unsafe { OwnedFd::from_raw_fd(self.into_raw_fd()) } in into_fd() 48 impl From<async_std::fs::File> for OwnedFd { 74 fn from_fd(owned: OwnedFd) -> Self { in from_fd() 80 impl From<OwnedFd> for async_std::fs::File { 82 fn from(owned: OwnedFd) -> Self { in from() 122 fn into_fd(self) -> OwnedFd { in into_fd() 123 unsafe { OwnedFd::from_raw_fd(self.into_raw_fd()) } in into_fd() 128 impl From<async_std::net::TcpStream> for OwnedFd { [all...] |
H A D | impls_os_pipe.rs | 6 use crate::{AsFd, BorrowedFd, FromFd, IntoFd, OwnedFd}; 35 fn into_fd(self) -> OwnedFd { in into_fd() 36 unsafe { OwnedFd::from_raw_fd(self.into_raw_fd()) } in into_fd() 41 impl From<os_pipe::PipeReader> for OwnedFd { 67 fn from_fd(owned: OwnedFd) -> Self { in from_fd() 73 impl From<OwnedFd> for os_pipe::PipeReader { 75 fn from(owned: OwnedFd) -> Self { in from() 115 fn into_fd(self) -> OwnedFd { in into_fd() 116 unsafe { OwnedFd::from_raw_fd(self.into_raw_fd()) } in into_fd() 121 impl From<os_pipe::PipeWriter> for OwnedFd { [all...] |
H A D | portability.rs | 9 use crate::{AsFd, BorrowedFd, OwnedFd}; 43 /// This is a portability abstraction over Unix-like [`OwnedFd`] and 46 pub type OwnedFilelike = OwnedFd; 50 /// This is a portability abstraction over Unix-like `OwnedFd` and 57 /// This is a portability abstraction over Unix-like [`OwnedFd`] and 60 pub type OwnedSocketlike = OwnedFd; 64 /// This is a portability abstraction over Unix-like `OwnedFd` and 260 /// This is a portability abstraction over Unix-like [`Into<OwnedFd>`] and Windows' in as_socketlike() 263 pub trait IntoFilelike: Into<OwnedFd> { in as_socketlike() 281 impl<T: Into<OwnedFd>> IntoFilelik [all...] |
H A D | impls_socket2.rs | 6 use crate::{AsFd, BorrowedFd, FromFd, IntoFd, OwnedFd}; 35 fn into_fd(self) -> OwnedFd { in into_fd() 36 unsafe { OwnedFd::from_raw_fd(self.into_raw_fd()) } in into_fd() 41 impl From<socket2::Socket> for OwnedFd { 44 unsafe { OwnedFd::from_raw_fd(owned.into_raw_fd()) } in from() 67 fn from_fd(owned: OwnedFd) -> Self { in from_fd() 73 impl From<OwnedFd> for socket2::Socket { 75 fn from(owned: OwnedFd) -> Self { in from()
|
H A D | lib.rs | 59 pub use types::{BorrowedFd, OwnedFd}; 69 pub use std::os::unix::io::{AsFd, BorrowedFd, OwnedFd}; 72 pub use std::os::wasi::io::{AsFd, BorrowedFd, OwnedFd}; 86 // for third-party types. However, this means that until `OwnedFd` et al are 94 impl<T: From<OwnedFd>> FromFd for T { 96 fn from_fd(owned_fd: OwnedFd) -> Self { in from_fd() 105 OwnedFd: From<T>, 108 fn into_fd(self) -> OwnedFd { in into_fd()
|
H A D | impls_fs_err.rs | 6 use crate::{AsFd, BorrowedFd, IntoFd, OwnedFd}; 35 fn into_fd(self) -> OwnedFd { in into_fd() 36 unsafe { OwnedFd::from_raw_fd(self.into_raw_fd()) } in into_fd() 41 impl From<fs_err::File> for OwnedFd {
|
H A D | traits.rs | 5 use crate::OwnedFd; 69 note = "`IntoFd` is replaced by `From<...> for OwnedFd` or `Into<OwnedFd>`" in as_socket() 79 /// use io_lifetimes::{IntoFd, OwnedFd}; in as_socket() 82 /// let owned_fd: OwnedFd = f.into_fd(); in as_socket() 85 fn into_fd(self) -> OwnedFd; in as_socket() 135 /// use io_lifetimes::{FromFd, IntoFd, OwnedFd}; 138 /// let owned_fd: OwnedFd = f.into_fd(); 144 note = "`FromFd::from_fd` is replaced by `From<OwnedFd>::from`" 146 fn from_fd(owned: OwnedFd) [all...] |
H A D | types.rs | 48 /// rather than an `OwnedFd`. It just makes a trivial copy of the raw file 55 _phantom: PhantomData<&'fd OwnedFd>, 117 pub struct OwnedFd { structure names 122 impl OwnedFd { impls 123 /// Creates a new `OwnedFd` instance that shares the same underlying file 124 /// description as the existing `OwnedFd` instance. 132 /// Creates a new `OwnedFd` instance that shares the same underlying file 134 pub fn try_clone_to_owned(&self) -> std::io::Result<OwnedFd> { in try_clone_to_owned() 157 Ok(unsafe { OwnedFd::from_raw_fd(fd) }) in try_clone_to_owned() 167 // `OwnedFd` instance in try_clone_to_owned() [all...] |
H A D | impls_tokio.rs | 6 use crate::{AsFd, BorrowedFd, FromFd, OwnedFd}; 35 fn from_fd(owned: OwnedFd) -> Self { in from_fd() 41 impl From<OwnedFd> for tokio::fs::File { 43 fn from(owned: OwnedFd) -> Self { in from()
|
/third_party/rust/crates/io-lifetimes/examples/ |
H A D | flexible-apis.rs | 8 use io_lifetimes::{AsFd, BorrowedFd, OwnedFd}; 39 /// `OwnedFd` as an argument. Similar to `use_fd_a`, this doesn't require the 45 fn consume_fd_a(fd: OwnedFd) { in consume_fd_a() 54 fn consume_fd_b<Fd: Into<OwnedFd>>(fd: Fd) { in consume_fd_b() 55 let _: OwnedFd = fd.into(); in consume_fd_b() 60 fn consume_fd_c(fd: impl Into<OwnedFd>) { in consume_fd_c() 61 let _: OwnedFd = fd.into(); in consume_fd_c() 91 // Another option can take any `Into<OwnedFd>` type directly. in main() 94 // The other option can take any `Into<OwnedFd>` type directly. in main()
|
/third_party/rust/crates/rustix/src/io/ |
H A D | context.rs | 5 use crate::fd::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd}; 107 /// implementing `From<OwnedFd>` and `From<T> for OwnedFd`. in release() 109 /// This may be used with [`OwnedFd`], or higher-level types like in release() 112 pub struct Owning<'context, T: Into<OwnedFd> + From<OwnedFd>> { in release() 117 impl<'context, T: Into<OwnedFd> + From<OwnedFd>> Owning<'context, T> { in release() 129 impl<'context, T: AsFd + Into<OwnedFd> + From<OwnedFd>> Contex [all...] |
H A D | pipe.rs | 3 use crate::fd::OwnedFd; 44 pub fn pipe() -> io::Result<(OwnedFd, OwnedFd)> { in pipe() 65 pub fn pipe_with(flags: PipeFlags) -> io::Result<(OwnedFd, OwnedFd)> { in pipe_with()
|
H A D | dup.rs | 3 use crate::fd::OwnedFd; 10 /// `dup(fd)`—Creates a new `OwnedFd` instance that shares the same 32 pub fn dup<Fd: AsFd>(fd: Fd) -> io::Result<OwnedFd> { in dup() 59 pub fn dup2<Fd: AsFd>(fd: Fd, new: &mut OwnedFd) -> io::Result<()> { in dup2() 78 pub fn dup3<Fd: AsFd>(fd: Fd, new: &mut OwnedFd, flags: DupFlags) -> io::Result<()> { in dup3()
|
H A D | fcntl.rs | 12 use backend::fd::{AsFd, OwnedFd, RawFd}; 44 /// `fcntl(fd, F_DUPFD_CLOEXEC)`—Creates a new `OwnedFd` instance, with value 62 pub fn fcntl_dupfd_cloexec<Fd: AsFd>(fd: Fd, min: RawFd) -> io::Result<OwnedFd> { in fcntl_dupfd_cloexec() 66 /// `fcntl(fd, F_DUPFD)`—Creates a new `OwnedFd` instance, with value at least 83 pub fn fcntl_dupfd<Fd: AsFd>(fd: Fd, min: RawFd) -> io::Result<OwnedFd> { in fcntl_dupfd()
|
H A D | eventfd.rs | 1 use crate::fd::OwnedFd; 14 pub fn eventfd(initval: u32, flags: EventfdFlags) -> io::Result<OwnedFd> { in eventfd()
|
/third_party/rust/crates/rustix/src/net/ |
H A D | socket.rs | 1 use crate::fd::OwnedFd; 38 pub fn socket(domain: AddressFamily, type_: SocketType, protocol: Protocol) -> io::Result<OwnedFd> { in socket() 68 ) -> io::Result<OwnedFd> { in socket_with() 323 pub fn accept<Fd: AsFd>(sockfd: Fd) -> io::Result<OwnedFd> { in accept() 345 pub fn accept_with<Fd: AsFd>(sockfd: Fd, flags: AcceptFlags) -> io::Result<OwnedFd> { in accept_with() 366 pub fn acceptfrom<Fd: AsFd>(sockfd: Fd) -> io::Result<(OwnedFd, Option<SocketAddrAny>)> { in acceptfrom() 387 ) -> io::Result<(OwnedFd, Option<SocketAddrAny>)> { in acceptfrom_with()
|
H A D | socketpair.rs | 1 use crate::fd::OwnedFd; 19 ) -> io::Result<(OwnedFd, OwnedFd)> { in socketpair()
|
/third_party/rust/crates/rustix/src/io/fd/ |
H A D | owned.rs | 28 /// rather than an `OwnedFd`. It just makes a trivial copy of the raw file 41 _phantom: PhantomData<&'fd OwnedFd>, 60 pub struct OwnedFd { structure names 86 impl OwnedFd { impls 87 /// Creates a new `OwnedFd` instance that shares the same underlying file handle 88 /// as the existing `OwnedFd` instance. 125 impl AsRawFd for OwnedFd { 133 impl IntoRawFd for OwnedFd { 143 impl FromRawFd for OwnedFd { 162 impl Drop for OwnedFd { [all...] |
/third_party/rust/crates/rustix/src/backend/linux_raw/io/ |
H A D | epoll.rs | 64 use crate::fd::{AsFd, AsRawFd, OwnedFd}; 120 epoll_fd: OwnedFd, 240 impl<'context, T: AsFd + Into<OwnedFd> + From<OwnedFd>> AsRawFd for Epoll<Owning<'context, T>> { 247 impl<'context, T: AsFd + Into<OwnedFd> + From<OwnedFd>> IntoRawFd for Epoll<Owning<'context, T>> { 254 impl<'context, T: AsFd + Into<OwnedFd> + From<OwnedFd>> FromRawFd for Epoll<Owning<'context, T>> { 257 epoll_fd: OwnedFd::from_raw_fd(fd), in from_raw_fd() 264 impl<'context, T: AsFd + Into<OwnedFd> [all...] |
/third_party/rust/crates/rustix/tests/io/ |
H A D | epoll.rs | 3 use rustix::fd::{AsFd, OwnedFd}; 33 let epoll = Epoll::new(epoll::CreateFlags::CLOEXEC, epoll::Owning::<OwnedFd>::new()).unwrap(); in server() 36 let fd: OwnedFd = epoll.into(); in server() 37 let epoll: Epoll<epoll::Owning<OwnedFd>> = fd.into(); in server() 39 let epoll = unsafe { Epoll::<epoll::Owning<OwnedFd>>::from_raw_fd(fd) }; in server()
|
/third_party/rust/crates/rustix/src/backend/libc/net/ |
H A D | syscalls.rs | 18 use crate::fd::{BorrowedFd, OwnedFd}; 148 ) -> io::Result<OwnedFd> { 164 ) -> io::Result<OwnedFd> { 246 pub(crate) fn accept(sockfd: BorrowedFd<'_>) -> io::Result<OwnedFd> { 261 pub(crate) fn accept_with(sockfd: BorrowedFd<'_>, flags: AcceptFlags) -> io::Result<OwnedFd> { 274 pub(crate) fn acceptfrom(sockfd: BorrowedFd<'_>) -> io::Result<(OwnedFd, Option<SocketAddrAny>)> { 301 ) -> io::Result<(OwnedFd, Option<SocketAddrAny>)> { 321 pub(crate) fn accept_with(sockfd: BorrowedFd<'_>, _flags: AcceptFlags) -> io::Result<OwnedFd> { 331 ) -> io::Result<(OwnedFd, Option<SocketAddrAny>)> { 377 ) -> io::Result<(OwnedFd, OwnedF [all...] |
/third_party/rust/crates/rustix/src/backend/libc/io/ |
H A D | epoll.rs | 62 use crate::fd::{AsFd, AsRawFd, BorrowedFd, OwnedFd, RawFd}; 120 epoll_fd: OwnedFd, 249 impl<'context, T: AsFd + Into<OwnedFd> + From<OwnedFd>> AsRawFd for Epoll<Owning<'context, T>> { 256 impl<'context, T: AsFd + Into<OwnedFd> + From<OwnedFd>> IntoRawFd for Epoll<Owning<'context, T>> { 263 impl<'context, T: AsFd + Into<OwnedFd> + From<OwnedFd>> FromRawFd for Epoll<Owning<'context, T>> { 266 epoll_fd: OwnedFd::from_raw_fd(fd), in from_raw_fd() 273 impl<'context, T: AsFd + Into<OwnedFd> [all...] |
/third_party/rust/crates/rustix/src/mm/ |
H A D | userfaultfd.rs | 9 use crate::fd::OwnedFd; 28 pub unsafe fn userfaultfd(flags: UserfaultfdFlags) -> io::Result<OwnedFd> { in userfaultfd()
|