Struct cap_async_std::fs::File [−][src]
pub struct File { /* fields omitted */ }
A reference to an open file on a filesystem.
This corresponds to async_std::fs::File
.
Note that this File
has no open
or create
methods. To open or create
a file, you must first obtain a Dir
containing the path, and then call
Dir::open
or Dir::create
.
Implementations
impl File
[src]
impl File
[src]pub unsafe fn from_std(std: File) -> Self
[src]
pub unsafe fn from_std(std: File) -> Self
[src]Constructs a new instance of Self
from the given async_std::fs::File
.
Safety
async_std::fs::File
is not sandboxed and may access any path that the host
process has access to.
pub async fn sync_all(&self) -> Result<()>
[src]
pub async fn sync_all(&self) -> Result<()>
[src]Attempts to sync all OS-internal metadata to disk.
This corresponds to async_std::fs::File::sync_all
.
pub async fn sync_data(&self) -> Result<()>
[src]
pub async fn sync_data(&self) -> Result<()>
[src]This function is similar to sync_all
, except that it may not synchronize
file metadata to a filesystem.
This corresponds to async_std::fs::File::sync_data
.
pub async fn set_len(&self, size: u64) -> Result<()>
[src]
pub async fn set_len(&self, size: u64) -> Result<()>
[src]Truncates or extends the underlying file, updating the size of this file to become size.
This corresponds to async_std::fs::File::set_len
.
pub fn metadata(&self) -> Result<Metadata>
[src]
pub fn metadata(&self) -> Result<Metadata>
[src]Queries metadata about the underlying file.
This corresponds to async_std::fs::File::metadata
.
pub async fn set_permissions(&self, perm: Permissions) -> Result<()>
[src]
pub async fn set_permissions(&self, perm: Permissions) -> Result<()>
[src]Changes the permissions on the underlying file.
This corresponds to async_std::fs::File::set_permissions
.
Trait Implementations
impl AsyncRead for File
[src]
impl AsyncRead for File
[src]impl AsyncRead for &File
[src]
impl AsyncRead for &File
[src]impl AsyncWrite for File
[src]
impl AsyncWrite for File
[src]fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8]
) -> Poll<Result<usize>>
[src]
fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8]
) -> Poll<Result<usize>>
[src]Attempt to write bytes from buf
into the object. Read more
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
[src]
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
[src]Attempt to flush the object, ensuring that any buffered data reach their destination. Read more
impl AsyncWrite for &File
[src]
impl AsyncWrite for &File
[src]fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8]
) -> Poll<Result<usize>>
[src]
fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8]
) -> Poll<Result<usize>>
[src]Attempt to write bytes from buf
into the object. Read more
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
[src]
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
[src]Attempt to flush the object, ensuring that any buffered data reach their destination. Read more
impl FromRawFd for File
[src]
impl FromRawFd for File
[src]unsafe fn from_raw_fd(fd: RawFd) -> Self
[src]
unsafe fn from_raw_fd(fd: RawFd) -> Self
[src]Constructs a new instance of Self
from the given raw file
descriptor. Read more
impl IntoRawFd for File
[src]
impl IntoRawFd for File
[src]fn into_raw_fd(self) -> RawFd
[src]
fn into_raw_fd(self) -> RawFd
[src]Consumes this object, returning the raw underlying file descriptor. Read more
impl OwnsRaw for File
[src]
Auto Trait Implementations
impl !RefUnwindSafe for File
impl Send for File
impl Sync for File
impl Unpin for File
impl !UnwindSafe for File
Blanket Implementations
impl<T> AsUnsafeFile for T where
T: AsRawFd + OwnsRaw,
[src]
impl<T> AsUnsafeFile for T where
T: AsRawFd + OwnsRaw,
[src]pub fn as_unsafe_file(&self) -> UnsafeFile
[src]
pub fn as_unsafe_file(&self) -> UnsafeFile
[src]Return the contained unsafe file.
fn as_file_view(&self) -> View<'_, File>
[src]
fn as_file_view(&self) -> View<'_, File>
[src]Utility for returning a value which dereferences to a &File
or
&mut File
. Read more
unsafe fn as_unscoped_file_view(&self) -> View<'static, File>
[src]
unsafe fn as_unscoped_file_view(&self) -> View<'static, File>
[src]Like as_file_view
, but returns a value which is not explicitly tied
to the lifetime of self
. Read more
impl<T> AsUnsafeHandle for T where
T: AsRawFd + OwnsRaw,
[src]
impl<T> AsUnsafeHandle for T where
T: AsRawFd + OwnsRaw,
[src]pub fn as_unsafe_handle(&self) -> UnsafeHandle
[src]
pub fn as_unsafe_handle(&self) -> UnsafeHandle
[src]Return the contained unsafe handle.
impl<T> AsUnsafeSocket for T where
T: AsRawFd + OwnsRaw,
[src]
impl<T> AsUnsafeSocket for T where
T: AsRawFd + OwnsRaw,
[src]pub fn as_unsafe_socket(&self) -> UnsafeSocket
[src]
pub fn as_unsafe_socket(&self) -> UnsafeSocket
[src]Return the contained unsafe socket.
fn as_tcp_stream_view(&self) -> View<'_, TcpStream>
[src]
fn as_tcp_stream_view(&self) -> View<'_, TcpStream>
[src]Utility for returning a value which dereferences to a &TcpStream
or
&mut TcpStream
. Read more
unsafe fn as_unscoped_tcp_stream_view(&self) -> View<'static, TcpStream>
[src]
unsafe fn as_unscoped_tcp_stream_view(&self) -> View<'static, TcpStream>
[src]Like as_tcp_stream_view
, but returns a value which is not explicitly
tied to the lifetime of self
. Read more
fn as_tcp_listener_view(&self) -> View<'_, TcpListener>
[src]
fn as_tcp_listener_view(&self) -> View<'_, TcpListener>
[src]Utility for returning a value which dereferences to a &TcpListener
or
&mut TcpListener
. Read more
unsafe fn as_unscoped_tcp_listener_view(&self) -> View<'static, TcpListener>
[src]
unsafe fn as_unscoped_tcp_listener_view(&self) -> View<'static, TcpListener>
[src]Like as_tcp_listener_view
, but returns a value which is not
explicitly tied to the lifetime of self
. Read more
fn as_udp_socket_view(&self) -> View<'_, UdpSocket>
[src]
fn as_udp_socket_view(&self) -> View<'_, UdpSocket>
[src]Utility for returning a value which dereferences to a &UdpSocket
or
&mut UdpSocket
. Read more
unsafe fn as_unscoped_udp_socket_view(&self) -> View<'static, UdpSocket>
[src]
unsafe fn as_unscoped_udp_socket_view(&self) -> View<'static, UdpSocket>
[src]Like as_udp_socket_view
, but returns a value which is not explicitly
tied to the lifetime of self
. Read more
fn as_unix_stream_view(&self) -> View<'_, UnixStream>
[src]
fn as_unix_stream_view(&self) -> View<'_, UnixStream>
[src]Utility for returning a value which dereferences to a &UnixStream
or
&mut UnixStream
. Read more
unsafe fn as_unscoped_unix_stream_view(&self) -> View<'static, UnixStream>
[src]
unsafe fn as_unscoped_unix_stream_view(&self) -> View<'static, UnixStream>
[src]Like as_unix_stream_view
, but returns a value which is not explicitly
tied to the lifetime of self
. Read more
impl<R> AsyncReadExt for R where
R: AsyncRead + ?Sized,
impl<R> AsyncReadExt for R where
R: AsyncRead + ?Sized,
fn read(&'a mut self, buf: &'a mut [u8]) -> ReadFuture<'a, Self> where
Self: Unpin,
fn read(&'a mut self, buf: &'a mut [u8]) -> ReadFuture<'a, Self> where
Self: Unpin,
Reads some bytes from the byte stream. Read more
fn read_vectored(
&'a mut self,
bufs: &'a mut [IoSliceMut<'a>]
) -> ReadVectoredFuture<'a, Self> where
Self: Unpin,
fn read_vectored(
&'a mut self,
bufs: &'a mut [IoSliceMut<'a>]
) -> ReadVectoredFuture<'a, Self> where
Self: Unpin,
Like [read()
][AsyncReadExt::read()
], except it reads into a slice of buffers. Read more
fn read_to_end(
&'a mut self,
buf: &'a mut Vec<u8, Global>
) -> ReadToEndFuture<'a, Self> where
Self: Unpin,
fn read_to_end(
&'a mut self,
buf: &'a mut Vec<u8, Global>
) -> ReadToEndFuture<'a, Self> where
Self: Unpin,
fn read_to_string(
&'a mut self,
buf: &'a mut String
) -> ReadToStringFuture<'a, Self> where
Self: Unpin,
fn read_to_string(
&'a mut self,
buf: &'a mut String
) -> ReadToStringFuture<'a, Self> where
Self: Unpin,
fn read_exact(&'a mut self, buf: &'a mut [u8]) -> ReadExactFuture<'a, Self> where
Self: Unpin,
fn read_exact(&'a mut self, buf: &'a mut [u8]) -> ReadExactFuture<'a, Self> where
Self: Unpin,
Reads the exact number of bytes required to fill buf
. Read more
fn take(self, limit: u64) -> Take<Self>
fn take(self, limit: u64) -> Take<Self>
Creates an adapter which will read at most limit
bytes from it. Read more
impl<S> AsyncSeekExt for S where
S: AsyncSeek + ?Sized,
impl<S> AsyncSeekExt for S where
S: AsyncSeek + ?Sized,
impl<W> AsyncWriteExt for W where
W: AsyncWrite + ?Sized,
impl<W> AsyncWriteExt for W where
W: AsyncWrite + ?Sized,
fn write(&'a mut self, buf: &'a [u8]) -> WriteFuture<'a, Self> where
Self: Unpin,
fn write(&'a mut self, buf: &'a [u8]) -> WriteFuture<'a, Self> where
Self: Unpin,
Writes some bytes into the byte stream. Read more
fn write_vectored(
&'a mut self,
bufs: &'a [IoSlice<'a>]
) -> WriteVectoredFuture<'a, Self> where
Self: Unpin,
fn write_vectored(
&'a mut self,
bufs: &'a [IoSlice<'a>]
) -> WriteVectoredFuture<'a, Self> where
Self: Unpin,
Like [write()
][AsyncWriteExt::write()
], except that it writes a slice of buffers. Read more
fn write_all(&'a mut self, buf: &'a [u8]) -> WriteAllFuture<'a, Self> where
Self: Unpin,
fn write_all(&'a mut self, buf: &'a [u8]) -> WriteAllFuture<'a, Self> where
Self: Unpin,
Writes an entire buffer into the byte stream. Read more
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> FromUnsafeFile for T where
T: FromRawFd + OwnsRaw,
[src]
impl<T> FromUnsafeFile for T where
T: FromRawFd + OwnsRaw,
[src]pub unsafe fn from_unsafe_file(unsafe_file: UnsafeFile) -> T
[src]
pub unsafe fn from_unsafe_file(unsafe_file: UnsafeFile) -> T
[src]Convert an unsafe file into a Self
. Read more
fn from_filelike<Filelike>(filelike: Filelike) -> Self where
Filelike: IntoUnsafeFile,
[src]
fn from_filelike<Filelike>(filelike: Filelike) -> Self where
Filelike: IntoUnsafeFile,
[src]Convert from a type which implements IntoUnsafeFile
into a type that
implements FromUnsafeFile
. Read more
impl<T> FromUnsafeSocket for T where
T: FromRawFd + OwnsRaw,
[src]
impl<T> FromUnsafeSocket for T where
T: FromRawFd + OwnsRaw,
[src]pub unsafe fn from_unsafe_socket(unsafe_socket: UnsafeSocket) -> T
[src]
pub unsafe fn from_unsafe_socket(unsafe_socket: UnsafeSocket) -> T
[src]Convert an unsafe socket into a Self
. Read more
fn from_socketlike<Socketlike>(socketlike: Socketlike) -> Self where
Socketlike: IntoUnsafeSocket,
[src]
fn from_socketlike<Socketlike>(socketlike: Socketlike) -> Self where
Socketlike: IntoUnsafeSocket,
[src]Convert from a type which implements IntoUnsafeSocket
into a type
that implements FromUnsafeSocket
. Read more
impl<T> IntoUnsafeFile for T where
T: IntoRawFd + OwnsRaw,
[src]
impl<T> IntoUnsafeFile for T where
T: IntoRawFd + OwnsRaw,
[src]pub fn into_unsafe_file(self) -> UnsafeFile
[src]
pub fn into_unsafe_file(self) -> UnsafeFile
[src]Convert self
into an unsafe file.
impl<T> IntoUnsafeHandle for T where
T: IntoRawFd + OwnsRaw,
[src]
impl<T> IntoUnsafeHandle for T where
T: IntoRawFd + OwnsRaw,
[src]pub fn into_unsafe_handle(self) -> UnsafeHandle
[src]
pub fn into_unsafe_handle(self) -> UnsafeHandle
[src]Convert self
into an unsafe handle.
impl<T> IntoUnsafeSocket for T where
T: IntoRawFd + OwnsRaw,
[src]
impl<T> IntoUnsafeSocket for T where
T: IntoRawFd + OwnsRaw,
[src]pub fn into_unsafe_socket(self) -> UnsafeSocket
[src]
pub fn into_unsafe_socket(self) -> UnsafeSocket
[src]Convert self
into an unsafe socket.
impl<T> ReadExt for T where
T: AsyncRead + ?Sized,
[src]
impl<T> ReadExt for T where
T: AsyncRead + ?Sized,
[src]fn read(&'a mut self, buf: &'a mut [u8]) -> ReadFuture<'a, Self> where
Self: Unpin,
[src]
fn read(&'a mut self, buf: &'a mut [u8]) -> ReadFuture<'a, Self> where
Self: Unpin,
[src]Reads some bytes from the byte stream. Read more
fn read_vectored(
&'a mut self,
bufs: &'a mut [IoSliceMut<'a>]
) -> ReadVectoredFuture<'a, Self> where
Self: Unpin,
[src]
fn read_vectored(
&'a mut self,
bufs: &'a mut [IoSliceMut<'a>]
) -> ReadVectoredFuture<'a, Self> where
Self: Unpin,
[src]fn read_to_end(
&'a mut self,
buf: &'a mut Vec<u8, Global>
) -> ReadToEndFuture<'a, Self> where
Self: Unpin,
[src]
fn read_to_end(
&'a mut self,
buf: &'a mut Vec<u8, Global>
) -> ReadToEndFuture<'a, Self> where
Self: Unpin,
[src]Reads all bytes from the byte stream. Read more
fn read_to_string(
&'a mut self,
buf: &'a mut String
) -> ReadToStringFuture<'a, Self> where
Self: Unpin,
[src]
fn read_to_string(
&'a mut self,
buf: &'a mut String
) -> ReadToStringFuture<'a, Self> where
Self: Unpin,
[src]Reads all bytes from the byte stream and appends them into a string. Read more
fn read_exact(&'a mut self, buf: &'a mut [u8]) -> ReadExactFuture<'a, Self> where
Self: Unpin,
[src]
fn read_exact(&'a mut self, buf: &'a mut [u8]) -> ReadExactFuture<'a, Self> where
Self: Unpin,
[src]Reads the exact number of bytes required to fill buf
. Read more
fn take(self, limit: u64) -> Take<Self>
[src]
fn take(self, limit: u64) -> Take<Self>
[src]Creates an adaptor which will read at most limit
bytes from it. Read more
fn by_ref(&mut self) -> &mut Self
[src]
fn by_ref(&mut self) -> &mut Self
[src]Creates a “by reference” adaptor for this instance of Read
. Read more
impl<T> SetTimes for T where
T: AsUnsafeFile,
impl<T> SetTimes for T where
T: AsUnsafeFile,
impl<T> WriteExt for T where
T: AsyncWrite + ?Sized,
[src]
impl<T> WriteExt for T where
T: AsyncWrite + ?Sized,
[src]fn write(&'a mut self, buf: &'a [u8]) -> WriteFuture<'a, Self> where
Self: Unpin,
[src]
fn write(&'a mut self, buf: &'a [u8]) -> WriteFuture<'a, Self> where
Self: Unpin,
[src]Writes some bytes into the byte stream. Read more
fn flush(&mut self) -> FlushFuture<'_, Self> where
Self: Unpin,
[src]
fn flush(&mut self) -> FlushFuture<'_, Self> where
Self: Unpin,
[src]Flushes the stream to ensure that all buffered contents reach their destination. Read more
fn write_vectored(
&'a mut self,
bufs: &'a [IoSlice<'a>]
) -> WriteVectoredFuture<'a, Self> where
Self: Unpin,
[src]
fn write_vectored(
&'a mut self,
bufs: &'a [IoSlice<'a>]
) -> WriteVectoredFuture<'a, Self> where
Self: Unpin,
[src]