Skip to main content

IntoJsonWithContext

Trait IntoJsonWithContext 

Source
pub trait IntoJsonWithContext<N>: Sized {
    // Required method
    fn into_json_with(self, context: &N) -> Value;
}
Expand description

Values convertible into JSON through a vocabulary.

Required Methods§

Source

fn into_json_with(self, context: &N) -> Value

Converts this value into JSON, resolving the identifiers it holds against the given vocabulary.

This conversion is infallible by design: every identifier is expected to resolve in the given context (vocabulary). Passing a vocabulary the value was not built against is a caller bug; implementations render identifiers that fail to resolve as the literal string "<unresolved iri>" rather than panicking.

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<T: IntoJsonWithContext<N>, N> IntoJsonWithContext<N> for Vec<T>

Source§

fn into_json_with(self, context: &N) -> Value

Implementors§