Skip to main content

Memory

Struct Memory 

Source
pub struct Memory { /* private fields */ }
Expand description

A host whose inputs are named byte strings and whose outputs stay in memory: what the bindings give the surface (spec 027, 3.1.3), where a command’s artifacts are returned as bytes rather than written to files. It has no aggregate read budget; each read is bounded by its maximum.

Implementations§

Source§

impl Memory

Source

pub fn new(inputs: BTreeMap<String, Vec<u8>>) -> Self

Source

pub fn inputs(&self) -> &BTreeMap<String, Vec<u8>>

The inputs, by label.

Source

pub fn output(&self, label: &str) -> Option<Vec<u8>>

A copy of one published output, by label.

Source

pub fn into_outputs(self) -> BTreeMap<String, Vec<u8>>

The outputs the command published, by label.

Trait Implementations§

Source§

impl Debug for Memory

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for Memory

Source§

fn default() -> Self

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

impl Host for Memory

Source§

fn read_classified( &self, label: &str, max: usize, ) -> Result<Option<Vec<u8>>, ReadFail>

Read label, at most max bytes of it; None when it does not exist. A failure of the input is told from an exhausted command budget, which depends on read order rather than on the input.
Source§

fn ensure_absent(&self, label: &str) -> Result<(), IoFail>

Refuse an output that already exists, before any work. A pure check that changes nothing, so calling it again for the same label gives the same answer: commands check every output up front and again just before writing.
Source§

fn create(&self, label: &str, bytes: &[u8]) -> Result<(), IoFail>

Publish one output, never overwriting.
Source§

fn write_all(&self, files: &[(String, Vec<u8>)]) -> Result<(), IoFail>

Publish every (label, bytes), all or none.
Source§

fn join(&self, dir: &str, name: &str) -> String

The label of name inside the output or input directory dir.
Source§

fn read(&self, label: &str, limit: usize) -> Result<Vec<u8>, IoFail>

Read label up to its document limit plus one byte, so an oversized input reaches the parser and is refused by the document’s own bound.
Source§

fn read_bounded( &self, label: &str, max: usize, ) -> Result<Option<Vec<u8>>, IoFail>

Like Host::read with an explicit maximum, returning None for an input that does not exist.

Auto Trait Implementations§

§

impl !Freeze for Memory

§

impl !RefUnwindSafe for Memory

§

impl !Sync for Memory

§

impl Send for Memory

§

impl Unpin for Memory

§

impl UnsafeUnpin for Memory

§

impl UnwindSafe for Memory

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.