Skip to main content

from_file

Function from_file 

Source
pub fn from_file<T: DeserializeOwned>(path: impl AsRef<Path>) -> Result<T>
Available on crate feature serde only.
Expand description

Deserializes the root element of an ABX file into T.

See from_slice.

§Errors

Same as from_slice, plus AbxError::Io if the file cannot be opened or read.

§Examples

use serde::Deserialize;

#[derive(Deserialize)]
struct User {
    id: u32,
    name: String,
}

let user: User = android_abx::from_file("/data/system/users/0.xml")?;