artichoke_backend::core

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§