Enum algorithmia::prelude::AlgoInput [] [src]

pub enum AlgoInput<'a> {
    Text(Cow<'a, str>),
    Binary(Cow<'a, [u8]>),
    Json(Cow<'a, JsonValue>),
}

Types that can be used as input to an algorithm

Variants

Data that will be sent with Content-Type: text/plain

Data that will be sent with Content-Type: application/octet-stream

Data that will be sent with Content-Type: application/json

Methods

impl<'a> AlgoInput<'a>
[src]

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

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

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

If the AlgoInput is binary, returns the associated byte slice

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

Trait Implementations

impl<'a> From<()> for AlgoInput<'a>
[src]

Performs the conversion.

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

Performs the conversion.

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

Performs the conversion.

impl<'a> From<String> for AlgoInput<'a>
[src]

Performs the conversion.

impl<'a> From<Vec<u8>> for AlgoInput<'a>
[src]

Performs the conversion.

impl<'a> From<JsonValue> for AlgoInput<'a>
[src]

Performs the conversion.

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

Performs the conversion.

impl<'a> From<AlgoOutput> for AlgoInput<'a>
[src]

Performs the conversion.