credential_exchange_format/
extensions.rs

1use serde::{Deserialize, Serialize};
2
3#[cfg(doc)]
4use crate::{Account, Collection, Item};
5
6mod shared;
7
8pub use self::shared::*;
9
10/// An [Extension] is a generic object that can be used to extend the [Item] or [Account] with
11/// additional information.
12#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
13#[serde(tag = "name", rename_all = "kebab-case")]
14#[non_exhaustive]
15pub enum Extension<E = ()> {
16    /// Defines a sharing relationship of [`Collection`] or [`Item`] between different user
17    /// accounts or groups.
18    Shared(SharedExtension),
19    #[serde(untagged)]
20    /// External extensions defined by the implementor of this crate.
21    External(E),
22    /// Unknown extension
23    #[serde(untagged)]
24    Unknown(serde_json::Value),
25}