FromJson

Trait FromJson 

Source
pub trait FromJson: DeserializeOwned {
    // Provided method
    fn from_json_slice(slice: &[u8]) -> Result<Self> { ... }
}
Expand description

Create a STAC object from JSON.

Provided Methods§

Source

fn from_json_slice(slice: &[u8]) -> Result<Self>

Creates an object from JSON bytes.

§Examples
use std::{fs::File, io::Read};
use stac::{Item, FromJson};

let mut buf = Vec::new();
File::open("examples/simple-item.json").unwrap().read_to_end(&mut buf).unwrap();
let item = Item::from_json_slice(&buf).unwrap();

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§