Trait foxbox_taxonomy::parse::Parser
[−]
[src]
pub trait Parser<T: Sized> {
fn description() -> String;
fn parse(path: Path, source: &mut JSON) -> Result<T, ParseError>;
fn from_str(source: &str) -> Result<T, ParseError> { ... }
fn take(path: Path, source: &mut JSON, field_name: &str) -> Result<T, ParseError> { ... }
fn take_opt(path: Path, source: &mut JSON, field_name: &str) -> Option<Result<T, ParseError>> { ... }
fn take_vec_opt(path: Path, source: &mut JSON, field_name: &str) -> Option<Result<Vec<T>, ParseError>> { ... }
fn take_vec(path: Path, source: &mut JSON, field_name: &str) -> Result<Vec<T>, ParseError> { ... }
}An object that knows how to parse values from JSON into type T.
The JSON object is expected to be consumed along the way. A successful parse will typically leave an empty JSON object.
Required Methods
fn description() -> String
fn parse(path: Path, source: &mut JSON) -> Result<T, ParseError>
Parse a single value from JSON, consuming as much as necessary from JSON.
Provided Methods
fn from_str(source: &str) -> Result<T, ParseError>
fn take(path: Path, source: &mut JSON, field_name: &str) -> Result<T, ParseError>
Parse a field from JSON, consuming it.
fn take_opt(path: Path, source: &mut JSON, field_name: &str) -> Option<Result<T, ParseError>>
Parse a field from JSON, consuming it.
fn take_vec_opt(path: Path, source: &mut JSON, field_name: &str) -> Option<Result<Vec<T>, ParseError>>
Parse a field containing an array from JSON, consuming the field.
fn take_vec(path: Path, source: &mut JSON, field_name: &str) -> Result<Vec<T>, ParseError>
Implementors
impl Parser<ChannelKind> for ChannelKindimpl<K> Parser<Targetted<K, Value>> for Targetted<K, Value> where K: Parser<K> + Cloneimpl<K> Parser<Targetted<K, Exactly<Range>>> for Targetted<K, Exactly<Range>> where K: Parser<K> + Cloneimpl Parser<f64> for f64impl Parser<bool> for boolimpl Parser<u8> for u8impl<T> Parser<Vec<T>> for Vec<T> where T: Parser<T>impl Parser<String> for Stringimpl<T> Parser<Arc<T>> for Arc<T> where T: Parser<T>impl Parser<ServiceSelector> for ServiceSelectorimpl Parser<GetterSelector> for GetterSelectorimpl Parser<SetterSelector> for SetterSelectorimpl Parser<Type> for Typeimpl Parser<OnOff> for OnOffimpl Parser<OpenClosed> for OpenClosedimpl Parser<Temperature> for Temperatureimpl Parser<Color> for Colorimpl Parser<ThinkerbellRule> for ThinkerbellRuleimpl Parser<Json> for Jsonimpl<T> Parser<ExtValue<T>> for ExtValue<T> where T: Debug + Clone + PartialEq + PartialOrd + Serialize + Deserialize + Parser<T>impl Parser<Binary> for Binaryimpl Parser<Value> for Valueimpl Parser<TimeStamp> for TimeStampimpl Parser<Range> for Rangeimpl Parser<Duration> for Durationimpl<T> Parser<Exactly<T>> for Exactly<T> where T: Parser<T>impl<T> Parser<Id<T>> for Id<T>