Fixes & tweaks wrt Domain/Embedded/Embeddable
This commit is contained in:
parent
c7b252ca9d
commit
c04447d62a
|
@ -58,7 +58,7 @@ impl CompilerConfig {
|
|||
let mut reader = PackedReader::decode_read(&mut f);
|
||||
let blob = reader.demand_next(false)?;
|
||||
|
||||
if let Ok(s) = Schema::try_from(blob.clone()) {
|
||||
if let Ok(s) = Schema::try_from(&blob) {
|
||||
let prefix = i.file_stem().ok_or_else(
|
||||
|| Error::new(ErrorKind::InvalidData, format!("Bad schema file stem: {:?}", i)))?
|
||||
.to_str().ok_or_else(
|
||||
|
@ -67,7 +67,7 @@ impl CompilerConfig {
|
|||
return Ok(());
|
||||
}
|
||||
|
||||
if let Ok(Bundle { modules }) = Bundle::try_from(blob) {
|
||||
if let Ok(Bundle { modules }) = Bundle::try_from(&blob) {
|
||||
for (ModulePath(k), v) in modules.0 {
|
||||
self.bundle.insert(k, v);
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ pub fn compile(config: &CompilerConfig) -> Result<(), std::io::Error> {
|
|||
lines.push("#![allow(unused_imports)]".to_owned());
|
||||
lines.push("".to_owned());
|
||||
lines.push("use std::convert::TryFrom;".to_owned());
|
||||
lines.push("use preserves::value::Embeddable;".to_owned());
|
||||
lines.push("use preserves::value::Domain;".to_owned());
|
||||
lines.push("use preserves::value::NestedValue;".to_owned());
|
||||
lines.push(format!("use {}::support as _support;", &config.support_crate));
|
||||
lines.push("".to_owned());
|
||||
|
|
|
@ -11,7 +11,7 @@ use super::types::*;
|
|||
pub fn gen_definition_parser(m: &mut ModuleContext, n: &str, d: &Definition) {
|
||||
m.define_function(
|
||||
|mut ctxt| {
|
||||
let mut body = vec![item("let value = &value;")];
|
||||
let mut body = vec![];
|
||||
|
||||
match d {
|
||||
Definition::Or { pattern_0, pattern_1, pattern_n } => {
|
||||
|
@ -50,10 +50,10 @@ pub fn gen_definition_parser(m: &mut ModuleContext, n: &str, d: &Definition) {
|
|||
}
|
||||
}
|
||||
|
||||
item(seq!["impl std::convert::TryFrom", anglebrackets![ctxt.m.target()], " for ",
|
||||
item(seq!["impl std::convert::TryFrom", anglebrackets![seq!["&", ctxt.m.target()]], " for ",
|
||||
names::render_constructor(n), " ", block![
|
||||
seq!["type Error = _support::ParseError;"],
|
||||
seq!["fn try_from(value: ", ctxt.m.target(), ") -> ",
|
||||
seq!["fn try_from(value: &", ctxt.m.target(), ") -> ",
|
||||
"std::result::Result<Self, _support::ParseError> ",
|
||||
block(body)]]])
|
||||
});
|
||||
|
@ -191,7 +191,7 @@ fn simple_pattern_parser(
|
|||
let tf = name![ctxt.m.render_ref(&**r), "try_from"];
|
||||
push_let(body,
|
||||
item(dest.to_owned()),
|
||||
item(seq![tf, parens![seq![src.to_owned(), ".clone()"]], "?"]));
|
||||
item(seq![tf, parens![seq![src.to_owned()]], "?"]));
|
||||
dest
|
||||
},
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ fn simple_pattern_unparser(
|
|||
ModuleContextMode::TargetIOValue =>
|
||||
item(seq!["preserves::value::Value::Embedded(", src.as_ref().unwrap().to_owned(), ".as_preserves()).wrap()"]),
|
||||
ModuleContextMode::TargetAny =>
|
||||
item(seq!["preserves::value::Value::Embedded(", src.as_ref().unwrap().to_owned(), ").wrap()"]),
|
||||
item(seq!["preserves::value::Value::Embedded(", src.as_ref().unwrap().to_owned(), ".clone()).wrap()"]),
|
||||
}
|
||||
}
|
||||
SimplePattern::Lit { value } =>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#![allow(unused_imports)]
|
||||
|
||||
use std::convert::TryFrom;
|
||||
use preserves::value::Embeddable;
|
||||
use preserves::value::Domain;
|
||||
use preserves::value::NestedValue;
|
||||
use crate::support as _support;
|
||||
|
||||
|
@ -218,10 +218,9 @@ fn _io_parse_atom_kind_symbol(value: &preserves::value::IOValue) -> std::result:
|
|||
Ok(AtomKind::Symbol)
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<preserves::value::IOValue> for AtomKind {
|
||||
impl std::convert::TryFrom<&preserves::value::IOValue> for AtomKind {
|
||||
type Error = _support::ParseError;
|
||||
fn try_from(value: preserves::value::IOValue) -> std::result::Result<Self, Self::Error> {
|
||||
let value = &value;
|
||||
fn try_from(value: &preserves::value::IOValue) -> std::result::Result<Self, _support::ParseError> {
|
||||
if let Ok(r) = _io_parse_atom_kind_boolean(value) { return Ok(r); }
|
||||
if let Ok(r) = _io_parse_atom_kind_float(value) { return Ok(r); }
|
||||
if let Ok(r) = _io_parse_atom_kind_double(value) { return Ok(r); }
|
||||
|
@ -289,10 +288,9 @@ fn _any_parse_atom_kind_symbol(value: &_Any) -> std::result::Result<AtomKind, _s
|
|||
Ok(AtomKind::Symbol)
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<_Any> for AtomKind {
|
||||
impl std::convert::TryFrom<&_Any> for AtomKind {
|
||||
type Error = _support::ParseError;
|
||||
fn try_from(value: _Any) -> std::result::Result<Self, Self::Error> {
|
||||
let value = &value;
|
||||
fn try_from(value: &_Any) -> std::result::Result<Self, _support::ParseError> {
|
||||
if let Ok(r) = _any_parse_atom_kind_boolean(value) { return Ok(r); }
|
||||
if let Ok(r) = _any_parse_atom_kind_float(value) { return Ok(r); }
|
||||
if let Ok(r) = _any_parse_atom_kind_double(value) { return Ok(r); }
|
||||
|
@ -318,16 +316,15 @@ impl std::convert::From<&AtomKind> for _Any {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<preserves::value::IOValue> for Binding {
|
||||
impl std::convert::TryFrom<&preserves::value::IOValue> for Binding {
|
||||
type Error = _support::ParseError;
|
||||
fn try_from(value: preserves::value::IOValue) -> std::result::Result<Self, Self::Error> {
|
||||
let value = &value;
|
||||
fn try_from(value: &preserves::value::IOValue) -> std::result::Result<Self, _support::ParseError> {
|
||||
let _tmp0 = value.value().to_record(None)?;
|
||||
if _tmp0.label() != &*_io_::LIT_7_NAMED { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp1 = ();
|
||||
if _tmp0.fields().len() < 2 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp2 = (&_tmp0.fields()[0]).value().to_symbol()?;
|
||||
let _tmp3 = SimplePattern::try_from((&_tmp0.fields()[1]).clone())?;
|
||||
let _tmp3 = SimplePattern::try_from((&_tmp0.fields()[1]))?;
|
||||
Ok(Binding {name: _tmp2.clone(), pattern: _tmp3})
|
||||
}
|
||||
}
|
||||
|
@ -344,16 +341,15 @@ impl std::convert::From<&Binding> for preserves::value::IOValue {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<_Any> for Binding {
|
||||
impl std::convert::TryFrom<&_Any> for Binding {
|
||||
type Error = _support::ParseError;
|
||||
fn try_from(value: _Any) -> std::result::Result<Self, Self::Error> {
|
||||
let value = &value;
|
||||
fn try_from(value: &_Any) -> std::result::Result<Self, _support::ParseError> {
|
||||
let _tmp0 = value.value().to_record(None)?;
|
||||
if _tmp0.label() != &*_any_::LIT_7_NAMED { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp1 = ();
|
||||
if _tmp0.fields().len() < 2 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp2 = (&_tmp0.fields()[0]).value().to_symbol()?;
|
||||
let _tmp3 = SimplePattern::try_from((&_tmp0.fields()[1]).clone())?;
|
||||
let _tmp3 = SimplePattern::try_from((&_tmp0.fields()[1]))?;
|
||||
Ok(Binding {name: _tmp2.clone(), pattern: _tmp3})
|
||||
}
|
||||
}
|
||||
|
@ -370,15 +366,14 @@ impl std::convert::From<&Binding> for _Any {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<preserves::value::IOValue> for Bundle {
|
||||
impl std::convert::TryFrom<&preserves::value::IOValue> for Bundle {
|
||||
type Error = _support::ParseError;
|
||||
fn try_from(value: preserves::value::IOValue) -> std::result::Result<Self, Self::Error> {
|
||||
let value = &value;
|
||||
fn try_from(value: &preserves::value::IOValue) -> std::result::Result<Self, _support::ParseError> {
|
||||
let _tmp0 = value.value().to_record(None)?;
|
||||
if _tmp0.label() != &*_io_::LIT_8_BUNDLE { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp1 = ();
|
||||
if _tmp0.fields().len() < 1 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp2 = Modules::try_from((&_tmp0.fields()[0]).clone())?;
|
||||
let _tmp2 = Modules::try_from((&_tmp0.fields()[0]))?;
|
||||
Ok(Bundle {modules: _tmp2})
|
||||
}
|
||||
}
|
||||
|
@ -394,15 +389,14 @@ impl std::convert::From<&Bundle> for preserves::value::IOValue {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<_Any> for Bundle {
|
||||
impl std::convert::TryFrom<&_Any> for Bundle {
|
||||
type Error = _support::ParseError;
|
||||
fn try_from(value: _Any) -> std::result::Result<Self, Self::Error> {
|
||||
let value = &value;
|
||||
fn try_from(value: &_Any) -> std::result::Result<Self, _support::ParseError> {
|
||||
let _tmp0 = value.value().to_record(None)?;
|
||||
if _tmp0.label() != &*_any_::LIT_8_BUNDLE { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp1 = ();
|
||||
if _tmp0.fields().len() < 1 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp2 = Modules::try_from((&_tmp0.fields()[0]).clone())?;
|
||||
let _tmp2 = Modules::try_from((&_tmp0.fields()[0]))?;
|
||||
Ok(Bundle {modules: _tmp2})
|
||||
}
|
||||
}
|
||||
|
@ -423,8 +417,8 @@ fn _io_parse_compound_pattern_rec(value: &preserves::value::IOValue) -> std::res
|
|||
if _tmp0.label() != &*_io_::LIT_9_REC { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp1 = ();
|
||||
if _tmp0.fields().len() < 2 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp2 = NamedPattern::try_from((&_tmp0.fields()[0]).clone())?;
|
||||
let _tmp3 = NamedPattern::try_from((&_tmp0.fields()[1]).clone())?;
|
||||
let _tmp2 = NamedPattern::try_from((&_tmp0.fields()[0]))?;
|
||||
let _tmp3 = NamedPattern::try_from((&_tmp0.fields()[1]))?;
|
||||
Ok(CompoundPattern::Rec {label: std::boxed::Box::new(_tmp2), fields: std::boxed::Box::new(_tmp3)})
|
||||
}
|
||||
|
||||
|
@ -435,7 +429,7 @@ fn _io_parse_compound_pattern_tuple(value: &preserves::value::IOValue) -> std::r
|
|||
if _tmp0.fields().len() < 1 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp3 = (&_tmp0.fields()[0]).value().to_sequence()?;
|
||||
let mut _tmp2 = std::vec::Vec::new();
|
||||
for _tmp4 in &_tmp3[0..] {let _tmp5 = NamedPattern::try_from(_tmp4.clone())?; _tmp2.push(_tmp5);}
|
||||
for _tmp4 in &_tmp3[0..] {let _tmp5 = NamedPattern::try_from(_tmp4)?; _tmp2.push(_tmp5);}
|
||||
Ok(CompoundPattern::Tuple {patterns: _tmp2})
|
||||
}
|
||||
|
||||
|
@ -446,8 +440,8 @@ fn _io_parse_compound_pattern_tuple_prefix(value: &preserves::value::IOValue) ->
|
|||
if _tmp0.fields().len() < 2 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp3 = (&_tmp0.fields()[0]).value().to_sequence()?;
|
||||
let mut _tmp2 = std::vec::Vec::new();
|
||||
for _tmp4 in &_tmp3[0..] {let _tmp5 = NamedPattern::try_from(_tmp4.clone())?; _tmp2.push(_tmp5);}
|
||||
let _tmp6 = NamedSimplePattern::try_from((&_tmp0.fields()[1]).clone())?;
|
||||
for _tmp4 in &_tmp3[0..] {let _tmp5 = NamedPattern::try_from(_tmp4)?; _tmp2.push(_tmp5);}
|
||||
let _tmp6 = NamedSimplePattern::try_from((&_tmp0.fields()[1]))?;
|
||||
Ok(CompoundPattern::TuplePrefix {fixed: _tmp2, variable: std::boxed::Box::new(_tmp6)})
|
||||
}
|
||||
|
||||
|
@ -456,14 +450,13 @@ fn _io_parse_compound_pattern_dict(value: &preserves::value::IOValue) -> std::re
|
|||
if _tmp0.label() != &*_io_::LIT_12_DICT { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp1 = ();
|
||||
if _tmp0.fields().len() < 1 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp2 = DictionaryEntries::try_from((&_tmp0.fields()[0]).clone())?;
|
||||
let _tmp2 = DictionaryEntries::try_from((&_tmp0.fields()[0]))?;
|
||||
Ok(CompoundPattern::Dict {entries: std::boxed::Box::new(_tmp2)})
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<preserves::value::IOValue> for CompoundPattern {
|
||||
impl std::convert::TryFrom<&preserves::value::IOValue> for CompoundPattern {
|
||||
type Error = _support::ParseError;
|
||||
fn try_from(value: preserves::value::IOValue) -> std::result::Result<Self, Self::Error> {
|
||||
let value = &value;
|
||||
fn try_from(value: &preserves::value::IOValue) -> std::result::Result<Self, _support::ParseError> {
|
||||
if let Ok(r) = _io_parse_compound_pattern_rec(value) { return Ok(r); }
|
||||
if let Ok(r) = _io_parse_compound_pattern_tuple(value) { return Ok(r); }
|
||||
if let Ok(r) = _io_parse_compound_pattern_tuple_prefix(value) { return Ok(r); }
|
||||
|
@ -518,8 +511,8 @@ fn _any_parse_compound_pattern_rec(value: &_Any) -> std::result::Result<Compound
|
|||
if _tmp0.label() != &*_any_::LIT_9_REC { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp1 = ();
|
||||
if _tmp0.fields().len() < 2 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp2 = NamedPattern::try_from((&_tmp0.fields()[0]).clone())?;
|
||||
let _tmp3 = NamedPattern::try_from((&_tmp0.fields()[1]).clone())?;
|
||||
let _tmp2 = NamedPattern::try_from((&_tmp0.fields()[0]))?;
|
||||
let _tmp3 = NamedPattern::try_from((&_tmp0.fields()[1]))?;
|
||||
Ok(CompoundPattern::Rec {label: std::boxed::Box::new(_tmp2), fields: std::boxed::Box::new(_tmp3)})
|
||||
}
|
||||
|
||||
|
@ -530,7 +523,7 @@ fn _any_parse_compound_pattern_tuple(value: &_Any) -> std::result::Result<Compou
|
|||
if _tmp0.fields().len() < 1 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp3 = (&_tmp0.fields()[0]).value().to_sequence()?;
|
||||
let mut _tmp2 = std::vec::Vec::new();
|
||||
for _tmp4 in &_tmp3[0..] {let _tmp5 = NamedPattern::try_from(_tmp4.clone())?; _tmp2.push(_tmp5);}
|
||||
for _tmp4 in &_tmp3[0..] {let _tmp5 = NamedPattern::try_from(_tmp4)?; _tmp2.push(_tmp5);}
|
||||
Ok(CompoundPattern::Tuple {patterns: _tmp2})
|
||||
}
|
||||
|
||||
|
@ -541,8 +534,8 @@ fn _any_parse_compound_pattern_tuple_prefix(value: &_Any) -> std::result::Result
|
|||
if _tmp0.fields().len() < 2 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp3 = (&_tmp0.fields()[0]).value().to_sequence()?;
|
||||
let mut _tmp2 = std::vec::Vec::new();
|
||||
for _tmp4 in &_tmp3[0..] {let _tmp5 = NamedPattern::try_from(_tmp4.clone())?; _tmp2.push(_tmp5);}
|
||||
let _tmp6 = NamedSimplePattern::try_from((&_tmp0.fields()[1]).clone())?;
|
||||
for _tmp4 in &_tmp3[0..] {let _tmp5 = NamedPattern::try_from(_tmp4)?; _tmp2.push(_tmp5);}
|
||||
let _tmp6 = NamedSimplePattern::try_from((&_tmp0.fields()[1]))?;
|
||||
Ok(CompoundPattern::TuplePrefix {fixed: _tmp2, variable: std::boxed::Box::new(_tmp6)})
|
||||
}
|
||||
|
||||
|
@ -551,14 +544,13 @@ fn _any_parse_compound_pattern_dict(value: &_Any) -> std::result::Result<Compoun
|
|||
if _tmp0.label() != &*_any_::LIT_12_DICT { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp1 = ();
|
||||
if _tmp0.fields().len() < 1 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp2 = DictionaryEntries::try_from((&_tmp0.fields()[0]).clone())?;
|
||||
let _tmp2 = DictionaryEntries::try_from((&_tmp0.fields()[0]))?;
|
||||
Ok(CompoundPattern::Dict {entries: std::boxed::Box::new(_tmp2)})
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<_Any> for CompoundPattern {
|
||||
impl std::convert::TryFrom<&_Any> for CompoundPattern {
|
||||
type Error = _support::ParseError;
|
||||
fn try_from(value: _Any) -> std::result::Result<Self, Self::Error> {
|
||||
let value = &value;
|
||||
fn try_from(value: &_Any) -> std::result::Result<Self, _support::ParseError> {
|
||||
if let Ok(r) = _any_parse_compound_pattern_rec(value) { return Ok(r); }
|
||||
if let Ok(r) = _any_parse_compound_pattern_tuple(value) { return Ok(r); }
|
||||
if let Ok(r) = _any_parse_compound_pattern_tuple_prefix(value) { return Ok(r); }
|
||||
|
@ -615,10 +607,10 @@ fn _io_parse_definition_or(value: &preserves::value::IOValue) -> std::result::Re
|
|||
if _tmp0.fields().len() < 1 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp2 = (&_tmp0.fields()[0]).value().to_sequence()?;
|
||||
if _tmp2.len() < 2 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp3 = NamedAlternative::try_from((&_tmp2[0]).clone())?;
|
||||
let _tmp4 = NamedAlternative::try_from((&_tmp2[1]).clone())?;
|
||||
let _tmp3 = NamedAlternative::try_from((&_tmp2[0]))?;
|
||||
let _tmp4 = NamedAlternative::try_from((&_tmp2[1]))?;
|
||||
let mut _tmp5 = std::vec::Vec::new();
|
||||
for _tmp6 in &_tmp2[2..] {let _tmp7 = NamedAlternative::try_from(_tmp6.clone())?; _tmp5.push(_tmp7);}
|
||||
for _tmp6 in &_tmp2[2..] {let _tmp7 = NamedAlternative::try_from(_tmp6)?; _tmp5.push(_tmp7);}
|
||||
Ok(Definition::Or {
|
||||
pattern_0: std::boxed::Box::new(_tmp3),
|
||||
pattern_1: std::boxed::Box::new(_tmp4),
|
||||
|
@ -633,10 +625,10 @@ fn _io_parse_definition_and(value: &preserves::value::IOValue) -> std::result::R
|
|||
if _tmp0.fields().len() < 1 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp2 = (&_tmp0.fields()[0]).value().to_sequence()?;
|
||||
if _tmp2.len() < 2 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp3 = NamedPattern::try_from((&_tmp2[0]).clone())?;
|
||||
let _tmp4 = NamedPattern::try_from((&_tmp2[1]).clone())?;
|
||||
let _tmp3 = NamedPattern::try_from((&_tmp2[0]))?;
|
||||
let _tmp4 = NamedPattern::try_from((&_tmp2[1]))?;
|
||||
let mut _tmp5 = std::vec::Vec::new();
|
||||
for _tmp6 in &_tmp2[2..] {let _tmp7 = NamedPattern::try_from(_tmp6.clone())?; _tmp5.push(_tmp7);}
|
||||
for _tmp6 in &_tmp2[2..] {let _tmp7 = NamedPattern::try_from(_tmp6)?; _tmp5.push(_tmp7);}
|
||||
Ok(Definition::And {
|
||||
pattern_0: std::boxed::Box::new(_tmp3),
|
||||
pattern_1: std::boxed::Box::new(_tmp4),
|
||||
|
@ -645,14 +637,13 @@ fn _io_parse_definition_and(value: &preserves::value::IOValue) -> std::result::R
|
|||
}
|
||||
|
||||
fn _io_parse_definition_pattern(value: &preserves::value::IOValue) -> std::result::Result<Definition, _support::ParseError> {
|
||||
let _tmp0 = Pattern::try_from(value.clone())?;
|
||||
let _tmp0 = Pattern::try_from(value)?;
|
||||
Ok(Definition::Pattern(std::boxed::Box::new(_tmp0)))
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<preserves::value::IOValue> for Definition {
|
||||
impl std::convert::TryFrom<&preserves::value::IOValue> for Definition {
|
||||
type Error = _support::ParseError;
|
||||
fn try_from(value: preserves::value::IOValue) -> std::result::Result<Self, Self::Error> {
|
||||
let value = &value;
|
||||
fn try_from(value: &preserves::value::IOValue) -> std::result::Result<Self, _support::ParseError> {
|
||||
if let Ok(r) = _io_parse_definition_or(value) { return Ok(r); }
|
||||
if let Ok(r) = _io_parse_definition_and(value) { return Ok(r); }
|
||||
if let Ok(r) = _io_parse_definition_pattern(value) { return Ok(r); }
|
||||
|
@ -701,10 +692,10 @@ fn _any_parse_definition_or(value: &_Any) -> std::result::Result<Definition, _su
|
|||
if _tmp0.fields().len() < 1 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp2 = (&_tmp0.fields()[0]).value().to_sequence()?;
|
||||
if _tmp2.len() < 2 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp3 = NamedAlternative::try_from((&_tmp2[0]).clone())?;
|
||||
let _tmp4 = NamedAlternative::try_from((&_tmp2[1]).clone())?;
|
||||
let _tmp3 = NamedAlternative::try_from((&_tmp2[0]))?;
|
||||
let _tmp4 = NamedAlternative::try_from((&_tmp2[1]))?;
|
||||
let mut _tmp5 = std::vec::Vec::new();
|
||||
for _tmp6 in &_tmp2[2..] {let _tmp7 = NamedAlternative::try_from(_tmp6.clone())?; _tmp5.push(_tmp7);}
|
||||
for _tmp6 in &_tmp2[2..] {let _tmp7 = NamedAlternative::try_from(_tmp6)?; _tmp5.push(_tmp7);}
|
||||
Ok(Definition::Or {
|
||||
pattern_0: std::boxed::Box::new(_tmp3),
|
||||
pattern_1: std::boxed::Box::new(_tmp4),
|
||||
|
@ -719,10 +710,10 @@ fn _any_parse_definition_and(value: &_Any) -> std::result::Result<Definition, _s
|
|||
if _tmp0.fields().len() < 1 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp2 = (&_tmp0.fields()[0]).value().to_sequence()?;
|
||||
if _tmp2.len() < 2 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp3 = NamedPattern::try_from((&_tmp2[0]).clone())?;
|
||||
let _tmp4 = NamedPattern::try_from((&_tmp2[1]).clone())?;
|
||||
let _tmp3 = NamedPattern::try_from((&_tmp2[0]))?;
|
||||
let _tmp4 = NamedPattern::try_from((&_tmp2[1]))?;
|
||||
let mut _tmp5 = std::vec::Vec::new();
|
||||
for _tmp6 in &_tmp2[2..] {let _tmp7 = NamedPattern::try_from(_tmp6.clone())?; _tmp5.push(_tmp7);}
|
||||
for _tmp6 in &_tmp2[2..] {let _tmp7 = NamedPattern::try_from(_tmp6)?; _tmp5.push(_tmp7);}
|
||||
Ok(Definition::And {
|
||||
pattern_0: std::boxed::Box::new(_tmp3),
|
||||
pattern_1: std::boxed::Box::new(_tmp4),
|
||||
|
@ -731,14 +722,13 @@ fn _any_parse_definition_and(value: &_Any) -> std::result::Result<Definition, _s
|
|||
}
|
||||
|
||||
fn _any_parse_definition_pattern(value: &_Any) -> std::result::Result<Definition, _support::ParseError> {
|
||||
let _tmp0 = Pattern::try_from(value.clone())?;
|
||||
let _tmp0 = Pattern::try_from(value)?;
|
||||
Ok(Definition::Pattern(std::boxed::Box::new(_tmp0)))
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<_Any> for Definition {
|
||||
impl std::convert::TryFrom<&_Any> for Definition {
|
||||
type Error = _support::ParseError;
|
||||
fn try_from(value: _Any) -> std::result::Result<Self, Self::Error> {
|
||||
let value = &value;
|
||||
fn try_from(value: &_Any) -> std::result::Result<Self, _support::ParseError> {
|
||||
if let Ok(r) = _any_parse_definition_or(value) { return Ok(r); }
|
||||
if let Ok(r) = _any_parse_definition_and(value) { return Ok(r); }
|
||||
if let Ok(r) = _any_parse_definition_pattern(value) { return Ok(r); }
|
||||
|
@ -780,14 +770,13 @@ impl std::convert::From<&Definition> for _Any {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<preserves::value::IOValue> for Definitions {
|
||||
impl std::convert::TryFrom<&preserves::value::IOValue> for Definitions {
|
||||
type Error = _support::ParseError;
|
||||
fn try_from(value: preserves::value::IOValue) -> std::result::Result<Self, Self::Error> {
|
||||
let value = &value;
|
||||
fn try_from(value: &preserves::value::IOValue) -> std::result::Result<Self, _support::ParseError> {
|
||||
let mut _tmp0 = preserves::value::Map::new();
|
||||
for (_tmp1, _tmp2) in value.value().to_dictionary()? {
|
||||
let _tmp3 = _tmp1.value().to_symbol()?;
|
||||
let _tmp4 = Definition::try_from(_tmp2.clone())?;
|
||||
let _tmp4 = Definition::try_from(_tmp2)?;
|
||||
_tmp0.insert(_tmp3.clone(), _tmp4);
|
||||
}
|
||||
Ok(Definitions(_tmp0))
|
||||
|
@ -804,14 +793,13 @@ impl std::convert::From<&Definitions> for preserves::value::IOValue {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<_Any> for Definitions {
|
||||
impl std::convert::TryFrom<&_Any> for Definitions {
|
||||
type Error = _support::ParseError;
|
||||
fn try_from(value: _Any) -> std::result::Result<Self, Self::Error> {
|
||||
let value = &value;
|
||||
fn try_from(value: &_Any) -> std::result::Result<Self, _support::ParseError> {
|
||||
let mut _tmp0 = preserves::value::Map::new();
|
||||
for (_tmp1, _tmp2) in value.value().to_dictionary()? {
|
||||
let _tmp3 = _tmp1.value().to_symbol()?;
|
||||
let _tmp4 = Definition::try_from(_tmp2.clone())?;
|
||||
let _tmp4 = Definition::try_from(_tmp2)?;
|
||||
_tmp0.insert(_tmp3.clone(), _tmp4);
|
||||
}
|
||||
Ok(Definitions(_tmp0))
|
||||
|
@ -825,14 +813,13 @@ impl std::convert::From<&Definitions> for _Any {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<preserves::value::IOValue> for DictionaryEntries {
|
||||
impl std::convert::TryFrom<&preserves::value::IOValue> for DictionaryEntries {
|
||||
type Error = _support::ParseError;
|
||||
fn try_from(value: preserves::value::IOValue) -> std::result::Result<Self, Self::Error> {
|
||||
let value = &value;
|
||||
fn try_from(value: &preserves::value::IOValue) -> std::result::Result<Self, _support::ParseError> {
|
||||
let mut _tmp0 = preserves::value::Map::new();
|
||||
for (_tmp1, _tmp2) in value.value().to_dictionary()? {
|
||||
let _tmp3 = _Any::from_io_value(_tmp1)?;
|
||||
let _tmp4 = NamedSimplePattern::try_from(_tmp2.clone())?;
|
||||
let _tmp4 = NamedSimplePattern::try_from(_tmp2)?;
|
||||
_tmp0.insert(_tmp3.clone(), _tmp4);
|
||||
}
|
||||
Ok(DictionaryEntries(_tmp0))
|
||||
|
@ -846,14 +833,13 @@ impl std::convert::From<&DictionaryEntries> for preserves::value::IOValue {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<_Any> for DictionaryEntries {
|
||||
impl std::convert::TryFrom<&_Any> for DictionaryEntries {
|
||||
type Error = _support::ParseError;
|
||||
fn try_from(value: _Any) -> std::result::Result<Self, Self::Error> {
|
||||
let value = &value;
|
||||
fn try_from(value: &_Any) -> std::result::Result<Self, _support::ParseError> {
|
||||
let mut _tmp0 = preserves::value::Map::new();
|
||||
for (_tmp1, _tmp2) in value.value().to_dictionary()? {
|
||||
let _tmp3 = _tmp1;
|
||||
let _tmp4 = NamedSimplePattern::try_from(_tmp2.clone())?;
|
||||
let _tmp4 = NamedSimplePattern::try_from(_tmp2)?;
|
||||
_tmp0.insert(_tmp3.clone(), _tmp4);
|
||||
}
|
||||
Ok(DictionaryEntries(_tmp0))
|
||||
|
@ -868,7 +854,7 @@ impl std::convert::From<&DictionaryEntries> for _Any {
|
|||
}
|
||||
|
||||
fn _io_parse_embedded_type_name_ref(value: &preserves::value::IOValue) -> std::result::Result<EmbeddedTypeName, _support::ParseError> {
|
||||
let _tmp0 = Ref::try_from(value.clone())?;
|
||||
let _tmp0 = Ref::try_from(value)?;
|
||||
Ok(EmbeddedTypeName::Ref(std::boxed::Box::new(_tmp0)))
|
||||
}
|
||||
|
||||
|
@ -878,10 +864,9 @@ fn _io_parse_embedded_type_name_false(value: &preserves::value::IOValue) -> std:
|
|||
Ok(EmbeddedTypeName::False)
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<preserves::value::IOValue> for EmbeddedTypeName {
|
||||
impl std::convert::TryFrom<&preserves::value::IOValue> for EmbeddedTypeName {
|
||||
type Error = _support::ParseError;
|
||||
fn try_from(value: preserves::value::IOValue) -> std::result::Result<Self, Self::Error> {
|
||||
let value = &value;
|
||||
fn try_from(value: &preserves::value::IOValue) -> std::result::Result<Self, _support::ParseError> {
|
||||
if let Ok(r) = _io_parse_embedded_type_name_ref(value) { return Ok(r); }
|
||||
if let Ok(r) = _io_parse_embedded_type_name_false(value) { return Ok(r); }
|
||||
Err(_support::ParseError::ConformanceError)
|
||||
|
@ -898,7 +883,7 @@ impl std::convert::From<&EmbeddedTypeName> for preserves::value::IOValue {
|
|||
}
|
||||
|
||||
fn _any_parse_embedded_type_name_ref(value: &_Any) -> std::result::Result<EmbeddedTypeName, _support::ParseError> {
|
||||
let _tmp0 = Ref::try_from(value.clone())?;
|
||||
let _tmp0 = Ref::try_from(value)?;
|
||||
Ok(EmbeddedTypeName::Ref(std::boxed::Box::new(_tmp0)))
|
||||
}
|
||||
|
||||
|
@ -908,10 +893,9 @@ fn _any_parse_embedded_type_name_false(value: &_Any) -> std::result::Result<Embe
|
|||
Ok(EmbeddedTypeName::False)
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<_Any> for EmbeddedTypeName {
|
||||
impl std::convert::TryFrom<&_Any> for EmbeddedTypeName {
|
||||
type Error = _support::ParseError;
|
||||
fn try_from(value: _Any) -> std::result::Result<Self, Self::Error> {
|
||||
let value = &value;
|
||||
fn try_from(value: &_Any) -> std::result::Result<Self, _support::ParseError> {
|
||||
if let Ok(r) = _any_parse_embedded_type_name_ref(value) { return Ok(r); }
|
||||
if let Ok(r) = _any_parse_embedded_type_name_false(value) { return Ok(r); }
|
||||
Err(_support::ParseError::ConformanceError)
|
||||
|
@ -927,10 +911,9 @@ impl std::convert::From<&EmbeddedTypeName> for _Any {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<preserves::value::IOValue> for ModulePath {
|
||||
impl std::convert::TryFrom<&preserves::value::IOValue> for ModulePath {
|
||||
type Error = _support::ParseError;
|
||||
fn try_from(value: preserves::value::IOValue) -> std::result::Result<Self, Self::Error> {
|
||||
let value = &value;
|
||||
fn try_from(value: &preserves::value::IOValue) -> std::result::Result<Self, _support::ParseError> {
|
||||
let _tmp1 = value.value().to_sequence()?;
|
||||
let mut _tmp0 = std::vec::Vec::new();
|
||||
for _tmp2 in &_tmp1[0..] {let _tmp3 = _tmp2.value().to_symbol()?; _tmp0.push(_tmp3.clone());}
|
||||
|
@ -949,10 +932,9 @@ impl std::convert::From<&ModulePath> for preserves::value::IOValue {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<_Any> for ModulePath {
|
||||
impl std::convert::TryFrom<&_Any> for ModulePath {
|
||||
type Error = _support::ParseError;
|
||||
fn try_from(value: _Any) -> std::result::Result<Self, Self::Error> {
|
||||
let value = &value;
|
||||
fn try_from(value: &_Any) -> std::result::Result<Self, _support::ParseError> {
|
||||
let _tmp1 = value.value().to_sequence()?;
|
||||
let mut _tmp0 = std::vec::Vec::new();
|
||||
for _tmp2 in &_tmp1[0..] {let _tmp3 = _tmp2.value().to_symbol()?; _tmp0.push(_tmp3.clone());}
|
||||
|
@ -971,14 +953,13 @@ impl std::convert::From<&ModulePath> for _Any {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<preserves::value::IOValue> for Modules {
|
||||
impl std::convert::TryFrom<&preserves::value::IOValue> for Modules {
|
||||
type Error = _support::ParseError;
|
||||
fn try_from(value: preserves::value::IOValue) -> std::result::Result<Self, Self::Error> {
|
||||
let value = &value;
|
||||
fn try_from(value: &preserves::value::IOValue) -> std::result::Result<Self, _support::ParseError> {
|
||||
let mut _tmp0 = preserves::value::Map::new();
|
||||
for (_tmp1, _tmp2) in value.value().to_dictionary()? {
|
||||
let _tmp3 = ModulePath::try_from(_tmp1.clone())?;
|
||||
let _tmp4 = Schema::try_from(_tmp2.clone())?;
|
||||
let _tmp3 = ModulePath::try_from(_tmp1)?;
|
||||
let _tmp4 = Schema::try_from(_tmp2)?;
|
||||
_tmp0.insert(_tmp3, _tmp4);
|
||||
}
|
||||
Ok(Modules(_tmp0))
|
||||
|
@ -992,14 +973,13 @@ impl std::convert::From<&Modules> for preserves::value::IOValue {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<_Any> for Modules {
|
||||
impl std::convert::TryFrom<&_Any> for Modules {
|
||||
type Error = _support::ParseError;
|
||||
fn try_from(value: _Any) -> std::result::Result<Self, Self::Error> {
|
||||
let value = &value;
|
||||
fn try_from(value: &_Any) -> std::result::Result<Self, _support::ParseError> {
|
||||
let mut _tmp0 = preserves::value::Map::new();
|
||||
for (_tmp1, _tmp2) in value.value().to_dictionary()? {
|
||||
let _tmp3 = ModulePath::try_from(_tmp1.clone())?;
|
||||
let _tmp4 = Schema::try_from(_tmp2.clone())?;
|
||||
let _tmp3 = ModulePath::try_from(_tmp1)?;
|
||||
let _tmp4 = Schema::try_from(_tmp2)?;
|
||||
_tmp0.insert(_tmp3, _tmp4);
|
||||
}
|
||||
Ok(Modules(_tmp0))
|
||||
|
@ -1013,14 +993,13 @@ impl std::convert::From<&Modules> for _Any {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<preserves::value::IOValue> for NamedAlternative {
|
||||
impl std::convert::TryFrom<&preserves::value::IOValue> for NamedAlternative {
|
||||
type Error = _support::ParseError;
|
||||
fn try_from(value: preserves::value::IOValue) -> std::result::Result<Self, Self::Error> {
|
||||
let value = &value;
|
||||
fn try_from(value: &preserves::value::IOValue) -> std::result::Result<Self, _support::ParseError> {
|
||||
let _tmp0 = value.value().to_sequence()?;
|
||||
if _tmp0.len() < 2 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp1 = (&_tmp0[0]).value().to_string()?;
|
||||
let _tmp2 = Pattern::try_from((&_tmp0[1]).clone())?;
|
||||
let _tmp2 = Pattern::try_from((&_tmp0[1]))?;
|
||||
Ok(NamedAlternative {variant_label: _tmp1.clone(), pattern: _tmp2})
|
||||
}
|
||||
}
|
||||
|
@ -1037,14 +1016,13 @@ impl std::convert::From<&NamedAlternative> for preserves::value::IOValue {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<_Any> for NamedAlternative {
|
||||
impl std::convert::TryFrom<&_Any> for NamedAlternative {
|
||||
type Error = _support::ParseError;
|
||||
fn try_from(value: _Any) -> std::result::Result<Self, Self::Error> {
|
||||
let value = &value;
|
||||
fn try_from(value: &_Any) -> std::result::Result<Self, _support::ParseError> {
|
||||
let _tmp0 = value.value().to_sequence()?;
|
||||
if _tmp0.len() < 2 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp1 = (&_tmp0[0]).value().to_string()?;
|
||||
let _tmp2 = Pattern::try_from((&_tmp0[1]).clone())?;
|
||||
let _tmp2 = Pattern::try_from((&_tmp0[1]))?;
|
||||
Ok(NamedAlternative {variant_label: _tmp1.clone(), pattern: _tmp2})
|
||||
}
|
||||
}
|
||||
|
@ -1062,19 +1040,18 @@ impl std::convert::From<&NamedAlternative> for _Any {
|
|||
}
|
||||
|
||||
fn _io_parse_named_pattern_named(value: &preserves::value::IOValue) -> std::result::Result<NamedPattern, _support::ParseError> {
|
||||
let _tmp0 = Binding::try_from(value.clone())?;
|
||||
let _tmp0 = Binding::try_from(value)?;
|
||||
Ok(NamedPattern::Named(std::boxed::Box::new(_tmp0)))
|
||||
}
|
||||
|
||||
fn _io_parse_named_pattern_anonymous(value: &preserves::value::IOValue) -> std::result::Result<NamedPattern, _support::ParseError> {
|
||||
let _tmp0 = Pattern::try_from(value.clone())?;
|
||||
let _tmp0 = Pattern::try_from(value)?;
|
||||
Ok(NamedPattern::Anonymous(std::boxed::Box::new(_tmp0)))
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<preserves::value::IOValue> for NamedPattern {
|
||||
impl std::convert::TryFrom<&preserves::value::IOValue> for NamedPattern {
|
||||
type Error = _support::ParseError;
|
||||
fn try_from(value: preserves::value::IOValue) -> std::result::Result<Self, Self::Error> {
|
||||
let value = &value;
|
||||
fn try_from(value: &preserves::value::IOValue) -> std::result::Result<Self, _support::ParseError> {
|
||||
if let Ok(r) = _io_parse_named_pattern_named(value) { return Ok(r); }
|
||||
if let Ok(r) = _io_parse_named_pattern_anonymous(value) { return Ok(r); }
|
||||
Err(_support::ParseError::ConformanceError)
|
||||
|
@ -1091,19 +1068,18 @@ impl std::convert::From<&NamedPattern> for preserves::value::IOValue {
|
|||
}
|
||||
|
||||
fn _any_parse_named_pattern_named(value: &_Any) -> std::result::Result<NamedPattern, _support::ParseError> {
|
||||
let _tmp0 = Binding::try_from(value.clone())?;
|
||||
let _tmp0 = Binding::try_from(value)?;
|
||||
Ok(NamedPattern::Named(std::boxed::Box::new(_tmp0)))
|
||||
}
|
||||
|
||||
fn _any_parse_named_pattern_anonymous(value: &_Any) -> std::result::Result<NamedPattern, _support::ParseError> {
|
||||
let _tmp0 = Pattern::try_from(value.clone())?;
|
||||
let _tmp0 = Pattern::try_from(value)?;
|
||||
Ok(NamedPattern::Anonymous(std::boxed::Box::new(_tmp0)))
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<_Any> for NamedPattern {
|
||||
impl std::convert::TryFrom<&_Any> for NamedPattern {
|
||||
type Error = _support::ParseError;
|
||||
fn try_from(value: _Any) -> std::result::Result<Self, Self::Error> {
|
||||
let value = &value;
|
||||
fn try_from(value: &_Any) -> std::result::Result<Self, _support::ParseError> {
|
||||
if let Ok(r) = _any_parse_named_pattern_named(value) { return Ok(r); }
|
||||
if let Ok(r) = _any_parse_named_pattern_anonymous(value) { return Ok(r); }
|
||||
Err(_support::ParseError::ConformanceError)
|
||||
|
@ -1120,19 +1096,18 @@ impl std::convert::From<&NamedPattern> for _Any {
|
|||
}
|
||||
|
||||
fn _io_parse_named_simple_pattern_named(value: &preserves::value::IOValue) -> std::result::Result<NamedSimplePattern, _support::ParseError> {
|
||||
let _tmp0 = Binding::try_from(value.clone())?;
|
||||
let _tmp0 = Binding::try_from(value)?;
|
||||
Ok(NamedSimplePattern::Named(std::boxed::Box::new(_tmp0)))
|
||||
}
|
||||
|
||||
fn _io_parse_named_simple_pattern_anonymous(value: &preserves::value::IOValue) -> std::result::Result<NamedSimplePattern, _support::ParseError> {
|
||||
let _tmp0 = SimplePattern::try_from(value.clone())?;
|
||||
let _tmp0 = SimplePattern::try_from(value)?;
|
||||
Ok(NamedSimplePattern::Anonymous(std::boxed::Box::new(_tmp0)))
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<preserves::value::IOValue> for NamedSimplePattern {
|
||||
impl std::convert::TryFrom<&preserves::value::IOValue> for NamedSimplePattern {
|
||||
type Error = _support::ParseError;
|
||||
fn try_from(value: preserves::value::IOValue) -> std::result::Result<Self, Self::Error> {
|
||||
let value = &value;
|
||||
fn try_from(value: &preserves::value::IOValue) -> std::result::Result<Self, _support::ParseError> {
|
||||
if let Ok(r) = _io_parse_named_simple_pattern_named(value) { return Ok(r); }
|
||||
if let Ok(r) = _io_parse_named_simple_pattern_anonymous(value) { return Ok(r); }
|
||||
Err(_support::ParseError::ConformanceError)
|
||||
|
@ -1149,19 +1124,18 @@ impl std::convert::From<&NamedSimplePattern> for preserves::value::IOValue {
|
|||
}
|
||||
|
||||
fn _any_parse_named_simple_pattern_named(value: &_Any) -> std::result::Result<NamedSimplePattern, _support::ParseError> {
|
||||
let _tmp0 = Binding::try_from(value.clone())?;
|
||||
let _tmp0 = Binding::try_from(value)?;
|
||||
Ok(NamedSimplePattern::Named(std::boxed::Box::new(_tmp0)))
|
||||
}
|
||||
|
||||
fn _any_parse_named_simple_pattern_anonymous(value: &_Any) -> std::result::Result<NamedSimplePattern, _support::ParseError> {
|
||||
let _tmp0 = SimplePattern::try_from(value.clone())?;
|
||||
let _tmp0 = SimplePattern::try_from(value)?;
|
||||
Ok(NamedSimplePattern::Anonymous(std::boxed::Box::new(_tmp0)))
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<_Any> for NamedSimplePattern {
|
||||
impl std::convert::TryFrom<&_Any> for NamedSimplePattern {
|
||||
type Error = _support::ParseError;
|
||||
fn try_from(value: _Any) -> std::result::Result<Self, Self::Error> {
|
||||
let value = &value;
|
||||
fn try_from(value: &_Any) -> std::result::Result<Self, _support::ParseError> {
|
||||
if let Ok(r) = _any_parse_named_simple_pattern_named(value) { return Ok(r); }
|
||||
if let Ok(r) = _any_parse_named_simple_pattern_anonymous(value) { return Ok(r); }
|
||||
Err(_support::ParseError::ConformanceError)
|
||||
|
@ -1178,19 +1152,18 @@ impl std::convert::From<&NamedSimplePattern> for _Any {
|
|||
}
|
||||
|
||||
fn _io_parse_pattern_simple_pattern(value: &preserves::value::IOValue) -> std::result::Result<Pattern, _support::ParseError> {
|
||||
let _tmp0 = SimplePattern::try_from(value.clone())?;
|
||||
let _tmp0 = SimplePattern::try_from(value)?;
|
||||
Ok(Pattern::SimplePattern(std::boxed::Box::new(_tmp0)))
|
||||
}
|
||||
|
||||
fn _io_parse_pattern_compound_pattern(value: &preserves::value::IOValue) -> std::result::Result<Pattern, _support::ParseError> {
|
||||
let _tmp0 = CompoundPattern::try_from(value.clone())?;
|
||||
let _tmp0 = CompoundPattern::try_from(value)?;
|
||||
Ok(Pattern::CompoundPattern(std::boxed::Box::new(_tmp0)))
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<preserves::value::IOValue> for Pattern {
|
||||
impl std::convert::TryFrom<&preserves::value::IOValue> for Pattern {
|
||||
type Error = _support::ParseError;
|
||||
fn try_from(value: preserves::value::IOValue) -> std::result::Result<Self, Self::Error> {
|
||||
let value = &value;
|
||||
fn try_from(value: &preserves::value::IOValue) -> std::result::Result<Self, _support::ParseError> {
|
||||
if let Ok(r) = _io_parse_pattern_simple_pattern(value) { return Ok(r); }
|
||||
if let Ok(r) = _io_parse_pattern_compound_pattern(value) { return Ok(r); }
|
||||
Err(_support::ParseError::ConformanceError)
|
||||
|
@ -1207,19 +1180,18 @@ impl std::convert::From<&Pattern> for preserves::value::IOValue {
|
|||
}
|
||||
|
||||
fn _any_parse_pattern_simple_pattern(value: &_Any) -> std::result::Result<Pattern, _support::ParseError> {
|
||||
let _tmp0 = SimplePattern::try_from(value.clone())?;
|
||||
let _tmp0 = SimplePattern::try_from(value)?;
|
||||
Ok(Pattern::SimplePattern(std::boxed::Box::new(_tmp0)))
|
||||
}
|
||||
|
||||
fn _any_parse_pattern_compound_pattern(value: &_Any) -> std::result::Result<Pattern, _support::ParseError> {
|
||||
let _tmp0 = CompoundPattern::try_from(value.clone())?;
|
||||
let _tmp0 = CompoundPattern::try_from(value)?;
|
||||
Ok(Pattern::CompoundPattern(std::boxed::Box::new(_tmp0)))
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<_Any> for Pattern {
|
||||
impl std::convert::TryFrom<&_Any> for Pattern {
|
||||
type Error = _support::ParseError;
|
||||
fn try_from(value: _Any) -> std::result::Result<Self, Self::Error> {
|
||||
let value = &value;
|
||||
fn try_from(value: &_Any) -> std::result::Result<Self, _support::ParseError> {
|
||||
if let Ok(r) = _any_parse_pattern_simple_pattern(value) { return Ok(r); }
|
||||
if let Ok(r) = _any_parse_pattern_compound_pattern(value) { return Ok(r); }
|
||||
Err(_support::ParseError::ConformanceError)
|
||||
|
@ -1235,15 +1207,14 @@ impl std::convert::From<&Pattern> for _Any {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<preserves::value::IOValue> for Ref {
|
||||
impl std::convert::TryFrom<&preserves::value::IOValue> for Ref {
|
||||
type Error = _support::ParseError;
|
||||
fn try_from(value: preserves::value::IOValue) -> std::result::Result<Self, Self::Error> {
|
||||
let value = &value;
|
||||
fn try_from(value: &preserves::value::IOValue) -> std::result::Result<Self, _support::ParseError> {
|
||||
let _tmp0 = value.value().to_record(None)?;
|
||||
if _tmp0.label() != &*_io_::LIT_16_REF { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp1 = ();
|
||||
if _tmp0.fields().len() < 2 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp2 = ModulePath::try_from((&_tmp0.fields()[0]).clone())?;
|
||||
let _tmp2 = ModulePath::try_from((&_tmp0.fields()[0]))?;
|
||||
let _tmp3 = (&_tmp0.fields()[1]).value().to_symbol()?;
|
||||
Ok(Ref {module: _tmp2, name: _tmp3.clone()})
|
||||
}
|
||||
|
@ -1261,15 +1232,14 @@ impl std::convert::From<&Ref> for preserves::value::IOValue {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<_Any> for Ref {
|
||||
impl std::convert::TryFrom<&_Any> for Ref {
|
||||
type Error = _support::ParseError;
|
||||
fn try_from(value: _Any) -> std::result::Result<Self, Self::Error> {
|
||||
let value = &value;
|
||||
fn try_from(value: &_Any) -> std::result::Result<Self, _support::ParseError> {
|
||||
let _tmp0 = value.value().to_record(None)?;
|
||||
if _tmp0.label() != &*_any_::LIT_16_REF { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp1 = ();
|
||||
if _tmp0.fields().len() < 2 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp2 = ModulePath::try_from((&_tmp0.fields()[0]).clone())?;
|
||||
let _tmp2 = ModulePath::try_from((&_tmp0.fields()[0]))?;
|
||||
let _tmp3 = (&_tmp0.fields()[1]).value().to_symbol()?;
|
||||
Ok(Ref {module: _tmp2, name: _tmp3.clone()})
|
||||
}
|
||||
|
@ -1287,21 +1257,20 @@ impl std::convert::From<&Ref> for _Any {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<preserves::value::IOValue> for Schema {
|
||||
impl std::convert::TryFrom<&preserves::value::IOValue> for Schema {
|
||||
type Error = _support::ParseError;
|
||||
fn try_from(value: preserves::value::IOValue) -> std::result::Result<Self, Self::Error> {
|
||||
let value = &value;
|
||||
fn try_from(value: &preserves::value::IOValue) -> std::result::Result<Self, _support::ParseError> {
|
||||
let _tmp0 = value.value().to_record(None)?;
|
||||
if _tmp0.label() != &*_io_::LIT_17_SCHEMA { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp1 = ();
|
||||
if _tmp0.fields().len() < 1 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp2 = (&_tmp0.fields()[0]).value().to_dictionary()?;
|
||||
let _tmp3 = _tmp2.get(&*_io_::LIT_18_DEFINITIONS).ok_or(_support::ParseError::ConformanceError)?;
|
||||
let _tmp4 = Definitions::try_from(_tmp3.clone())?;
|
||||
let _tmp4 = Definitions::try_from(_tmp3)?;
|
||||
let _tmp5 = _tmp2.get(&*_io_::LIT_19_EMBEDDED_TYPE).ok_or(_support::ParseError::ConformanceError)?;
|
||||
let _tmp6 = EmbeddedTypeName::try_from(_tmp5.clone())?;
|
||||
let _tmp6 = EmbeddedTypeName::try_from(_tmp5)?;
|
||||
let _tmp7 = _tmp2.get(&*_io_::LIT_20_VERSION).ok_or(_support::ParseError::ConformanceError)?;
|
||||
let _tmp8 = Version::try_from(_tmp7.clone())?;
|
||||
let _tmp8 = Version::try_from(_tmp7)?;
|
||||
Ok(Schema {definitions: _tmp4, embedded_type: _tmp6, version: _tmp8})
|
||||
}
|
||||
}
|
||||
|
@ -1325,21 +1294,20 @@ impl std::convert::From<&Schema> for preserves::value::IOValue {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<_Any> for Schema {
|
||||
impl std::convert::TryFrom<&_Any> for Schema {
|
||||
type Error = _support::ParseError;
|
||||
fn try_from(value: _Any) -> std::result::Result<Self, Self::Error> {
|
||||
let value = &value;
|
||||
fn try_from(value: &_Any) -> std::result::Result<Self, _support::ParseError> {
|
||||
let _tmp0 = value.value().to_record(None)?;
|
||||
if _tmp0.label() != &*_any_::LIT_17_SCHEMA { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp1 = ();
|
||||
if _tmp0.fields().len() < 1 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp2 = (&_tmp0.fields()[0]).value().to_dictionary()?;
|
||||
let _tmp3 = _tmp2.get(&*_any_::LIT_18_DEFINITIONS).ok_or(_support::ParseError::ConformanceError)?;
|
||||
let _tmp4 = Definitions::try_from(_tmp3.clone())?;
|
||||
let _tmp4 = Definitions::try_from(_tmp3)?;
|
||||
let _tmp5 = _tmp2.get(&*_any_::LIT_19_EMBEDDED_TYPE).ok_or(_support::ParseError::ConformanceError)?;
|
||||
let _tmp6 = EmbeddedTypeName::try_from(_tmp5.clone())?;
|
||||
let _tmp6 = EmbeddedTypeName::try_from(_tmp5)?;
|
||||
let _tmp7 = _tmp2.get(&*_any_::LIT_20_VERSION).ok_or(_support::ParseError::ConformanceError)?;
|
||||
let _tmp8 = Version::try_from(_tmp7.clone())?;
|
||||
let _tmp8 = Version::try_from(_tmp7)?;
|
||||
Ok(Schema {definitions: _tmp4, embedded_type: _tmp6, version: _tmp8})
|
||||
}
|
||||
}
|
||||
|
@ -1374,7 +1342,7 @@ fn _io_parse_simple_pattern_atom(value: &preserves::value::IOValue) -> std::resu
|
|||
if _tmp0.label() != &*_io_::LIT_22_ATOM { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp1 = ();
|
||||
if _tmp0.fields().len() < 1 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp2 = AtomKind::try_from((&_tmp0.fields()[0]).clone())?;
|
||||
let _tmp2 = AtomKind::try_from((&_tmp0.fields()[0]))?;
|
||||
Ok(SimplePattern::Atom {atom_kind: std::boxed::Box::new(_tmp2)})
|
||||
}
|
||||
|
||||
|
@ -1383,7 +1351,7 @@ fn _io_parse_simple_pattern_embedded(value: &preserves::value::IOValue) -> std::
|
|||
if _tmp0.label() != &*_io_::LIT_23_EMBEDDED { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp1 = ();
|
||||
if _tmp0.fields().len() < 1 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp2 = SimplePattern::try_from((&_tmp0.fields()[0]).clone())?;
|
||||
let _tmp2 = SimplePattern::try_from((&_tmp0.fields()[0]))?;
|
||||
Ok(SimplePattern::Embedded {interface: std::boxed::Box::new(_tmp2)})
|
||||
}
|
||||
|
||||
|
@ -1401,7 +1369,7 @@ fn _io_parse_simple_pattern_seqof(value: &preserves::value::IOValue) -> std::res
|
|||
if _tmp0.label() != &*_io_::LIT_25_SEQOF { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp1 = ();
|
||||
if _tmp0.fields().len() < 1 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp2 = SimplePattern::try_from((&_tmp0.fields()[0]).clone())?;
|
||||
let _tmp2 = SimplePattern::try_from((&_tmp0.fields()[0]))?;
|
||||
Ok(SimplePattern::Seqof {pattern: std::boxed::Box::new(_tmp2)})
|
||||
}
|
||||
|
||||
|
@ -1410,7 +1378,7 @@ fn _io_parse_simple_pattern_setof(value: &preserves::value::IOValue) -> std::res
|
|||
if _tmp0.label() != &*_io_::LIT_26_SETOF { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp1 = ();
|
||||
if _tmp0.fields().len() < 1 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp2 = SimplePattern::try_from((&_tmp0.fields()[0]).clone())?;
|
||||
let _tmp2 = SimplePattern::try_from((&_tmp0.fields()[0]))?;
|
||||
Ok(SimplePattern::Setof {pattern: std::boxed::Box::new(_tmp2)})
|
||||
}
|
||||
|
||||
|
@ -1419,20 +1387,19 @@ fn _io_parse_simple_pattern_dictof(value: &preserves::value::IOValue) -> std::re
|
|||
if _tmp0.label() != &*_io_::LIT_27_DICTOF { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp1 = ();
|
||||
if _tmp0.fields().len() < 2 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp2 = SimplePattern::try_from((&_tmp0.fields()[0]).clone())?;
|
||||
let _tmp3 = SimplePattern::try_from((&_tmp0.fields()[1]).clone())?;
|
||||
let _tmp2 = SimplePattern::try_from((&_tmp0.fields()[0]))?;
|
||||
let _tmp3 = SimplePattern::try_from((&_tmp0.fields()[1]))?;
|
||||
Ok(SimplePattern::Dictof {key: std::boxed::Box::new(_tmp2), value: std::boxed::Box::new(_tmp3)})
|
||||
}
|
||||
|
||||
fn _io_parse_simple_pattern_ref(value: &preserves::value::IOValue) -> std::result::Result<SimplePattern, _support::ParseError> {
|
||||
let _tmp0 = Ref::try_from(value.clone())?;
|
||||
let _tmp0 = Ref::try_from(value)?;
|
||||
Ok(SimplePattern::Ref(std::boxed::Box::new(_tmp0)))
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<preserves::value::IOValue> for SimplePattern {
|
||||
impl std::convert::TryFrom<&preserves::value::IOValue> for SimplePattern {
|
||||
type Error = _support::ParseError;
|
||||
fn try_from(value: preserves::value::IOValue) -> std::result::Result<Self, Self::Error> {
|
||||
let value = &value;
|
||||
fn try_from(value: &preserves::value::IOValue) -> std::result::Result<Self, _support::ParseError> {
|
||||
if let Ok(r) = _io_parse_simple_pattern_any(value) { return Ok(r); }
|
||||
if let Ok(r) = _io_parse_simple_pattern_atom(value) { return Ok(r); }
|
||||
if let Ok(r) = _io_parse_simple_pattern_embedded(value) { return Ok(r); }
|
||||
|
@ -1496,7 +1463,7 @@ fn _any_parse_simple_pattern_atom(value: &_Any) -> std::result::Result<SimplePat
|
|||
if _tmp0.label() != &*_any_::LIT_22_ATOM { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp1 = ();
|
||||
if _tmp0.fields().len() < 1 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp2 = AtomKind::try_from((&_tmp0.fields()[0]).clone())?;
|
||||
let _tmp2 = AtomKind::try_from((&_tmp0.fields()[0]))?;
|
||||
Ok(SimplePattern::Atom {atom_kind: std::boxed::Box::new(_tmp2)})
|
||||
}
|
||||
|
||||
|
@ -1505,7 +1472,7 @@ fn _any_parse_simple_pattern_embedded(value: &_Any) -> std::result::Result<Simpl
|
|||
if _tmp0.label() != &*_any_::LIT_23_EMBEDDED { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp1 = ();
|
||||
if _tmp0.fields().len() < 1 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp2 = SimplePattern::try_from((&_tmp0.fields()[0]).clone())?;
|
||||
let _tmp2 = SimplePattern::try_from((&_tmp0.fields()[0]))?;
|
||||
Ok(SimplePattern::Embedded {interface: std::boxed::Box::new(_tmp2)})
|
||||
}
|
||||
|
||||
|
@ -1523,7 +1490,7 @@ fn _any_parse_simple_pattern_seqof(value: &_Any) -> std::result::Result<SimplePa
|
|||
if _tmp0.label() != &*_any_::LIT_25_SEQOF { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp1 = ();
|
||||
if _tmp0.fields().len() < 1 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp2 = SimplePattern::try_from((&_tmp0.fields()[0]).clone())?;
|
||||
let _tmp2 = SimplePattern::try_from((&_tmp0.fields()[0]))?;
|
||||
Ok(SimplePattern::Seqof {pattern: std::boxed::Box::new(_tmp2)})
|
||||
}
|
||||
|
||||
|
@ -1532,7 +1499,7 @@ fn _any_parse_simple_pattern_setof(value: &_Any) -> std::result::Result<SimplePa
|
|||
if _tmp0.label() != &*_any_::LIT_26_SETOF { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp1 = ();
|
||||
if _tmp0.fields().len() < 1 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp2 = SimplePattern::try_from((&_tmp0.fields()[0]).clone())?;
|
||||
let _tmp2 = SimplePattern::try_from((&_tmp0.fields()[0]))?;
|
||||
Ok(SimplePattern::Setof {pattern: std::boxed::Box::new(_tmp2)})
|
||||
}
|
||||
|
||||
|
@ -1541,20 +1508,19 @@ fn _any_parse_simple_pattern_dictof(value: &_Any) -> std::result::Result<SimpleP
|
|||
if _tmp0.label() != &*_any_::LIT_27_DICTOF { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp1 = ();
|
||||
if _tmp0.fields().len() < 2 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp2 = SimplePattern::try_from((&_tmp0.fields()[0]).clone())?;
|
||||
let _tmp3 = SimplePattern::try_from((&_tmp0.fields()[1]).clone())?;
|
||||
let _tmp2 = SimplePattern::try_from((&_tmp0.fields()[0]))?;
|
||||
let _tmp3 = SimplePattern::try_from((&_tmp0.fields()[1]))?;
|
||||
Ok(SimplePattern::Dictof {key: std::boxed::Box::new(_tmp2), value: std::boxed::Box::new(_tmp3)})
|
||||
}
|
||||
|
||||
fn _any_parse_simple_pattern_ref(value: &_Any) -> std::result::Result<SimplePattern, _support::ParseError> {
|
||||
let _tmp0 = Ref::try_from(value.clone())?;
|
||||
let _tmp0 = Ref::try_from(value)?;
|
||||
Ok(SimplePattern::Ref(std::boxed::Box::new(_tmp0)))
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<_Any> for SimplePattern {
|
||||
impl std::convert::TryFrom<&_Any> for SimplePattern {
|
||||
type Error = _support::ParseError;
|
||||
fn try_from(value: _Any) -> std::result::Result<Self, Self::Error> {
|
||||
let value = &value;
|
||||
fn try_from(value: &_Any) -> std::result::Result<Self, _support::ParseError> {
|
||||
if let Ok(r) = _any_parse_simple_pattern_any(value) { return Ok(r); }
|
||||
if let Ok(r) = _any_parse_simple_pattern_atom(value) { return Ok(r); }
|
||||
if let Ok(r) = _any_parse_simple_pattern_embedded(value) { return Ok(r); }
|
||||
|
@ -1607,10 +1573,9 @@ impl std::convert::From<&SimplePattern> for _Any {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<preserves::value::IOValue> for Version {
|
||||
impl std::convert::TryFrom<&preserves::value::IOValue> for Version {
|
||||
type Error = _support::ParseError;
|
||||
fn try_from(value: preserves::value::IOValue) -> std::result::Result<Self, Self::Error> {
|
||||
let value = &value;
|
||||
fn try_from(value: &preserves::value::IOValue) -> std::result::Result<Self, _support::ParseError> {
|
||||
if value != &*_io_::LIT_28_1 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp0 = ();
|
||||
Ok(Version)
|
||||
|
@ -1621,10 +1586,9 @@ impl std::convert::From<&Version> for preserves::value::IOValue {
|
|||
fn from(value: &Version) -> Self {let Version = value; (&*_io_::LIT_28_1).clone()}
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<_Any> for Version {
|
||||
impl std::convert::TryFrom<&_Any> for Version {
|
||||
type Error = _support::ParseError;
|
||||
fn try_from(value: _Any) -> std::result::Result<Self, Self::Error> {
|
||||
let value = &value;
|
||||
fn try_from(value: &_Any) -> std::result::Result<Self, _support::ParseError> {
|
||||
if value != &*_any_::LIT_28_1 { return Err(_support::ParseError::ConformanceError); }
|
||||
let _tmp0 = ();
|
||||
Ok(Version)
|
||||
|
|
Loading…
Reference in New Issue