pub struct CrashPoint { /* private fields */ }Expand description
A write-truncating crash marker.
CrashPoint::after_byte(N).wrap(writer) returns a writer that
passes through up to N bytes (cumulative across all write
calls), then refuses every subsequent byte with
ErrorKind::WriteZero.
§Example
use dev_chaos::crash::CrashPoint;
use std::io::Write;
let mut sink: Vec<u8> = Vec::new();
let mut crashed = CrashPoint::after_byte(3).wrap(&mut sink);
crashed.write_all(b"abcd").ok();
drop(crashed);
assert_eq!(sink, b"abc");Implementations§
Source§impl CrashPoint
impl CrashPoint
Sourcepub fn after_byte(n: usize) -> Self
pub fn after_byte(n: usize) -> Self
Crash after n bytes have been written cumulatively.
Sourcepub fn wrap<W: Write>(self, writer: W) -> CrashWriter<W> ⓘ
pub fn wrap<W: Write>(self, writer: W) -> CrashWriter<W> ⓘ
Wrap writer with this crash point.
Trait Implementations§
Source§impl Clone for CrashPoint
impl Clone for CrashPoint
Source§fn clone(&self) -> CrashPoint
fn clone(&self) -> CrashPoint
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CrashPoint
impl Debug for CrashPoint
impl Copy for CrashPoint
Auto Trait Implementations§
impl Freeze for CrashPoint
impl RefUnwindSafe for CrashPoint
impl Send for CrashPoint
impl Sync for CrashPoint
impl Unpin for CrashPoint
impl UnsafeUnpin for CrashPoint
impl UnwindSafe for CrashPoint
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