Struct term_transcript::Transcript[][src]

pub struct Transcript<Out: TermOutput = Captured> { /* fields omitted */ }
Expand description

Transcript of a user interacting with the terminal.

Implementations

impl Transcript[src]

pub fn from_inputs(
    options: &mut ShellOptions,
    inputs: impl IntoIterator<Item = UserInput>
) -> Result<Self>
[src]

Constructs a transcript from the sequence of given user inputs.

The inputs are executed in the shell specified in options. A single shell is shared among all commands.

Errors

  • Returns an error if spawning the shell or any operations with it fail (such as reading stdout / stderr, or writing commands to stdin).

pub fn capture_output(
    &mut self,
    input: UserInput,
    command: &mut Command
) -> Result<&mut Self>
[src]

Captures stdout / stderr of the provided command and adds it to Self::interactions().

The command is spawned with closed stdin. This method blocks until the command exits. The method succeeds regardless of the exit status.

Errors

  • Returns an error if spawning the command or any operations with it fail (such as reading stdout / stderr).

impl Transcript<Parsed>[src]

pub fn from_svg<R: BufRead>(reader: R) -> Result<Self, ParseError>[src]

This is supported on crate feature test only.

Parses a transcript from the provided reader, which should point to an SVG XML tree produced by Template::render() (possibly within a larger document).

Errors

  • Returns an error if the input cannot be parsed, usually because it was not produced by Template::render().

impl<Out: TermOutput> Transcript<Out>[src]

pub fn new() -> Self[src]

Creates an empty transcript.

pub fn interactions(&self) -> &[Interaction<Out>][src]

Returns interactions in this transcript.

impl Transcript[src]

pub fn add_interaction(
    &mut self,
    input: UserInput,
    output: impl Into<String>
) -> &mut Self
[src]

Adds a new interaction into the transcript.

Trait Implementations

impl<Out: Clone + TermOutput> Clone for Transcript<Out>[src]

fn clone(&self) -> Transcript<Out>[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<Out: Debug + TermOutput> Debug for Transcript<Out>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<Out: TermOutput> Default for Transcript<Out>[src]

fn default() -> Self[src]

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

Auto Trait Implementations

impl<Out> RefUnwindSafe for Transcript<Out> where
    Out: RefUnwindSafe

impl<Out> Send for Transcript<Out>

impl<Out> Sync for Transcript<Out>

impl<Out> Unpin for Transcript<Out> where
    Out: Unpin

impl<Out> UnwindSafe for Transcript<Out> where
    Out: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.