You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a dbase file that contains a Memo field, however I'm not sure what type I should put in the structure, and there doesn't appear to be any way to skip over a field.
#[derive(serde::Deserialize)]pubstructRecord{#[serde(rename = "DESCRIPTION")]description:Option<String>}fnmain(){letmut reader = dbase::Reader::from_path("existing_database.dbf").unwrap();let records = reader.read_as::<Record>();dbg!(records);}
This returns the following error:
[src\main.rs:90] records = Err(Error{record_num:0,field:Some(FieldInfo{name:"DESCRIPTION",field_type:Memo,// trimmed extra data),kind:BadConversion(FieldTypeNotAsExpected{expected:Character,actual:Memo,},),},)
As a workaround, I implemented the unit type in de.rs and simply make the type ():
index 3a7037b..d487227 100644
--- a/src/de.rs
+++ b/src/de.rs
@@ -219,11 +219,13 @@ where
}
}
- fn deserialize_unit<V>(self, _visitor: V) -> Result<<V as Visitor<'de>>::Value, Self::Error>
+ fn deserialize_unit<V>(self, visitor: V) -> Result<<V as Visitor<'de>>::Value, Self::Error>
where
V: Visitor<'de>,
{
- unimplemented!("DBase cannot deserialize unit")
+ self.skip_next_field()?;
+ visitor.visit_unit()
}
fn deserialize_unit_struct<V>(
Is there another type that I should be using? It would be nice to not skip over this field in the future if I end up needing it.
The text was updated successfully, but these errors were encountered:
I have a dbase file that contains a Memo field, however I'm not sure what type I should put in the structure, and there doesn't appear to be any way to skip over a field.
This returns the following error:
As a workaround, I implemented the unit type in de.rs and simply make the type ():
Is there another type that I should be using? It would be nice to not skip over this field in the future if I end up needing it.
The text was updated successfully, but these errors were encountered: