Skip to main content

Extension

Trait Extension 

Source
pub trait Extension:
    Any
    + Debug
    + Clone
    + PartialEq
    + Send
    + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn fallback(&self) -> Atom<'_>;
}
Expand description

A type that can be passed through deser as an extension to the data model.

This is implemented for extension types without lifetimes, which covers most extensions. Types that borrow data implement BorrowedExtension instead.

See the module level documentation for more information.

Required Methods§

Source

fn name(&self) -> &str

Returns the human readable name of the extension type.

This is used for error messages.

Source

fn fallback(&self) -> Atom<'_>

Lowers the value into the core data model.

This is used by consumers that do not understand this extension. The fallback must not be an Atom::Ext itself.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Extension for i128

Source§

fn name(&self) -> &str

Source§

fn fallback(&self) -> Atom<'_>

Source§

impl Extension for u128

Source§

fn name(&self) -> &str

Source§

fn fallback(&self) -> Atom<'_>

Implementors§