pub struct DeferBuf {
buf: [u8; 16384],
head: usize,
len: usize,
dropped: u32,
}Fields§
§buf: [u8; 16384]§head: usize最も古いバイトの位置。
len: usize貯まっているバイト数。
dropped: u32Implementations§
Source§impl DeferBuf
impl DeferBuf
pub const fn new() -> Self
Sourcepub fn push(&mut self, line: &[u8]) -> bool
pub fn push(&mut self, line: &[u8]) -> bool
1 行(改行込み)を後ろへ足す。入り切らなければ足さずに捨てた数を 1 増やし、false を返す。 行の一部だけを入れることはしない(行が途中で切れて出ることはない)。
Sourcepub fn note_dropped(&mut self)
pub fn note_dropped(&mut self)
捨てた行の数を 1 件ぶん数える(入れ物の錠が取れなかったときなど、呼ぶ側で捨てた分)。
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
Sourcepub fn take_dropped(&mut self) -> u32
pub fn take_dropped(&mut self) -> u32
捨てた行の数を読んで 0 へ戻す。
Sourcepub fn take_lines(&mut self, out: &mut [u8]) -> usize
pub fn take_lines(&mut self, out: &mut [u8]) -> usize
先頭から、out に入るだけの行(改行まで)を写して取り除き、写したバイト数を返す。
先頭の 1 行が out より長いときは、out に入るだけ(UTF-8 の文字の途中では切らない)を写す。
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DeferBuf
impl RefUnwindSafe for DeferBuf
impl Send for DeferBuf
impl Sync for DeferBuf
impl Unpin for DeferBuf
impl UnsafeUnpin for DeferBuf
impl UnwindSafe for DeferBuf
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