artichoke_core::io

Trait Io

source
pub trait Io {
    type Error;

    // Required method
    fn print(&mut self, message: &[u8]) -> Result<(), Self::Error>;

    // Provided method
    fn puts(&mut self, message: &[u8]) -> Result<(), Self::Error> { ... }
}
Expand description

Perform I/O external to the interpreter.

Required Associated Types§

source

type Error

Concrete error type for errors encountered when reading and writing.

Required Methods§

source

fn print(&mut self, message: &[u8]) -> Result<(), Self::Error>

Writes the given bytes to the interpreter stdout stream.

§Errors

If the output stream encounters an error, an error is returned.

Provided Methods§

source

fn puts(&mut self, message: &[u8]) -> Result<(), Self::Error>

Writes the given bytes to the interpreter stdout stream followed by a newline.

The default implementation uses two calls to print.

§Errors

If the output stream encounters an error, an error is returned.

Implementors§