pub struct File { /* private fields */ }
Expand description
A reference to an open file on the filesystem.
This is a specialized version of std::fs::File
for usage from the
Tokio runtime.
An instance of a File
can be read and/or written depending on what options
it was opened with. Files also implement Seek to alter the logical cursor
that the file contains internally.
Files are automatically closed when they go out of scope.
Examples
Create a new file and asynchronously write bytes to it:
extern crate tokio;
use tokio::prelude::{AsyncWrite, Future};
fn main() {
let task = tokio::fs::File::create("foo.txt")
.and_then(|mut file| file.poll_write(b"hello, world!"))
.map(|res| {
println!("{:?}", res);
}).map_err(|err| eprintln!("IO error: {:?}", err));
tokio::run(task);
}
Read the contents of a file into a buffer
extern crate tokio;
use tokio::prelude::{AsyncRead, Future};
fn main() {
let task = tokio::fs::File::open("foo.txt")
.and_then(|mut file| {
let mut contents = vec![];
file.read_buf(&mut contents)
.map(|res| {
println!("{:?}", res);
})
}).map_err(|err| eprintln!("IO error: {:?}", err));
tokio::run(task);
}
Implementations
sourceimpl File
impl File
sourcepub fn open<P>(path: P) -> OpenFuture<P> where
P: AsRef<Path> + Send + 'static,
pub fn open<P>(path: P) -> OpenFuture<P> where
P: AsRef<Path> + Send + 'static,
Attempts to open a file in read-only mode.
See OpenOptions
for more details.
Errors
OpenFuture
results in an error if called from outside of the Tokio
runtime or if the underlying open
call results in an error.
Examples
use tokio::prelude::Future;
fn main() {
let task = tokio::fs::File::open("foo.txt").and_then(|file| {
// do something with the file ...
file.metadata().map(|md| println!("{:?}", md))
}).map_err(|e| {
// handle errors
eprintln!("IO error: {:?}", e);
});
tokio::run(task);
}
sourcepub fn create<P>(path: P) -> CreateFuture<P> where
P: AsRef<Path> + Send + 'static,
pub fn create<P>(path: P) -> CreateFuture<P> where
P: AsRef<Path> + Send + 'static,
Opens a file in write-only mode.
This function will create a file if it does not exist, and will truncate it if it does.
See OpenOptions
for more details.
Errors
CreateFuture
results in an error if called from outside of the Tokio
runtime or if the underlying create
call results in an error.
Examples
use tokio::prelude::Future;
fn main() {
let task = tokio::fs::File::create("foo.txt")
.and_then(|file| {
// do something with the created file ...
file.metadata().map(|md| println!("{:?}", md))
}).map_err(|e| {
// handle errors
eprintln!("IO error: {:?}", e);
});
tokio::run(task);
}
sourcepub fn from_std(std: StdFile) -> FileⓘNotable traits for Fileimpl Read for Fileimpl Write for File
pub fn from_std(std: StdFile) -> FileⓘNotable traits for Fileimpl Read for Fileimpl Write for File
Convert a std::fs::File
to a tokio_fs::File
.
Examples
use std::fs::File;
fn main() {
let std_file = File::open("foo.txt").unwrap();
let file = tokio::fs::File::from_std(std_file);
}
sourcepub fn poll_seek(&mut self, pos: SeekFrom) -> Poll<u64, Error>
pub fn poll_seek(&mut self, pos: SeekFrom) -> Poll<u64, Error>
Seek to an offset, in bytes, in a stream.
A seek beyond the end of a stream is allowed, but implementation defined.
If the seek operation completed successfully, this method returns the
new position from the start of the stream. That position can be used
later with SeekFrom::Start
.
Errors
Seeking to a negative offset is considered an error.
Examples
use tokio::prelude::Future;
use std::io::SeekFrom;
fn main() {
let task = tokio::fs::File::open("foo.txt")
// move cursor 6 bytes from the start of the file
.and_then(|mut file| file.poll_seek(SeekFrom::Start(6)))
.map(|res| {
println!("{:?}", res);
}).map_err(|err| eprintln!("IO error: {:?}", err));
tokio::run(task);
}
sourcepub fn seek(self, pos: SeekFrom) -> SeekFuture
pub fn seek(self, pos: SeekFrom) -> SeekFuture
Seek to an offset, in bytes, in a stream.
Similar to poll_seek
, but returning a Future
.
This method consumes the File
and returns it back when the future
completes.
Examples
use tokio::prelude::Future;
use std::io::SeekFrom;
fn main() {
let task = tokio::fs::File::create("foo.txt")
.and_then(|file| file.seek(SeekFrom::Start(6)))
.map(|file| {
// handle returned file ..
}).map_err(|err| eprintln!("IO error: {:?}", err));
tokio::run(task);
}
sourcepub fn poll_sync_all(&mut self) -> Poll<(), Error>
pub fn poll_sync_all(&mut self) -> Poll<(), Error>
Attempts to sync all OS-internal metadata to disk.
This function will attempt to ensure that all in-core data reaches the filesystem before returning.
Examples
use tokio::prelude::{AsyncWrite, Future};
fn main() {
let task = tokio::fs::File::create("foo.txt")
.and_then(|mut file| {
file.poll_write(b"hello, world!")?;
file.poll_sync_all()
})
.map(|res| {
// handle returned result ..
}).map_err(|err| eprintln!("IO error: {:?}", err));
tokio::run(task);
}
sourcepub fn poll_sync_data(&mut self) -> Poll<(), Error>
pub fn poll_sync_data(&mut self) -> Poll<(), Error>
This function is similar to poll_sync_all
, except that it may not
synchronize file metadata to the filesystem.
This is intended for use cases that must synchronize content, but don’t need the metadata on disk. The goal of this method is to reduce disk operations.
Note that some platforms may simply implement this in terms of poll_sync_all
.
Examples
use tokio::prelude::{AsyncWrite, Future};
fn main() {
let task = tokio::fs::File::create("foo.txt")
.and_then(|mut file| {
file.poll_write(b"hello, world!")?;
file.poll_sync_data()
})
.map(|res| {
// handle returned result ..
}).map_err(|err| eprintln!("IO error: {:?}", err));
tokio::run(task);
}
sourcepub fn poll_set_len(&mut self, size: u64) -> Poll<(), Error>
pub fn poll_set_len(&mut self, size: u64) -> Poll<(), Error>
Truncates or extends the underlying file, updating the size of this file to become size.
If the size is less than the current file’s size, then the file will be shrunk. If it is greater than the current file’s size, then the file will be extended to size and have all of the intermediate data filled in with 0s.
Errors
This function will return an error if the file is not opened for writing.
Examples
use tokio::prelude::Future;
fn main() {
let task = tokio::fs::File::create("foo.txt")
.and_then(|mut file| {
file.poll_set_len(10)
})
.map(|res| {
// handle returned result ..
}).map_err(|err| eprintln!("IO error: {:?}", err));
tokio::run(task);
}
sourcepub fn metadata(self) -> MetadataFuture
pub fn metadata(self) -> MetadataFuture
Queries metadata about the underlying file.
Examples
use tokio::prelude::Future;
fn main() {
let task = tokio::fs::File::create("foo.txt")
.and_then(|file| file.metadata())
.map(|metadata| {
println!("{:?}", metadata);
}).map_err(|err| eprintln!("IO error: {:?}", err));
tokio::run(task);
}
sourcepub fn poll_metadata(&mut self) -> Poll<Metadata, Error>
pub fn poll_metadata(&mut self) -> Poll<Metadata, Error>
Queries metadata about the underlying file.
Examples
use tokio::prelude::Future;
fn main() {
let task = tokio::fs::File::create("foo.txt")
.and_then(|mut file| file.poll_metadata())
.map(|metadata| {
// metadata is of type Async::Ready<Metadata>
println!("{:?}", metadata);
}).map_err(|err| eprintln!("IO error: {:?}", err));
tokio::run(task);
}
sourcepub fn poll_try_clone(&mut self) -> Poll<File, Error>
pub fn poll_try_clone(&mut self) -> Poll<File, Error>
Create a new File
instance that shares the same underlying file handle
as the existing File
instance. Reads, writes, and seeks will affect both
File instances simultaneously.
Examples
use tokio::prelude::Future;
fn main() {
let task = tokio::fs::File::create("foo.txt")
.and_then(|mut file| file.poll_try_clone())
.map(|clone| {
// do something with the clone
}).map_err(|err| eprintln!("IO error: {:?}", err));
tokio::run(task);
}
sourcepub fn try_clone(self) -> CloneFuture
pub fn try_clone(self) -> CloneFuture
Create a new File
instance that shares the same underlying file handle
as the existing File
instance. Reads, writes, and seeks will affect both
File instances simultaneously.
Examples
use tokio::prelude::Future;
fn main() {
let task = tokio::fs::File::create("foo.txt")
.and_then(|file| {
file.try_clone()
.map(|(file, clone)| {
// do something with the file and the clone
})
.map_err(|(file, err)| {
// you get the original file back if there's an error
err
})
})
.map_err(|err| eprintln!("IO error: {:?}", err));
tokio::run(task);
}
sourcepub fn poll_set_permissions(&mut self, perm: Permissions) -> Poll<(), Error>
pub fn poll_set_permissions(&mut self, perm: Permissions) -> Poll<(), Error>
Changes the permissions on the underlying file.
Platform-specific behavior
This function currently corresponds to the fchmod
function on Unix and
the SetFileInformationByHandle
function on Windows. Note that, this
may change in the future.
Errors
This function will return an error if the user lacks permission change attributes on the underlying file. It may also return an error in other os-specific unspecified cases.
Examples
use tokio::prelude::Future;
fn main() {
let task = tokio::fs::File::create("foo.txt")
.and_then(|file| file.metadata())
.map(|(mut file, metadata)| {
let mut perms = metadata.permissions();
perms.set_readonly(true);
match file.poll_set_permissions(perms) {
Err(e) => eprintln!("{}", e),
_ => println!("permissions set!"),
}
}).map_err(|err| eprintln!("IO error: {:?}", err));
tokio::run(task);
}
sourcepub fn into_std(self) -> StdFile
pub fn into_std(self) -> StdFile
Destructures the tokio_fs::File
into a std::fs::File
.
Panics
This function will panic if shutdown
has been called.
Examples
use tokio::prelude::Future;
fn main() {
let task = tokio::fs::File::create("foo.txt")
.map(|file| {
let std_file = file.into_std();
// do something with the std::fs::File
}).map_err(|err| eprintln!("IO error: {:?}", err));
tokio::run(task);
}
Trait Implementations
sourceimpl AsyncRead for File
impl AsyncRead for File
sourceunsafe fn prepare_uninitialized_buffer(&self, _: &mut [u8]) -> bool
unsafe fn prepare_uninitialized_buffer(&self, _: &mut [u8]) -> bool
Prepares an uninitialized buffer to be safe to pass to read
. Returns
true
if the supplied buffer was zeroed out. Read more
sourcefn poll_read(&mut self, buf: &mut [u8]) -> Result<Async<usize>, Error>
fn poll_read(&mut self, buf: &mut [u8]) -> Result<Async<usize>, Error>
Attempt to read from the AsyncRead
into buf
. Read more
sourcefn read_buf<B>(&mut self, buf: &mut B) -> Result<Async<usize>, Error> where
B: BufMut,
fn read_buf<B>(&mut self, buf: &mut B) -> Result<Async<usize>, Error> where
B: BufMut,
Pull some bytes from this source into the specified BufMut
, returning
how many bytes were read. Read more
sourcefn framed<T>(self, codec: T) -> Framed<Self, T> where
T: Encoder + Decoder,
Self: AsyncWrite,
fn framed<T>(self, codec: T) -> Framed<Self, T> where
T: Encoder + Decoder,
Self: AsyncWrite,
Use tokio_codec::Decoder::framed instead
Provides a Stream
and Sink
interface for reading and writing to this
I/O object, using Decode
and Encode
to read and write the raw data. Read more
sourceimpl AsyncWrite for File
impl AsyncWrite for File
sourcefn shutdown(&mut self) -> Poll<(), Error>
fn shutdown(&mut self) -> Poll<(), Error>
Initiates or attempts to shut down this writer, returning success when the I/O connection has completely shut down. Read more
sourcefn poll_write(&mut self, buf: &[u8]) -> Result<Async<usize>, Error>
fn poll_write(&mut self, buf: &[u8]) -> Result<Async<usize>, Error>
Attempt to write bytes from buf
into the object. Read more
sourceimpl Read for File
impl Read for File
sourcefn read(&mut self, buf: &mut [u8]) -> Result<usize>
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more
1.36.0 · sourcefn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
Like read
, except that it reads into a slice of buffers. Read more
sourcefn is_read_vectored(&self) -> bool
fn is_read_vectored(&self) -> bool
can_vector
)Determines if this Read
er has an efficient read_vectored
implementation. Read more
1.0.0 · sourcefn read_to_end(&mut self, buf: &mut Vec<u8, Global>) -> Result<usize, Error>
fn read_to_end(&mut self, buf: &mut Vec<u8, Global>) -> Result<usize, Error>
Read all bytes until EOF in this source, placing them into buf
. Read more
1.0.0 · sourcefn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
Read all bytes until EOF in this source, appending them to buf
. Read more
1.6.0 · sourcefn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
Read the exact number of bytes required to fill buf
. Read more
sourcefn read_buf(&mut self, buf: &mut ReadBuf<'_>) -> Result<(), Error>
fn read_buf(&mut self, buf: &mut ReadBuf<'_>) -> Result<(), Error>
read_buf
)Pull some bytes from this source into the specified buffer. Read more
sourcefn read_buf_exact(&mut self, buf: &mut ReadBuf<'_>) -> Result<(), Error>
fn read_buf_exact(&mut self, buf: &mut ReadBuf<'_>) -> Result<(), Error>
read_buf
)Read the exact number of bytes required to fill buf
. Read more
1.0.0 · sourcefn by_ref(&mut self) -> &mut Self
fn by_ref(&mut self) -> &mut Self
Creates a “by reference” adaptor for this instance of Read
. Read more
sourceimpl Write for File
impl Write for File
sourcefn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Write a buffer into this writer, returning how many bytes were written. Read more
sourcefn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
sourcefn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
can_vector
)Determines if this Write
r has an efficient write_vectored
implementation. Read more
1.0.0 · sourcefn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Attempts to write an entire buffer into this writer. Read more
sourcefn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
write_all_vectored
)Attempts to write multiple buffers into this writer. Read more
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<R> ReadBytesExt for R where
R: Read + ?Sized,
impl<R> ReadBytesExt for R where
R: Read + ?Sized,
sourcefn read_u8(&mut self) -> Result<u8, Error>
fn read_u8(&mut self) -> Result<u8, Error>
Reads an unsigned 8 bit integer from the underlying reader. Read more
sourcefn read_i8(&mut self) -> Result<i8, Error>
fn read_i8(&mut self) -> Result<i8, Error>
Reads a signed 8 bit integer from the underlying reader. Read more
sourcefn read_u16<T>(&mut self) -> Result<u16, Error> where
T: ByteOrder,
fn read_u16<T>(&mut self) -> Result<u16, Error> where
T: ByteOrder,
Reads an unsigned 16 bit integer from the underlying reader. Read more
sourcefn read_i16<T>(&mut self) -> Result<i16, Error> where
T: ByteOrder,
fn read_i16<T>(&mut self) -> Result<i16, Error> where
T: ByteOrder,
Reads a signed 16 bit integer from the underlying reader. Read more
sourcefn read_u24<T>(&mut self) -> Result<u32, Error> where
T: ByteOrder,
fn read_u24<T>(&mut self) -> Result<u32, Error> where
T: ByteOrder,
Reads an unsigned 24 bit integer from the underlying reader. Read more
sourcefn read_i24<T>(&mut self) -> Result<i32, Error> where
T: ByteOrder,
fn read_i24<T>(&mut self) -> Result<i32, Error> where
T: ByteOrder,
Reads a signed 24 bit integer from the underlying reader. Read more
sourcefn read_u32<T>(&mut self) -> Result<u32, Error> where
T: ByteOrder,
fn read_u32<T>(&mut self) -> Result<u32, Error> where
T: ByteOrder,
Reads an unsigned 32 bit integer from the underlying reader. Read more
sourcefn read_i32<T>(&mut self) -> Result<i32, Error> where
T: ByteOrder,
fn read_i32<T>(&mut self) -> Result<i32, Error> where
T: ByteOrder,
Reads a signed 32 bit integer from the underlying reader. Read more
sourcefn read_u48<T>(&mut self) -> Result<u64, Error> where
T: ByteOrder,
fn read_u48<T>(&mut self) -> Result<u64, Error> where
T: ByteOrder,
Reads an unsigned 48 bit integer from the underlying reader. Read more
sourcefn read_i48<T>(&mut self) -> Result<i64, Error> where
T: ByteOrder,
fn read_i48<T>(&mut self) -> Result<i64, Error> where
T: ByteOrder,
Reads a signed 48 bit integer from the underlying reader. Read more
sourcefn read_u64<T>(&mut self) -> Result<u64, Error> where
T: ByteOrder,
fn read_u64<T>(&mut self) -> Result<u64, Error> where
T: ByteOrder,
Reads an unsigned 64 bit integer from the underlying reader. Read more
sourcefn read_i64<T>(&mut self) -> Result<i64, Error> where
T: ByteOrder,
fn read_i64<T>(&mut self) -> Result<i64, Error> where
T: ByteOrder,
Reads a signed 64 bit integer from the underlying reader. Read more
sourcefn read_u128<T>(&mut self) -> Result<u128, Error> where
T: ByteOrder,
fn read_u128<T>(&mut self) -> Result<u128, Error> where
T: ByteOrder,
Reads an unsigned 128 bit integer from the underlying reader. Read more
sourcefn read_i128<T>(&mut self) -> Result<i128, Error> where
T: ByteOrder,
fn read_i128<T>(&mut self) -> Result<i128, Error> where
T: ByteOrder,
Reads a signed 128 bit integer from the underlying reader. Read more
sourcefn read_uint<T>(&mut self, nbytes: usize) -> Result<u64, Error> where
T: ByteOrder,
fn read_uint<T>(&mut self, nbytes: usize) -> Result<u64, Error> where
T: ByteOrder,
Reads an unsigned n-bytes integer from the underlying reader. Read more
sourcefn read_int<T>(&mut self, nbytes: usize) -> Result<i64, Error> where
T: ByteOrder,
fn read_int<T>(&mut self, nbytes: usize) -> Result<i64, Error> where
T: ByteOrder,
Reads a signed n-bytes integer from the underlying reader. Read more
sourcefn read_uint128<T>(&mut self, nbytes: usize) -> Result<u128, Error> where
T: ByteOrder,
fn read_uint128<T>(&mut self, nbytes: usize) -> Result<u128, Error> where
T: ByteOrder,
Reads an unsigned n-bytes integer from the underlying reader.
sourcefn read_int128<T>(&mut self, nbytes: usize) -> Result<i128, Error> where
T: ByteOrder,
fn read_int128<T>(&mut self, nbytes: usize) -> Result<i128, Error> where
T: ByteOrder,
Reads a signed n-bytes integer from the underlying reader.
sourcefn read_f32<T>(&mut self) -> Result<f32, Error> where
T: ByteOrder,
fn read_f32<T>(&mut self) -> Result<f32, Error> where
T: ByteOrder,
Reads a IEEE754 single-precision (4 bytes) floating point number from the underlying reader. Read more
sourcefn read_f64<T>(&mut self) -> Result<f64, Error> where
T: ByteOrder,
fn read_f64<T>(&mut self) -> Result<f64, Error> where
T: ByteOrder,
Reads a IEEE754 double-precision (8 bytes) floating point number from the underlying reader. Read more
sourcefn read_u16_into<T>(&mut self, dst: &mut [u16]) -> Result<(), Error> where
T: ByteOrder,
fn read_u16_into<T>(&mut self, dst: &mut [u16]) -> Result<(), Error> where
T: ByteOrder,
Reads a sequence of unsigned 16 bit integers from the underlying reader. Read more
sourcefn read_u32_into<T>(&mut self, dst: &mut [u32]) -> Result<(), Error> where
T: ByteOrder,
fn read_u32_into<T>(&mut self, dst: &mut [u32]) -> Result<(), Error> where
T: ByteOrder,
Reads a sequence of unsigned 32 bit integers from the underlying reader. Read more
sourcefn read_u64_into<T>(&mut self, dst: &mut [u64]) -> Result<(), Error> where
T: ByteOrder,
fn read_u64_into<T>(&mut self, dst: &mut [u64]) -> Result<(), Error> where
T: ByteOrder,
Reads a sequence of unsigned 64 bit integers from the underlying reader. Read more
sourcefn read_u128_into<T>(&mut self, dst: &mut [u128]) -> Result<(), Error> where
T: ByteOrder,
fn read_u128_into<T>(&mut self, dst: &mut [u128]) -> Result<(), Error> where
T: ByteOrder,
Reads a sequence of unsigned 128 bit integers from the underlying reader. Read more
sourcefn read_i8_into(&mut self, dst: &mut [i8]) -> Result<(), Error>
fn read_i8_into(&mut self, dst: &mut [i8]) -> Result<(), Error>
Reads a sequence of signed 8 bit integers from the underlying reader. Read more
sourcefn read_i16_into<T>(&mut self, dst: &mut [i16]) -> Result<(), Error> where
T: ByteOrder,
fn read_i16_into<T>(&mut self, dst: &mut [i16]) -> Result<(), Error> where
T: ByteOrder,
Reads a sequence of signed 16 bit integers from the underlying reader. Read more
sourcefn read_i32_into<T>(&mut self, dst: &mut [i32]) -> Result<(), Error> where
T: ByteOrder,
fn read_i32_into<T>(&mut self, dst: &mut [i32]) -> Result<(), Error> where
T: ByteOrder,
Reads a sequence of signed 32 bit integers from the underlying reader. Read more
sourcefn read_i64_into<T>(&mut self, dst: &mut [i64]) -> Result<(), Error> where
T: ByteOrder,
fn read_i64_into<T>(&mut self, dst: &mut [i64]) -> Result<(), Error> where
T: ByteOrder,
Reads a sequence of signed 64 bit integers from the underlying reader. Read more
sourcefn read_i128_into<T>(&mut self, dst: &mut [i128]) -> Result<(), Error> where
T: ByteOrder,
fn read_i128_into<T>(&mut self, dst: &mut [i128]) -> Result<(), Error> where
T: ByteOrder,
Reads a sequence of signed 128 bit integers from the underlying reader. Read more
sourcefn read_f32_into<T>(&mut self, dst: &mut [f32]) -> Result<(), Error> where
T: ByteOrder,
fn read_f32_into<T>(&mut self, dst: &mut [f32]) -> Result<(), Error> where
T: ByteOrder,
Reads a sequence of IEEE754 single-precision (4 bytes) floating point numbers from the underlying reader. Read more
sourcefn read_f32_into_unchecked<T>(&mut self, dst: &mut [f32]) -> Result<(), Error> where
T: ByteOrder,
fn read_f32_into_unchecked<T>(&mut self, dst: &mut [f32]) -> Result<(), Error> where
T: ByteOrder,
please use read_f32_into
instead
DEPRECATED. Read more
sourceimpl<W> WriteBytesExt for W where
W: Write + ?Sized,
impl<W> WriteBytesExt for W where
W: Write + ?Sized,
sourcefn write_u8(&mut self, n: u8) -> Result<(), Error>
fn write_u8(&mut self, n: u8) -> Result<(), Error>
Writes an unsigned 8 bit integer to the underlying writer. Read more
sourcefn write_i8(&mut self, n: i8) -> Result<(), Error>
fn write_i8(&mut self, n: i8) -> Result<(), Error>
Writes a signed 8 bit integer to the underlying writer. Read more
sourcefn write_u16<T>(&mut self, n: u16) -> Result<(), Error> where
T: ByteOrder,
fn write_u16<T>(&mut self, n: u16) -> Result<(), Error> where
T: ByteOrder,
Writes an unsigned 16 bit integer to the underlying writer. Read more
sourcefn write_i16<T>(&mut self, n: i16) -> Result<(), Error> where
T: ByteOrder,
fn write_i16<T>(&mut self, n: i16) -> Result<(), Error> where
T: ByteOrder,
Writes a signed 16 bit integer to the underlying writer. Read more
sourcefn write_u24<T>(&mut self, n: u32) -> Result<(), Error> where
T: ByteOrder,
fn write_u24<T>(&mut self, n: u32) -> Result<(), Error> where
T: ByteOrder,
Writes an unsigned 24 bit integer to the underlying writer. Read more
sourcefn write_i24<T>(&mut self, n: i32) -> Result<(), Error> where
T: ByteOrder,
fn write_i24<T>(&mut self, n: i32) -> Result<(), Error> where
T: ByteOrder,
Writes a signed 24 bit integer to the underlying writer. Read more
sourcefn write_u32<T>(&mut self, n: u32) -> Result<(), Error> where
T: ByteOrder,
fn write_u32<T>(&mut self, n: u32) -> Result<(), Error> where
T: ByteOrder,
Writes an unsigned 32 bit integer to the underlying writer. Read more
sourcefn write_i32<T>(&mut self, n: i32) -> Result<(), Error> where
T: ByteOrder,
fn write_i32<T>(&mut self, n: i32) -> Result<(), Error> where
T: ByteOrder,
Writes a signed 32 bit integer to the underlying writer. Read more
sourcefn write_u48<T>(&mut self, n: u64) -> Result<(), Error> where
T: ByteOrder,
fn write_u48<T>(&mut self, n: u64) -> Result<(), Error> where
T: ByteOrder,
Writes an unsigned 48 bit integer to the underlying writer. Read more
sourcefn write_i48<T>(&mut self, n: i64) -> Result<(), Error> where
T: ByteOrder,
fn write_i48<T>(&mut self, n: i64) -> Result<(), Error> where
T: ByteOrder,
Writes a signed 48 bit integer to the underlying writer. Read more
sourcefn write_u64<T>(&mut self, n: u64) -> Result<(), Error> where
T: ByteOrder,
fn write_u64<T>(&mut self, n: u64) -> Result<(), Error> where
T: ByteOrder,
Writes an unsigned 64 bit integer to the underlying writer. Read more
sourcefn write_i64<T>(&mut self, n: i64) -> Result<(), Error> where
T: ByteOrder,
fn write_i64<T>(&mut self, n: i64) -> Result<(), Error> where
T: ByteOrder,
Writes a signed 64 bit integer to the underlying writer. Read more
sourcefn write_u128<T>(&mut self, n: u128) -> Result<(), Error> where
T: ByteOrder,
fn write_u128<T>(&mut self, n: u128) -> Result<(), Error> where
T: ByteOrder,
Writes an unsigned 128 bit integer to the underlying writer.
sourcefn write_i128<T>(&mut self, n: i128) -> Result<(), Error> where
T: ByteOrder,
fn write_i128<T>(&mut self, n: i128) -> Result<(), Error> where
T: ByteOrder,
Writes a signed 128 bit integer to the underlying writer.
sourcefn write_uint<T>(&mut self, n: u64, nbytes: usize) -> Result<(), Error> where
T: ByteOrder,
fn write_uint<T>(&mut self, n: u64, nbytes: usize) -> Result<(), Error> where
T: ByteOrder,
Writes an unsigned n-bytes integer to the underlying writer. Read more
sourcefn write_int<T>(&mut self, n: i64, nbytes: usize) -> Result<(), Error> where
T: ByteOrder,
fn write_int<T>(&mut self, n: i64, nbytes: usize) -> Result<(), Error> where
T: ByteOrder,
Writes a signed n-bytes integer to the underlying writer. Read more
sourcefn write_uint128<T>(&mut self, n: u128, nbytes: usize) -> Result<(), Error> where
T: ByteOrder,
fn write_uint128<T>(&mut self, n: u128, nbytes: usize) -> Result<(), Error> where
T: ByteOrder,
Writes an unsigned n-bytes integer to the underlying writer. Read more
sourcefn write_int128<T>(&mut self, n: i128, nbytes: usize) -> Result<(), Error> where
T: ByteOrder,
fn write_int128<T>(&mut self, n: i128, nbytes: usize) -> Result<(), Error> where
T: ByteOrder,
Writes a signed n-bytes integer to the underlying writer. Read more