[−][src]Trait algorithmia::entrypoint::EntryPoint
Implementing an algorithm involves overriding at least one of these methods
Provided methods
fn apply_str(&mut self, text: &str) -> Result<AlgoIo, Box<dyn StdError>>
Override to handle string input
fn apply_json(&mut self, json: &Value) -> Result<AlgoIo, Box<dyn StdError>>
Override to handle JSON input (see also DecodedEntryPoint
)
fn apply_bytes(&mut self, bytes: &[u8]) -> Result<AlgoIo, Box<dyn StdError>>
Override to handle binary input
fn apply(&mut self, input: AlgoIo) -> Result<AlgoIo, Box<dyn StdError>>
The default implementation of this method calls
apply_str
, apply_json
, or apply_bytes
based on the input type.
AlgoIo::Text
results in call toapply_str
AlgoIo::Json
results in call toapply_json
AlgoIo::Binary
results in call toapply_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:
AlgoIo::Text
input will be JSON-encoded to callapply_json
AlgoIo::Json
input will be parse to see it can callapply_str
Implementors
impl<T> EntryPoint for T where
T: DecodedEntryPoint,
[src]
T: DecodedEntryPoint,