aboutsummaryrefslogtreecommitdiff
path: root/src/classes/streaminginfo.rs
blob: bb0b5e11d649f89e956cf024e52bffbca30b884c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use crate::object::{Value, parser::FromValue};
use anyhow::Result;
use serde::Serialize;

#[derive(Debug, Serialize)]
pub struct StreamingInfo {
    pub offset: u64,
    pub path: String,
    pub size: u32,
}
impl FromValue for StreamingInfo {
    fn from_value(v: Value) -> Result<Self> {
        let mut fields = v.as_class("StreamingInfo").unwrap();
        Ok(StreamingInfo {
            offset: fields.field("offset")?,
            size: fields.field("size")?,
            path: fields.field("path")?,
        })
    }
}