pub struct JsonLdDocument<T = JsonValue> {
pub url: Option<IriBuf>,
pub content_type: Option<Mime>,
pub context_url: Option<IriBuf>,
pub profile: HashSet<JsonLdProfile>,
pub source: Option<JsonLdSourceCode>,
pub document: T,
}Expand description
Remote document.
Stores the content of a loaded remote document along with its original URL.
Fields§
§url: Option<IriBuf>The final URL of the loaded document, after eventual redirection.
content_type: Option<Mime>The HTTP Content-Type header value of the loaded document, exclusive
of any optional parameters.
context_url: Option<IriBuf>If available, the value of the HTTP Link Header RFC 8288 using the
http://www.w3.org/ns/json-ld#context link relation in the response.
If the response’s Content-Type is application/ld+json, the HTTP
Link Header is ignored. If multiple HTTP Link Headers using the
http://www.w3.org/ns/json-ld#context link relation are found, the
loader fails with a multiple context link headers error.
profile: HashSet<JsonLdProfile>§source: Option<JsonLdSourceCode>§document: TThe retrieved document.
Implementations§
Source§impl JsonLdDocument<JsonLdContextDocumentValue>
impl JsonLdDocument<JsonLdContextDocumentValue>
Sourcepub async fn process(
&self,
env: impl AsyncJsonLdEnvironment,
) -> Result<JsonLdProcessedContext<'_>, JsonLdLocatedError>
pub async fn process( &self, env: impl AsyncJsonLdEnvironment, ) -> Result<JsonLdProcessedContext<'_>, JsonLdLocatedError>
Process this context with the default options.
See: https://www.w3.org/TR/json-ld11-api/#context-processing-algorithm
Source§impl<T> JsonLdDocument<T>
impl<T> JsonLdDocument<T>
Sourcepub fn new(url: Option<IriBuf>, content_type: Option<Mime>, document: T) -> Self
pub fn new(url: Option<IriBuf>, content_type: Option<Mime>, document: T) -> Self
Creates a new remote document.
url is the final URL of the loaded document, after eventual
redirection.
content_type is the HTTP Content-Type header value of the loaded
document, exclusive of any optional parameters.
Sourcepub fn new_full(
url: Option<IriBuf>,
content_type: Option<Mime>,
context_url: Option<IriBuf>,
profile: HashSet<JsonLdProfile>,
source: Option<JsonLdSourceCode>,
document: T,
) -> Self
pub fn new_full( url: Option<IriBuf>, content_type: Option<Mime>, context_url: Option<IriBuf>, profile: HashSet<JsonLdProfile>, source: Option<JsonLdSourceCode>, document: T, ) -> Self
Creates a new remote document.
url is the final URL of the loaded document, after eventual
redirection.
content_type is the HTTP Content-Type header value of the loaded
document, exclusive of any optional parameters.
context_url is the value of the HTTP Link Header RFC 8288 using the
http://www.w3.org/ns/json-ld#context link relation in the response,
if any.
profile is the value of any profile parameter retrieved as part of the
original contentType.
Sourcepub fn map<U>(self, f: impl Fn(T) -> U) -> JsonLdDocument<U>
pub fn map<U>(self, f: impl Fn(T) -> U) -> JsonLdDocument<U>
Maps the content of the remote document.
Sourcepub fn try_map<U, E>(
self,
f: impl Fn(T) -> Result<U, E>,
) -> Result<JsonLdDocument<U>, E>
pub fn try_map<U, E>( self, f: impl Fn(T) -> Result<U, E>, ) -> Result<JsonLdDocument<U>, E>
Tries to map the content of the remote document.
Sourcepub fn url(&self) -> Option<&Iri>
pub fn url(&self) -> Option<&Iri>
Returns a reference to the final URL of the loaded document, after eventual redirection.
Sourcepub fn content_type(&self) -> Option<&Mime>
pub fn content_type(&self) -> Option<&Mime>
Returns the HTTP Content-Type header value of the loaded document,
exclusive of any optional parameters.
Sourcepub fn context_url(&self) -> Option<&Iri>
pub fn context_url(&self) -> Option<&Iri>
Returns the value of the HTTP Link Header RFC 8288 using the
http://www.w3.org/ns/json-ld#context link relation in the response,
if any.
If the response’s Content-Type is application/ld+json, the HTTP
Link Header is ignored. If multiple HTTP Link Headers using the
http://www.w3.org/ns/json-ld#context link relation are found, the
loader fails with a multiple context link headers error.
Sourcepub fn document_mut(&mut self) -> &mut T
pub fn document_mut(&mut self) -> &mut T
Returns a mutable reference to the content of the document.
Sourcepub fn into_document(self) -> T
pub fn into_document(self) -> T
Drops the original URL and returns the content of the document.
Source§impl JsonLdDocument
impl JsonLdDocument
pub fn try_into_context_document( self, ) -> Result<JsonLdContextDocument, DeserializeError>
Trait Implementations§
Source§impl<T: Clone> Clone for JsonLdDocument<T>
impl<T: Clone> Clone for JsonLdDocument<T>
Source§impl<T: Debug> Debug for JsonLdDocument<T>
impl<T: Debug> Debug for JsonLdDocument<T>
Source§impl JsonLdExpand for JsonLdDocument
impl JsonLdExpand for JsonLdDocument
Source§async fn expand(
&self,
env: impl AsyncJsonLdEnvironment,
) -> Result<JsonLdExpandedDocument, JsonLdLocatedError>
async fn expand( &self, env: impl AsyncJsonLdEnvironment, ) -> Result<JsonLdExpandedDocument, JsonLdLocatedError>
Source§async fn expand_with(
&self,
env: impl AsyncJsonLdEnvironment,
active_context: &RawJsonLdProcessedContext,
options: JsonLdExpansionOptions,
) -> Result<JsonLdExpandedDocument, JsonLdLocatedError>
async fn expand_with( &self, env: impl AsyncJsonLdEnvironment, active_context: &RawJsonLdProcessedContext, options: JsonLdExpansionOptions, ) -> Result<JsonLdExpandedDocument, JsonLdLocatedError>
Source§impl JsonLdProcessor for JsonLdDocument
impl JsonLdProcessor for JsonLdDocument
Source§async fn async_compare_with(
&self,
other: &Self,
env: impl AsyncJsonLdEnvironment,
options: JsonLdOptions,
) -> JsonLdCompareResult
async fn async_compare_with( &self, other: &Self, env: impl AsyncJsonLdEnvironment, options: JsonLdOptions, ) -> JsonLdCompareResult
other using the given options.Source§async fn async_expand_with(
&self,
env: impl AsyncJsonLdEnvironment,
options: JsonLdOptions,
) -> JsonLdExpandResult
async fn async_expand_with( &self, env: impl AsyncJsonLdEnvironment, options: JsonLdOptions, ) -> JsonLdExpandResult
options.Source§async fn async_compact_with(
&self,
context: RemoteJsonLdContext,
env: impl AsyncJsonLdEnvironment,
options: JsonLdOptions,
) -> JsonLdCompactResult
async fn async_compact_with( &self, context: RemoteJsonLdContext, env: impl AsyncJsonLdEnvironment, options: JsonLdOptions, ) -> JsonLdCompactResult
context using the given options.Source§async fn async_flatten_with(
&self,
context: Option<RemoteJsonLdContext>,
env: impl AsyncJsonLdEnvironment,
options: JsonLdOptions,
) -> JsonLdFlattenResult
async fn async_flatten_with( &self, context: Option<RemoteJsonLdContext>, env: impl AsyncJsonLdEnvironment, options: JsonLdOptions, ) -> JsonLdFlattenResult
options. Read moreSource§fn compare_with(
&self,
other: &Self,
env: impl JsonLdEnvironment,
options: JsonLdOptions,
) -> JsonLdCompareResult
fn compare_with( &self, other: &Self, env: impl JsonLdEnvironment, options: JsonLdOptions, ) -> JsonLdCompareResult
other using the given options.Source§fn compare(
&self,
other: &Self,
env: impl JsonLdEnvironment,
) -> JsonLdCompareResult
fn compare( &self, other: &Self, env: impl JsonLdEnvironment, ) -> JsonLdCompareResult
other using default options.Source§async fn async_compare(
&self,
other: &Self,
env: impl AsyncJsonLdEnvironment,
) -> JsonLdCompareResult
async fn async_compare( &self, other: &Self, env: impl AsyncJsonLdEnvironment, ) -> JsonLdCompareResult
other using default options.Source§fn expand_with(
&self,
env: impl JsonLdEnvironment,
options: JsonLdOptions,
) -> JsonLdExpandResult
fn expand_with( &self, env: impl JsonLdEnvironment, options: JsonLdOptions, ) -> JsonLdExpandResult
options.Source§fn expand(&self, env: impl JsonLdEnvironment) -> JsonLdExpandResult
fn expand(&self, env: impl JsonLdEnvironment) -> JsonLdExpandResult
Source§async fn async_expand(
&self,
env: impl AsyncJsonLdEnvironment,
) -> JsonLdExpandResult
async fn async_expand( &self, env: impl AsyncJsonLdEnvironment, ) -> JsonLdExpandResult
Source§fn compact_with(
&self,
context: RemoteJsonLdContext,
env: impl JsonLdEnvironment,
options: JsonLdOptions,
) -> JsonLdCompactResult
fn compact_with( &self, context: RemoteJsonLdContext, env: impl JsonLdEnvironment, options: JsonLdOptions, ) -> JsonLdCompactResult
context using the given options.Source§fn compact(
&self,
context: RemoteJsonLdContext,
env: impl JsonLdEnvironment,
) -> JsonLdCompactResult
fn compact( &self, context: RemoteJsonLdContext, env: impl JsonLdEnvironment, ) -> JsonLdCompactResult
context using default options.Source§async fn async_compact(
&self,
context: RemoteJsonLdContext,
env: impl AsyncJsonLdEnvironment,
) -> JsonLdCompactResult
async fn async_compact( &self, context: RemoteJsonLdContext, env: impl AsyncJsonLdEnvironment, ) -> JsonLdCompactResult
context using default options.Source§fn flatten_with(
&self,
context: Option<RemoteJsonLdContext>,
env: impl JsonLdEnvironment,
options: JsonLdOptions,
) -> JsonLdFlattenResult
fn flatten_with( &self, context: Option<RemoteJsonLdContext>, env: impl JsonLdEnvironment, options: JsonLdOptions, ) -> JsonLdFlattenResult
options. Read moreSource§fn flatten(
&self,
context: Option<RemoteJsonLdContext>,
env: impl JsonLdEnvironment,
) -> JsonLdFlattenResult
fn flatten( &self, context: Option<RemoteJsonLdContext>, env: impl JsonLdEnvironment, ) -> JsonLdFlattenResult
Source§async fn async_flatten(
&self,
context: Option<RemoteJsonLdContext>,
env: impl AsyncJsonLdEnvironment,
) -> JsonLdFlattenResult
async fn async_flatten( &self, context: Option<RemoteJsonLdContext>, env: impl AsyncJsonLdEnvironment, ) -> JsonLdFlattenResult
Source§fn to_rdf_with(
&self,
env: impl JsonLdEnvironment,
generator: impl Generator,
options: JsonLdOptions,
) -> JsonLdToRdfResult
fn to_rdf_with( &self, env: impl JsonLdEnvironment, generator: impl Generator, options: JsonLdOptions, ) -> JsonLdToRdfResult
options.Source§fn to_rdf(
&self,
env: impl JsonLdEnvironment,
generator: impl Generator,
) -> JsonLdToRdfResult
fn to_rdf( &self, env: impl JsonLdEnvironment, generator: impl Generator, ) -> JsonLdToRdfResult
Source§async fn async_to_rdf_with(
&self,
env: impl AsyncJsonLdEnvironment,
generator: impl Generator,
options: JsonLdOptions,
) -> JsonLdToRdfResult
async fn async_to_rdf_with( &self, env: impl AsyncJsonLdEnvironment, generator: impl Generator, options: JsonLdOptions, ) -> JsonLdToRdfResult
options.Source§async fn async_to_rdf(
&self,
env: impl AsyncJsonLdEnvironment,
generator: impl Generator,
) -> JsonLdToRdfResult
async fn async_to_rdf( &self, env: impl AsyncJsonLdEnvironment, generator: impl Generator, ) -> JsonLdToRdfResult
Auto Trait Implementations§
impl<T> Freeze for JsonLdDocument<T>where
T: Freeze,
impl<T> RefUnwindSafe for JsonLdDocument<T>where
T: RefUnwindSafe,
impl<T> Send for JsonLdDocument<T>where
T: Send,
impl<T> Sync for JsonLdDocument<T>where
T: Sync,
impl<T> Unpin for JsonLdDocument<T>where
T: Unpin,
impl<T> UnsafeUnpin for JsonLdDocument<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for JsonLdDocument<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> JsonAt for T
impl<T> JsonAt for T
Source§fn json_at<F>(
self,
location: impl Into<Vec<JsonBacktraceFrame<F>>>,
) -> JsonLocated<T, F>
fn json_at<F>( self, location: impl Into<Vec<JsonBacktraceFrame<F>>>, ) -> JsonLocated<T, F>
self with location.Source§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more