[−][src]Enum algorithmia::algo::AlgoIo
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
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
🔬 This is a nightly-only experimental API. (
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
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.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Same for T
type Output = T
Should always be Self