[][src]Enum algorithmia::algo::AlgoIo

pub enum AlgoIo {
    Text(String),
    Binary(Vec<u8>),
    Json(Value),
}

Types that store either input or ouput to an algorithm

Variants

Text(String)

Text input or output

Binary(Vec<u8>)

Binary input or output

Json(Value)

JSON input or output

Methods

impl AlgoIo[src]

pub fn as_string(&self) -> Option<&str>[src]

If the AlgoIo is text (or a valid JSON string), returns the associated text

pub fn as_json<'a>(&'a self) -> Option<Cow<'a, Value>>[src]

If the AlgoIo is Json (or JSON encodable text), returns the associated JSON string

For AlgoIo::Json, this returns the borrowed Json. For the AlgoIo::Text variant, the text is wrapped into an owned Value::String.

pub fn as_bytes(&self) -> Option<&[u8]>[src]

If the AlgoIo is binary, returns the associated byte slice

pub fn decode<D: DeserializeOwned>(&self) -> Result<D>[src]

If the AlgoIo is valid JSON, decode it to a particular type

Trait Implementations

impl From<()> for AlgoIo[src]

impl<'a> From<&'a str> for AlgoIo[src]

impl<'a> From<&'a [u8]> for AlgoIo[src]

impl From<String> for AlgoIo[src]

impl From<Vec<u8>> for AlgoIo[src]

impl From<Value> for AlgoIo[src]

impl<'a, S: Serialize> From<&'a S> for AlgoIo[src]

impl<S: Serialize> From<Box<S>> for AlgoIo[src]

impl From<u32> for AlgoIo[src]

impl From<i32> for AlgoIo[src]

impl From<u64> for AlgoIo[src]

impl From<i64> for AlgoIo[src]

impl From<usize> for AlgoIo[src]

impl From<isize> for AlgoIo[src]

impl From<f32> for AlgoIo[src]

impl From<f64> for AlgoIo[src]

impl From<bool> for AlgoIo[src]

Auto Trait Implementations

impl Send for AlgoIo

impl Sync for AlgoIo

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Same for T

type Output = T

Should always be Self

impl<T> Erased for T