Trait ToNdjson

Source
pub trait ToNdjson: Serialize {
    // Provided methods
    fn to_ndjson_writer(&self, writer: impl Write) -> Result<()> { ... }
    fn to_ndjson_vec(&self) -> Result<Vec<u8>> { ... }
}
Expand description

Write a STAC object to newline-delimited JSON.

Provided Methods§

Source

fn to_ndjson_writer(&self, writer: impl Write) -> Result<()>

Writes a value to a writer as newline-delimited JSON.

§Examples
use stac::{ToNdjson, ItemCollection, Item};

let item_collection: ItemCollection = vec![Item::new("a"), Item::new("b")].into();
let mut buf = Vec::new();
item_collection.to_ndjson_writer(&mut buf).unwrap();
Source

fn to_ndjson_vec(&self) -> Result<Vec<u8>>

Writes a value as newline-delimited JSON bytes.

§Examples
use stac::{ToNdjson, Item, ItemCollection};

let item_collection: ItemCollection = vec![Item::new("a"), Item::new("b")].into();
let bytes = item_collection.to_ndjson_vec().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.

Implementations on Foreign Types§

Source§

impl ToNdjson for Value

Implementors§