Struct json_ld::RemoteDocument
source · pub struct RemoteDocument<I = IriBuf, T = Value> { /* private fields */ }
Expand description
Remote document.
Stores the content of a loaded remote document along with its original URL.
Implementations§
source§impl<I, T> RemoteDocument<I, T>
impl<I, T> RemoteDocument<I, T>
sourcepub fn new(
url: Option<I>,
content_type: Option<Mime>,
document: T
) -> RemoteDocument<I, T>
pub fn new( url: Option<I>, content_type: Option<Mime>, document: T ) -> RemoteDocument<I, T>
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<I>,
content_type: Option<Mime>,
context_url: Option<I>,
profile: HashSet<Profile<I>>,
document: T
) -> RemoteDocument<I, T>
pub fn new_full( url: Option<I>, content_type: Option<Mime>, context_url: Option<I>, profile: HashSet<Profile<I>>, document: T ) -> RemoteDocument<I, T>
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) -> RemoteDocument<I, U>
pub fn map<U>(self, f: impl Fn(T) -> U) -> RemoteDocument<I, U>
Maps the content of the remote document.
sourcepub fn try_map<U, E>(
self,
f: impl Fn(T) -> Result<U, E>
) -> Result<RemoteDocument<I, U>, E>
pub fn try_map<U, E>( self, f: impl Fn(T) -> Result<U, E> ) -> Result<RemoteDocument<I, U>, E>
Tries to map the content of the remote document.
sourcepub fn url(&self) -> Option<&I>
pub fn url(&self) -> Option<&I>
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<&I>
pub fn context_url(&self) -> Option<&I>
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.
Trait Implementations§
source§impl<I, B> Borrow<RemoteDocument<I>> for Document<I, B>
impl<I, B> Borrow<RemoteDocument<I>> for Document<I, B>
source§fn borrow(&self) -> &RemoteDocument<I>
fn borrow(&self) -> &RemoteDocument<I>
source§impl<I, T> Clone for RemoteDocument<I, T>
impl<I, T> Clone for RemoteDocument<I, T>
source§fn clone(&self) -> RemoteDocument<I, T>
fn clone(&self) -> RemoteDocument<I, T>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<I, T> Debug for RemoteDocument<I, T>
impl<I, T> Debug for RemoteDocument<I, T>
source§impl<Iri> Expand<Iri> for RemoteDocument<Iri>
impl<Iri> Expand<Iri> for RemoteDocument<Iri>
Remote document expansion.
The default base URL given to the expansion algorithm is the URL of the remote document.
source§fn default_base_url(&self) -> Option<&Iri>
fn default_base_url(&self) -> Option<&Iri>
Expand::expand
or Expand::expand_with
.source§async fn expand_full<'a, N, L, W>(
&'a self,
vocabulary: &'a mut N,
context: Context<Iri, <N as BlankIdVocabulary>::BlankId>,
base_url: Option<&'a Iri>,
loader: &'a mut L,
options: Options,
warnings_handler: W
) -> Result<ExpandedDocument<Iri, <N as BlankIdVocabulary>::BlankId>, Error<<L as Loader<Iri>>::Error>>where
N: VocabularyMut<Iri = Iri>,
Iri: Clone + Eq + Hash,
<N as BlankIdVocabulary>::BlankId: 'a + Clone + Eq + Hash,
L: Loader<Iri>,
W: 'a + WarningHandler<N>,
async fn expand_full<'a, N, L, W>(
&'a self,
vocabulary: &'a mut N,
context: Context<Iri, <N as BlankIdVocabulary>::BlankId>,
base_url: Option<&'a Iri>,
loader: &'a mut L,
options: Options,
warnings_handler: W
) -> Result<ExpandedDocument<Iri, <N as BlankIdVocabulary>::BlankId>, Error<<L as Loader<Iri>>::Error>>where
N: VocabularyMut<Iri = Iri>,
Iri: Clone + Eq + Hash,
<N as BlankIdVocabulary>::BlankId: 'a + Clone + Eq + Hash,
L: Loader<Iri>,
W: 'a + WarningHandler<N>,
source§impl<I> JsonLdProcessor<I> for RemoteDocument<I>
impl<I> JsonLdProcessor<I> for RemoteDocument<I>
source§async fn compare_full<'a, N, L>(
&'a self,
other: &'a Self,
vocabulary: &'a mut N,
loader: &'a mut L,
options: Options<I>,
warnings: impl 'a + WarningHandler<N> + WarningHandler<N>
) -> CompareResult<I, L>
async fn compare_full<'a, N, L>( &'a self, other: &'a Self, vocabulary: &'a mut N, loader: &'a mut L, options: Options<I>, warnings: impl 'a + WarningHandler<N> + WarningHandler<N> ) -> CompareResult<I, L>
other
with a custom vocabulary using the
given options
and warnings handler. Read moresource§async fn expand_full<'a, N, L>(
&'a self,
vocabulary: &'a mut N,
loader: &'a mut L,
options: Options<I>,
warnings: impl 'a + WarningHandler<N> + WarningHandler<N>
) -> ExpandResult<I, N::BlankId, L>
async fn expand_full<'a, N, L>( &'a self, vocabulary: &'a mut N, loader: &'a mut L, options: Options<I>, warnings: impl 'a + WarningHandler<N> + WarningHandler<N> ) -> ExpandResult<I, N::BlankId, L>
vocabulary
and loader
, using
the given options
and warning handler. Read moreasync fn into_document_full<'a, N, L>( self, vocabulary: &'a mut N, loader: &'a mut L, options: Options<I>, warnings: impl 'a + WarningHandler<N> + WarningHandler<N> ) -> IntoDocumentResult<I, N::BlankId, L>
source§async fn compact_full<'a, N, L>(
&'a self,
vocabulary: &'a mut N,
context: RemoteContextReference<I>,
loader: &'a mut L,
options: Options<I>,
warnings: impl 'a + WarningHandler<N> + WarningHandler<N>
) -> CompactResult<I, L>
async fn compact_full<'a, N, L>( &'a self, vocabulary: &'a mut N, context: RemoteContextReference<I>, loader: &'a mut L, options: Options<I>, warnings: impl 'a + WarningHandler<N> + WarningHandler<N> ) -> CompactResult<I, L>
context
with the given vocabulary
and loader
, using the given options
and warning handler. Read moresource§async fn flatten_full<'a, N, L>(
&'a self,
vocabulary: &'a mut N,
generator: &'a mut impl Generator<N>,
context: Option<RemoteContextReference<I>>,
loader: &'a mut L,
options: Options<I>,
warnings: impl 'a + WarningHandler<N> + WarningHandler<N>
) -> FlattenResult<I, N::BlankId, L>
async fn flatten_full<'a, N, L>( &'a self, vocabulary: &'a mut N, generator: &'a mut impl Generator<N>, context: Option<RemoteContextReference<I>>, loader: &'a mut L, options: Options<I>, warnings: impl 'a + WarningHandler<N> + WarningHandler<N> ) -> FlattenResult<I, N::BlankId, L>
vocabulary
, generator
and loader
, using the given options
and warning handler. Read more