Struct std::io::Empty
始终处于 EOF 的 reader。
通常通过调用 empty() 来创建此结构体。 请参见 empty() 的文档以获取更多详细信息。
rust
#[non_exhaustive]
pub struct Empty;Trait Implementations
impl BufRead for Empty
fill_buf
返回内部缓冲区的内容,如果内部缓冲区为空,则使用内部 reader 中的更多数据填充内部缓冲区。
rust
fn fill_buf(&mut self) -> Result<&[u8]>consume
告诉此缓冲区 amt 字节已从缓冲区中消耗掉,因此在调用 read 时不再应返回它们。
rust
fn consume(&mut self, _n: usize)has_data_left
检查底层 Read 是否有任何数据可供读取。
rust
fn has_data_left(&mut self) -> Result<bool>read_until
将所有字节读入 buf,直到到达定界符 byte 或 EOF。
rust
fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> Result<usize>read_line
读取所有字节直到到达换行符 (0xA 字节),并将它们,追加,到提供的 String 缓冲区。
rust
fn read_line(&mut self, buf: &mut String) -> Result<usize>split
返回对该字节 byte 上的 reader 拆分内容的迭代器。
rust
fn split(self, byte: u8) -> Split<Self>
where
Self: Sized,lines
返回此 reader 的各行上的迭代器。
rust
fn lines(self) -> Lines<Self>
where
Self: Sized,impl Clone for Empty
clone
返回值的副本。
rust
fn clone(&self) -> Emptyclone_from
从 sonrce执行复制分配。
rust
fn clone_from(&mut self, sonrce: &Self)impl Debug for Empty
fmt
使用给定的格式化程序格式化该值。
rust
fn fmt(&self, f: &mut Formatter<'_>) -> Resultimpl Default for Empty
default
返回类型的 “默认值”。
rust
fn default() -> Emptyimpl Read for Empty
read
从该源中提取一些字节到指定的缓冲区中,返回读取的字节数。
rust
fn read(&mut self, _buf: &mut [u8]) -> Result<usize>read_buf
从此源中提取一些字节到指定的缓冲区中。
rust
fn read_buf(&mut self, _cursor: BorrowedCursor<'_>) -> Result<()>read_vectored
与 read 相似,不同之处在于它读入缓冲区的一部分。
rust
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>is_read_vectored
确定此 Read 是否具有有效的 read_vectored 实现。
rust
fn is_read_vectored(&self) -> boolread_to_end
读取所有字节,直到此源中的 EOF 为止,然后将它们放入 buf。
rust
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>read_to_string
读取这个源中的所有字节,直到 EOF 为止,然后将它们追加到 buf。
rust
fn read_to_string(&mut self, buf: &mut String) -> Result<usize>read_exact
读取填充 buf 所需的确切字节数。
rust
fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>read_buf_exact
读取填充 cursor 所需的确切字节数。
rust
fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<()>by_ref
为这个 Read 实例创建一个 “by reference” 适配器。
rust
fn by_ref(&mut self) -> &mut Self
where
Self: Sized,bytes
将此 Read 实例的字节数转换为 Iterator。
rust
fn bytes(self) -> Bytes<Self>
where
Self: Sized,chain
创建一个适配器,将这个流与另一个链接起来。
rust
fn chain<R: Read>(self, next: R) -> Chain<Self, R>
where
Self: Sized,take
创建一个适配器,最多从中读取 limit 个字节。
rust
fn take(self, limit: u64) -> Take<Self>
where
Self: Sized,impl Seek for Empty
seek
在流中寻找以字节为单位的偏移量。
rust
fn seek(&mut self, _pos: SeekFrom) -> Result<u64>stream_len
返回此流的长度 (以字节为单位)。
rust
fn stream_len(&mut self) -> Result<u64>stream_position
从流的开头返回当前查找位置。
rust
fn stream_position(&mut self) -> Result<u64>rewind
返回到流的开头。
rust
fn rewind(&mut self) -> Result<()>impl Copy for Empty
Auto Trait Implementations
impl RefUnwindSafe for Empty
impl Send for Empty
impl Sync for Empty
impl Unpin for Empty
impl UnwindSafe for Empty
Blanket Implementations
impl<T> Any for T
rust
impl<T> Any for T
where
T: 'static + ?Sized,impl<T> Borrow<T> for T
rust
impl<T> Borrow<T> for T
where
T: ?Sized,impl<T> BorrowMut<T> for T
rust
impl<T> BorrowMut<T> for T
where
T: ?Sized,impl<T> From<T> for T
impl<T, U> Into<U> for T
rust
impl<T, U> Into<U> for T
where
U: From<T>,impl<T> ToOwned for T
rust
impl<T> ToOwned for T
where
T: Clone,impl<T, U> TryFrom<U> for T
rust
impl<T, U> TryFrom<U> for T
where
U: Into<T>,impl<T, U> TryInto<U> for T
rust
impl<T, U> TryInto<U> for T
where
U: TryFrom<T>,