pub struct Reader { /* private fields */ }Expand description
A Reader implements the io.Reader, io.ReaderAt, io.ByteReader, io.ByteScanner, io.RuneReader, io.RuneScanner, io.Seeker, and io.WriterTo interfaces by reading from a string. The zero value for Reader operates like a Reader of an empty string.
zh-cn
Implementations§
Source§impl Reader
impl Reader
Sourcepub fn new(s: &str) -> Reader
pub fn new(s: &str) -> Reader
new returns a new Reader reading from s. more efficient and read-only.
zh-cn
NewReader创建一个从s读取数据的Reader。更有效率,且为只读的。Sourcepub fn Len(&self) -> int
pub fn Len(&self) -> int
Len returns the number of bytes of the unread portion of the string.
zh-cn
Len返回self包含的字符串还没有被读取的部分。Sourcepub fn Reset(&mut self, s: &str)
pub fn Reset(&mut self, s: &str)
Reset resets the Reader to be reading from s.
zh-cn
重置将Reader重置为从s读取。Sourcepub fn Size(&self) -> int64
pub fn Size(&self) -> int64
Size returns the original length of the underlying string. Size is the number of bytes available for reading via ReadAt. The returned value is always the same and is not affected by calls to any other method.
zh-cn
Size返回基础字符串的原始长度。Size是可通过ReadAt读取的字节数。返回的值始终相同,并且不受对任何其他方法的调用的影响。Trait Implementations§
Source§impl ByteScanner for Reader
impl ByteScanner for Reader
Source§impl PartialOrd for Reader
impl PartialOrd for Reader
impl StructuralPartialEq for Reader
Auto Trait Implementations§
impl Freeze for Reader
impl RefUnwindSafe for Reader
impl Send for Reader
impl Sync for Reader
impl Unpin for Reader
impl UnwindSafe for Reader
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