aboutsummaryrefslogtreecommitdiff
path: root/src/classes/streaminginfo.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/classes/streaminginfo.rs')
-rw-r--r--src/classes/streaminginfo.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/classes/streaminginfo.rs b/src/classes/streaminginfo.rs
new file mode 100644
index 0000000..3ab271d
--- /dev/null
+++ b/src/classes/streaminginfo.rs
@@ -0,0 +1,22 @@
+use crate::object::Value;
+use anyhow::Result;
+use serde::Serialize;
+
+use super::FromValue;
+
+#[derive(Debug, Serialize)]
+pub struct StreamingInfo {
+ pub offset: u32,
+ pub path: String,
+ pub size: u32,
+}
+impl FromValue for StreamingInfo {
+ fn from_value(v: Value) -> Result<Self> {
+ let fields = v.as_class("StreamingInfo").unwrap();
+ Ok(StreamingInfo {
+ offset: fields["offset"].as_u32().unwrap(),
+ size: fields["size"].as_u32().unwrap(),
+ path: fields["path"].to_owned().as_string().unwrap(),
+ })
+ }
+}