#[non_exhaustive]pub struct Faults {
pub silent: bool,
pub burst: Option<(Vec<u8>, usize)>,
pub chunk: Option<usize>,
pub delay: Duration,
}Expand description
Faults of a port, for what the device answers (FakeDevice::respond,
FakeDevice::modem) and how the host reads it. Set with FakeDevice::faults; the
default has none.
use serialplugin_testing::Faults;
use std::time::Duration;
let faults = Faults::default()
.burst(b"\r\n+CSQ: 20,99\r\n", 3)
.chunk(5)
.delay(Duration::from_millis(200));
assert_eq!(faults.chunk, Some(5));
assert!(!faults.silent);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.silent: boolAnswers are dropped: the host’s commands hang (the modem still sees them).
burst: Option<(Vec<u8>, usize)>These bytes, that many times, after every answer that is not empty (a burst of unsolicited lines).
chunk: Option<usize>Every read returns at most this many bytes: lines split across reads.
delay: DurationAnswers arrive this late, on the device’s clock, and in order: an answer never comes before one given earlier, also when the delay was cut meanwhile.
Implementations§
Trait Implementations§
impl Eq for Faults
impl StructuralPartialEq for Faults
Auto Trait Implementations§
impl Forget for Faults
impl Freeze for Faults
impl Move for Faults
impl RefUnwindSafe for Faults
impl Send for Faults
impl Sync for Faults
impl Unpin for Faults
impl UnsafeUnpin for Faults
impl UnwindSafe for Faults
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