aboutsummaryrefslogtreecommitdiff
path: root/src/classes/streaminginfo.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-03-12 22:39:58 +0100
committermetamuffin <metamuffin@disroot.org>2025-03-12 22:39:58 +0100
commit5555c8bbefb4f52f5002603eb91b6c95cbdd97e4 (patch)
tree208e88359deb3cf5f7e2a4135693f12d76ad97e1 /src/classes/streaminginfo.rs
parent4906844cbfd2717a29b434fb7d8f90c5117fddd5 (diff)
downloadunity-tools-5555c8bbefb4f52f5002603eb91b6c95cbdd97e4.tar
unity-tools-5555c8bbefb4f52f5002603eb91b6c95cbdd97e4.tar.bz2
unity-tools-5555c8bbefb4f52f5002603eb91b6c95cbdd97e4.tar.zst
more parsing helpers
Diffstat (limited to 'src/classes/streaminginfo.rs')
-rw-r--r--src/classes/streaminginfo.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/classes/streaminginfo.rs b/src/classes/streaminginfo.rs
index 1f8cadb..bb0b5e1 100644
--- a/src/classes/streaminginfo.rs
+++ b/src/classes/streaminginfo.rs
@@ -1,9 +1,7 @@
-use crate::object::Value;
+use crate::object::{Value, parser::FromValue};
use anyhow::Result;
use serde::Serialize;
-use super::FromValue;
-
#[derive(Debug, Serialize)]
pub struct StreamingInfo {
pub offset: u64,
@@ -12,11 +10,11 @@ pub struct StreamingInfo {
}
impl FromValue for StreamingInfo {
fn from_value(v: Value) -> Result<Self> {
- let fields = v.as_class("StreamingInfo").unwrap();
+ let mut fields = v.as_class("StreamingInfo").unwrap();
Ok(StreamingInfo {
- offset: fields["offset"].as_u64().unwrap(),
- size: fields["size"].as_u32().unwrap(),
- path: fields["path"].to_owned().as_string().unwrap(),
+ offset: fields.field("offset")?,
+ size: fields.field("size")?,
+ path: fields.field("path")?,
})
}
}