stac_api/
collections.rs

1use serde::{Deserialize, Serialize};
2use serde_json::{Map, Value};
3use stac::{Collection, Href, Link};
4use stac_derive::{Links, SelfHref};
5
6/// Object containing an array of collections and an array of links.
7#[derive(Debug, Serialize, Deserialize, SelfHref, Links)]
8pub struct Collections {
9    /// The [Collection] objects in the [stac::Catalog].
10    pub collections: Vec<Collection>,
11
12    /// The [stac::Link] relations.
13    pub links: Vec<Link>,
14
15    /// Additional fields.
16    #[serde(flatten)]
17    pub additional_fields: Map<String, Value>,
18
19    #[serde(skip)]
20    self_href: Option<Href>,
21}
22
23impl From<Vec<Collection>> for Collections {
24    fn from(collections: Vec<Collection>) -> Collections {
25        Collections {
26            collections,
27            links: Vec::new(),
28            additional_fields: Map::new(),
29            self_href: None,
30        }
31    }
32}