pub struct ScriptOutput { /* private fields */ }Expand description
Anything a script printed while it ran, in the order it printed it.
Rhai’s print and debug write somewhere, and the only question is where.
Core does not answer it: it collects the lines and hands them back, and the
front-end decides what a line is for — stderr for the CLI, a pane for a TUI,
a log record for something else. That is the same arrangement as every other
piece of “what does the outside world do here” in this crate: Config and
Environment take the directory to search rather than reading the real one,
and the CLI’s sending loop takes the function that sends rather than calling
the network itself.
It matters more here than it looks. sendra-core has no println! or
eprintln! anywhere, by design, because a sendra-tui sharing this crate
cannot have a library writing over its interface — and a print in a script
is exactly the kind of thing that would otherwise land in the middle of a
redrawn frame, or inside the single JSON document --json promises stdout
holds.
A debug line is already formatted with its source and position by the time
it lands here, because that formatting is Rhai’s information to render and
not the front-end’s to reconstruct. Which stream it goes to, and whether it
is coloured, is the front-end’s.
Implementations§
Trait Implementations§
Source§impl Clone for ScriptOutput
impl Clone for ScriptOutput
Source§fn clone(&self) -> ScriptOutput
fn clone(&self) -> ScriptOutput
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ScriptOutput
impl Debug for ScriptOutput
Source§impl Default for ScriptOutput
impl Default for ScriptOutput
Source§fn default() -> ScriptOutput
fn default() -> ScriptOutput
impl Eq for ScriptOutput
Source§impl PartialEq for ScriptOutput
impl PartialEq for ScriptOutput
impl StructuralPartialEq for ScriptOutput
Auto Trait Implementations§
impl Freeze for ScriptOutput
impl RefUnwindSafe for ScriptOutput
impl Send for ScriptOutput
impl Sync for ScriptOutput
impl Unpin for ScriptOutput
impl UnsafeUnpin for ScriptOutput
impl UnwindSafe for ScriptOutput
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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§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.