Skip to main content

Script

Struct Script 

Source
pub struct Script { /* private fields */ }
Expand description

A sequence of stdout/stderr events and delays that ScriptedShell replays through the spinner overlay renderer.

Build one with the fluent builder methods (Script::out, Script::err, Script::delay_ms, etc.) and enqueue it on a ScriptedShell via ScriptedShell::push.

Intended for testing use.

Implementations§

Source§

impl Script

Source

pub fn new() -> Self

Create a new empty Script that exits with success by default.

Source

pub fn out(self, text: &str) -> Self

Write raw text to stdout (no implicit newline).

Source

pub fn out_ms(self, text: &str, ms: u64) -> Self

Write raw text to stdout then sleep for ms milliseconds.

Source

pub fn out_line(self, text: &str) -> Self

Write text followed by a newline to stdout.

Source

pub fn out_cr(self, text: &str) -> Self

Write text followed by a cr to stdout.

Source

pub fn out_line_ms(self, text: &str, ms: u64) -> Self

Write text followed by a newline to stdout then sleep for ms milliseconds.

Source

pub fn out_cr_ms(self, text: &str, ms: u64) -> Self

Write text followed by a cr to stdout then sleep for ms milliseconds.

Source

pub fn err(self, text: &str) -> Self

Write raw text to stderr (no implicit newline).

Source

pub fn err_ms(self, text: &str, ms: u64) -> Self

Write raw text to stderr then sleep for ms milliseconds.

Source

pub fn err_line(self, text: &str) -> Self

Write text followed by a newline to stderr.

Source

pub fn err_line_ms(self, text: &str, ms: u64) -> Self

Write text followed by a newline to stderr then sleep for ms milliseconds.

Source

pub fn delay_ms(self, ms: u64) -> Self

Sleep for ms milliseconds before processing the next event.

Source

pub fn exit_failure(self) -> Self

Mark this script as exiting with a failure code. Default is success.

Trait Implementations§

Source§

impl Default for Script

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.