Enum deno_core::ResourceHandle
source · pub enum ResourceHandle {
Fd(ResourceHandleFd),
Socket(ResourceHandleSocket),
}
Expand description
Represents an underlying handle for a platform. On unix, everything is an fd
. On Windows, everything
is a Windows handle except for sockets (which are SOCKET
s).
Variants§
Fd(ResourceHandleFd)
A file handle/descriptor.
Socket(ResourceHandleSocket)
A socket handle/file descriptor.
Implementations§
source§impl ResourceHandle
impl ResourceHandle
sourcepub fn from_fd_like(io: &impl AsRawFd) -> Self
pub fn from_fd_like(io: &impl AsRawFd) -> Self
Converts a file-like thing to a ResourceHandle
.
sourcepub fn from_socket_like(io: &impl AsRawFd) -> Self
pub fn from_socket_like(io: &impl AsRawFd) -> Self
Converts a socket-like thing to a ResourceHandle
.
sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
Runs a basic validity check on the handle, but cannot fully determine if the handle is valid for use.
sourcepub fn as_fd_like(&self) -> Option<ResourceHandleFd>
pub fn as_fd_like(&self) -> Option<ResourceHandleFd>
Returns this as a file-descriptor-like handle.
sourcepub fn as_socket_like(&self) -> Option<ResourceHandleSocket>
pub fn as_socket_like(&self) -> Option<ResourceHandleSocket>
Returns this as a socket-like handle.
sourcepub fn is_terminal(&self) -> bool
pub fn is_terminal(&self) -> bool
Determines if this handle is a terminal. Analagous to std::io::IsTerminal
.
Trait Implementations§
source§impl Clone for ResourceHandle
impl Clone for ResourceHandle
source§fn clone(&self) -> ResourceHandle
fn clone(&self) -> ResourceHandle
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ResourceHandle
impl Debug for ResourceHandle
source§impl Hash for ResourceHandle
impl Hash for ResourceHandle
source§impl PartialEq for ResourceHandle
impl PartialEq for ResourceHandle
source§fn eq(&self, other: &ResourceHandle) -> bool
fn eq(&self, other: &ResourceHandle) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Copy for ResourceHandle
impl Eq for ResourceHandle
impl StructuralEq for ResourceHandle
impl StructuralPartialEq for ResourceHandle
Auto Trait Implementations§
impl RefUnwindSafe for ResourceHandle
impl Send for ResourceHandle
impl Sync for ResourceHandle
impl Unpin for ResourceHandle
impl UnwindSafe for ResourceHandle
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.