Struct term_transcript::Transcript
source · pub struct Transcript<Out: TermOutput = Captured> { /* private fields */ }Expand description
Transcript of a user interacting with the terminal.
Implementations§
source§impl Transcript
impl Transcript
sourcepub fn from_inputs<Cmd: SpawnShell>(
options: &mut ShellOptions<Cmd>,
inputs: impl IntoIterator<Item = UserInput>
) -> Result<Self>
pub fn from_inputs<Cmd: SpawnShell>( options: &mut ShellOptions<Cmd>, inputs: impl IntoIterator<Item = UserInput> ) -> Result<Self>
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), or if the shell exits before all commands are executed.
sourcepub fn capture_output(
&mut self,
input: UserInput,
command: &mut Command
) -> Result<&mut Self>
pub fn capture_output( &mut self, input: UserInput, command: &mut Command ) -> Result<&mut Self>
Captures stdout / stderr of the provided command and adds it to Self::interactions().
The command is spawned with the closed stdin. This method blocks until the command exits.
The method succeeds regardless of the exit status of the command.
Errors
- Returns an error if spawning the
commandor any operations with it fail (such as reading stdout / stderr).
source§impl Transcript<Parsed>
impl Transcript<Parsed>
sourcepub fn from_svg<R: BufRead>(reader: R) -> Result<Self, ParseError>
Available on crate feature test only.
pub fn from_svg<R: BufRead>(reader: R) -> Result<Self, ParseError>
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().
source§impl<Out: TermOutput> Transcript<Out>
impl<Out: TermOutput> Transcript<Out>
sourcepub fn interactions(&self) -> &[Interaction<Out>]
pub fn interactions(&self) -> &[Interaction<Out>]
Returns interactions in this transcript.
source§impl Transcript
impl Transcript
sourcepub fn add_existing_interaction(
&mut self,
interaction: Interaction
) -> &mut Self
pub fn add_existing_interaction( &mut self, interaction: Interaction ) -> &mut Self
Manually adds a new interaction to the end of this transcript.
This method allows capturing interactions that are difficult or impossible to capture
using more high-level methods: Self::from_inputs() or Self::capture_output().
The resulting transcript will render just fine, but there could be issues
with testing it.
Trait Implementations§
source§impl<Out: Clone + TermOutput> Clone for Transcript<Out>
impl<Out: Clone + TermOutput> Clone for Transcript<Out>
source§fn clone(&self) -> Transcript<Out>
fn clone(&self) -> Transcript<Out>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl<Out: Debug + TermOutput> Debug for Transcript<Out>
impl<Out: Debug + TermOutput> Debug for Transcript<Out>
source§impl<Out: TermOutput> Default for Transcript<Out>
impl<Out: TermOutput> Default for Transcript<Out>
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§
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.