caio.co/de/cantine

Move Filterable::Schema::try_from out of TryFrom

Id
8073c3f4de3c614aeb90c1500311759f0b7954fa
Author
Caio
Commit time
2020-02-08T11:34:47+01:00

Modified cantine_derive/tests/filter_query.rs

@@ -1,5 +1,3
-use std::convert::TryFrom;
-
use tantivy::{
schema::{SchemaBuilder, Value, FAST, INDEXED},
Document,

Modified cantine_derive/internal/src/lib.rs

@@ -223,9 +223,7
type Error = tantivy::TantivyError;

fn try_from(schema: &tantivy::schema::Schema) -> Result<Self, Self::Error> {
- Ok(Self {
- #(#try_from_decls),*
- })
+ <#index_name>::try_from(schema)
}
}

@@ -260,6 +258,12
}

new
+ }
+
+ pub fn try_from(schema: &tantivy::schema::Schema) -> tantivy::Result<Self> {
+ Ok(Self {
+ #(#try_from_decls),*
+ })
}
}
}