Trait algorithmia::algo::EntryPoint [] [src]

pub trait EntryPoint: Default {
    fn apply_str(&self, text: &str) -> Result<AlgoOutput, Box<StdError>> { ... }
fn apply_json(&self, json: &JsonValue) -> Result<AlgoOutput, Box<StdError>> { ... }
fn apply_bytes(&self, bytes: &[u8]) -> Result<AlgoOutput, Box<StdError>> { ... }
fn apply(&self, input: AlgoInput) -> Result<AlgoOutput, Box<StdError>> { ... } }

Implementing an algorithm involves overriding at least one of these methods

Provided Methods

Override to handle string input

Override to handle JSON input (see also DecodedEntryPoint)

Override to handle binary input

The default implementation of this method calls apply_str, apply_json, or apply_bytes based on the input type.

  • AlgoInput::Text results in call to apply_str
  • AlgoInput::Json results in call to apply_json
  • AlgoInput::Binary results in call to apply_bytes

If that call returns anKind UnsupportedInput error, then this method method will may attempt to coerce the input into another type and attempt one more call:

  • AlgoInput::Text input will be JSON-encoded to call apply_json
  • AlgoInput::Json input will be parse to see it can call apply_str

Implementors