Skip to content

Struct std::io::Repeat

rust
pub struct Repeat { /* private fields */ }

一个 reader,它一遍又一遍地产生一个字节,一遍又一遍,一遍又一遍,…

通常通过调用 repeat() 来创建此结构体。 请参见 repeat() 的文档以获取更多详细信息。

Trait Implementations

impl Debug for Repeat

fmt

fn fmt(&self, f: &mut Formatter<'_>) -> Result

使用给定的格式化程序格式化该值。

rust

impl Read for Repeat

read

从该源中提取一些字节到指定的缓冲区中,返回读取的字节数。

rust
fn read(&mut self, buf: &mut [u8]) -> Result<usize>

read_buf

nightly-only

从此源中提取一些字节到指定的缓冲区中。

rust
fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<()>

read_vectored

与 read 相似,不同之处在于它读入缓冲区的一部分。

rust
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>

is_read_vectored

nightly-only

确定此 Read 是否具有有效的 read_vectored 实现。

rust
fn is_read_vectored(&self) -> bool

read_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

nightly-only

读取填充 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,

Auto Trait Implementations

impl RefUnwindSafe for Repeat

impl Send for Repeat

impl Sync for Repeat

impl Unpin for Repeat

impl UnwindSafe for Repeat

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, 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>,

MIT Licensed