#[non_exhaustive]pub struct Keep { /* private fields */ }Expand description
How much of a child’s output to keep when it is collected, and how long
it may run.
It is built with Keep::bytes and narrowed with Keep::lines and Keep::limit. What
is kept is the end of the output, never the beginning: a program that writes more than the
bytes asked for has its oldest output dropped as the newest arrives, and
Collected::trimmed says that it did.
Implementations§
Source§impl Keep
impl Keep
Sourcepub fn bytes(bytes: usize) -> Self
pub fn bytes(bytes: usize) -> Self
Keeps at most bytes bytes of the output, the end of it. A program that writes more has
its oldest output dropped while it runs and never costs more memory than this plus one
read, and the cut falls between characters, so no character is half in the text. Zero
bytes is a way of asking for the outcome alone.
Sourcepub fn lines(self, lines: usize) -> Self
pub fn lines(self, lines: usize) -> Self
Keeps at most lines lines as well, the last of them. The line a program is still writing
counts as one, so output that ends without a newline keeps what was written.
Sourcepub fn limit(self, limit: Duration) -> Self
pub fn limit(self, limit: Duration) -> Self
Ends the program when limit is over, the way cancelling does: with
Process::no_stdin on Unix its whole process group goes with it, and
Collected::timed_out says that the time is what ended it.
Trait Implementations§
impl Copy for Keep
impl Eq for Keep
impl StructuralPartialEq for Keep
Auto Trait Implementations§
impl Freeze for Keep
impl RefUnwindSafe for Keep
impl Send for Keep
impl Sync for Keep
impl Unpin for Keep
impl UnsafeUnpin for Keep
impl UnwindSafe for Keep
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more