work
[pspp] / rust / src / raw.rs
index 3f7309c7ce67cb0584a83c2efb1f415ec1100674..e017f74ac494d4cce3afcc516112167d0c148b0c 100644 (file)
@@ -824,6 +824,20 @@ impl ExtensionRecord for FloatInfo {
     }
 }
 
+pub struct Encoding(pub String);
+
+impl ExtensionRecord for Encoding {
+    const SIZE: Option<u32> = Some(1);
+    const COUNT: Option<u32> = None;
+    const NAME: &'static str = "encoding record";
+
+    fn parse(ext: &Extension, endian: Endian) -> Result<Self, Error>{
+        ext.check_size::<Self>()?;
+
+        Ok(Encoding(String::from_utf8(ext.data)?))
+    }
+}
+
 pub struct Extension {
     /// Offset from the start of the file to the start of the record.
     pub offset: u64,