martin-g commented on code in PR #401:
URL: https://github.com/apache/avro-rs/pull/401#discussion_r2689495466
##########
avro_derive/src/lib.rs:
##########
@@ -267,34 +267,9 @@ fn get_data_enum_schema_def(
/// Takes in the Tokens of a type and returns the tokens of an expression with
return type `Schema`
fn type_to_schema_expr(ty: &Type) -> Result<TokenStream, Vec<syn::Error>> {
if let Type::Path(p) = ty {
- let type_string = p.path.segments.last().unwrap().ident.to_string();
-
- let schema = match &type_string[..] {
- "bool" => quote! {apache_avro::schema::Schema::Boolean},
- "i8" | "i16" | "i32" | "u8" | "u16" => quote!
{apache_avro::schema::Schema::Int},
- "u32" | "i64" => quote! {apache_avro::schema::Schema::Long},
- "f32" => quote! {apache_avro::schema::Schema::Float},
- "f64" => quote! {apache_avro::schema::Schema::Double},
- "String" | "str" => quote! {apache_avro::schema::Schema::String},
- "char" => {
- return Err(vec![syn::Error::new_spanned(
- ty,
- "AvroSchema: Cannot guarantee successful deserialization
of this type",
Review Comment:
Sounds good!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]