Struct json_ld::RemoteDocument
source · Expand description
Remote document.
Stores the content of a loaded remote document along with its original URL.
Implementations§
source§impl<I, M, T> RemoteDocument<I, M, T>
impl<I, M, T> RemoteDocument<I, M, T>
sourcepub fn new(
url: Option<I>,
content_type: Option<Mime>,
document: Meta<T, M>
) -> RemoteDocument<I, M, T>
pub fn new(
url: Option<I>,
content_type: Option<Mime>,
document: Meta<T, M>
) -> RemoteDocument<I, M, 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>, BuildHasherDefault<AHasher>, Global>,
document: Meta<T, M>
) -> RemoteDocument<I, M, T>
pub fn new_full(
url: Option<I>,
content_type: Option<Mime>,
context_url: Option<I>,
profile: HashSet<Profile<I>, BuildHasherDefault<AHasher>, Global>,
document: Meta<T, M>
) -> RemoteDocument<I, M, 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, N>(
self,
f: impl Fn(Meta<T, M>) -> Meta<U, N>
) -> RemoteDocument<I, N, U>
pub fn map<U, N>(
self,
f: impl Fn(Meta<T, M>) -> Meta<U, N>
) -> RemoteDocument<I, N, U>
Maps the content of the remote document.
sourcepub fn try_map<U, N, E>(
self,
f: impl Fn(Meta<T, M>) -> Result<Meta<U, N>, E>
) -> Result<RemoteDocument<I, N, U>, E>
pub fn try_map<U, N, E>(
self,
f: impl Fn(Meta<T, M>) -> Result<Meta<U, N>, E>
) -> Result<RemoteDocument<I, N, 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 into_document(self) -> Meta<T, M>
pub fn into_document(self) -> Meta<T, M>
Drops the original URL and returns the content of the document.
Trait Implementations§
source§impl<I, M, T> Clone for RemoteDocument<I, M, T>where
I: Clone,
M: Clone,
T: Clone,
impl<I, M, T> Clone for RemoteDocument<I, M, T>where
I: Clone,
M: Clone,
T: Clone,
source§fn clone(&self) -> RemoteDocument<I, M, T>
fn clone(&self) -> RemoteDocument<I, M, T>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<T, B, M> Expand<T, B, M> for RemoteDocument<T, M, Value<M>>
impl<T, B, M> Expand<T, B, M> for RemoteDocument<T, M, Value<M>>
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<&T>
fn default_base_url(&self) -> Option<&T>
Expand::expand
or Expand::expand_with
.source§fn expand_full<'a, N, C, L>(
&'a self,
vocabulary: &'a mut N,
context: Context<T, B, C, M>,
base_url: Option<&'a T>,
loader: &'a mut L,
options: Options,
warnings_handler: impl Send + WarningHandler<B, N, M> + 'a
) -> Pin<Box<dyn Future<Output = Result<Meta<ExpandedDocument<T, B, M>, M>, Meta<Error<M, <L as ContextLoader<T, M>>::ContextError>, M>>> + Send + 'a, Global>>where
L: Loader<T, M> + ContextLoader<T, M> + Send + Sync,
N: Send + Sync + VocabularyMut<Iri = T, BlankId = B>,
T: Clone + Eq + Hash + Send + Sync,
B: 'a + Clone + Eq + Hash + Send + Sync,
M: 'a + Clone + Send + Sync,
C: 'a + ProcessMeta<T, B, M> + From<Value<M>>,
<L as Loader<T, M>>::Output: Into<Value<M>>,
<L as ContextLoader<T, M>>::Context: Into<C>,
<L as ContextLoader<T, M>>::ContextError: Send,
fn expand_full<'a, N, C, L>(
&'a self,
vocabulary: &'a mut N,
context: Context<T, B, C, M>,
base_url: Option<&'a T>,
loader: &'a mut L,
options: Options,
warnings_handler: impl Send + WarningHandler<B, N, M> + 'a
) -> Pin<Box<dyn Future<Output = Result<Meta<ExpandedDocument<T, B, M>, M>, Meta<Error<M, <L as ContextLoader<T, M>>::ContextError>, M>>> + Send + 'a, Global>>where
L: Loader<T, M> + ContextLoader<T, M> + Send + Sync,
N: Send + Sync + VocabularyMut<Iri = T, BlankId = B>,
T: Clone + Eq + Hash + Send + Sync,
B: 'a + Clone + Eq + Hash + Send + Sync,
M: 'a + Clone + Send + Sync,
C: 'a + ProcessMeta<T, B, M> + From<Value<M>>,
<L as Loader<T, M>>::Output: Into<Value<M>>,
<L as ContextLoader<T, M>>::Context: Into<C>,
<L as ContextLoader<T, M>>::ContextError: Send,
source§impl<I, M> JsonLdProcessor<I, M> for RemoteDocument<I, M, Value<M>>
impl<I, M> JsonLdProcessor<I, M> for RemoteDocument<I, M, Value<M>>
source§fn compare_full<'a, B, C, N, L>(
&'a self,
other: &'a Self,
vocabulary: &'a mut N,
loader: &'a mut L,
options: Options<I, M, C>,
warnings: impl 'a + Send + WarningHandler<N, M> + WarningHandler<B, N, M>
) -> BoxFuture<'_, CompareResult<I, M, L>>where
I: Clone + Eq + Hash + Send + Sync,
B: 'a + Clone + Eq + Hash + Send + Sync,
C: 'a + ProcessMeta<I, B, M> + From<Value<M>>,
N: Send + Sync + VocabularyMut<Iri = I, BlankId = B>,
M: Clone + Send + Sync,
L: Loader<I, M> + ContextLoader<I, M> + Send + Sync,
L::Output: Into<Value<M>>,
L::Error: Send,
L::Context: Into<C>,
L::ContextError: Send,
fn compare_full<'a, B, C, N, L>(
&'a self,
other: &'a Self,
vocabulary: &'a mut N,
loader: &'a mut L,
options: Options<I, M, C>,
warnings: impl 'a + Send + WarningHandler<N, M> + WarningHandler<B, N, M>
) -> BoxFuture<'_, CompareResult<I, M, L>>where
I: Clone + Eq + Hash + Send + Sync,
B: 'a + Clone + Eq + Hash + Send + Sync,
C: 'a + ProcessMeta<I, B, M> + From<Value<M>>,
N: Send + Sync + VocabularyMut<Iri = I, BlankId = B>,
M: Clone + Send + Sync,
L: Loader<I, M> + ContextLoader<I, M> + Send + Sync,
L::Output: Into<Value<M>>,
L::Error: Send,
L::Context: Into<C>,
L::ContextError: Send,
other
with a custom vocabulary using the
given options
and warnings handler. Read moresource§fn expand_full<'a, B, C, N, L>(
&'a self,
vocabulary: &'a mut N,
loader: &'a mut L,
options: Options<I, M, C>,
warnings: impl 'a + Send + WarningHandler<N, M> + WarningHandler<B, N, M>
) -> BoxFuture<'_, ExpandResult<I, B, M, L>>where
I: Clone + Eq + Hash + Send + Sync,
B: 'a + Clone + Eq + Hash + Send + Sync,
C: 'a + ProcessMeta<I, B, M> + From<Value<M>>,
N: Send + Sync + VocabularyMut<Iri = I, BlankId = B>,
M: Clone + Send + Sync,
L: Loader<I, M> + ContextLoader<I, M> + Send + Sync,
L::Output: Into<Value<M>>,
L::Error: Send,
L::Context: Into<C>,
L::ContextError: Send,
fn expand_full<'a, B, C, N, L>(
&'a self,
vocabulary: &'a mut N,
loader: &'a mut L,
options: Options<I, M, C>,
warnings: impl 'a + Send + WarningHandler<N, M> + WarningHandler<B, N, M>
) -> BoxFuture<'_, ExpandResult<I, B, M, L>>where
I: Clone + Eq + Hash + Send + Sync,
B: 'a + Clone + Eq + Hash + Send + Sync,
C: 'a + ProcessMeta<I, B, M> + From<Value<M>>,
N: Send + Sync + VocabularyMut<Iri = I, BlankId = B>,
M: Clone + Send + Sync,
L: Loader<I, M> + ContextLoader<I, M> + Send + Sync,
L::Output: Into<Value<M>>,
L::Error: Send,
L::Context: Into<C>,
L::ContextError: Send,
vocabulary
and loader
, using
the given options
and warning handler. Read moresource§fn compact_full<'a, B, C, N, L>(
&'a self,
vocabulary: &'a mut N,
context: RemoteDocumentReference<I, M, C>,
loader: &'a mut L,
options: Options<I, M, C>,
warnings: impl 'a + Send + WarningHandler<N, M> + WarningHandler<B, N, M>
) -> BoxFuture<'a, CompactResult<I, M, L>>where
I: Clone + Eq + Hash + Send + Sync,
B: 'a + Clone + Eq + Hash + Send + Sync,
C: 'a + ProcessMeta<I, B, M> + From<Value<M>>,
N: Send + Sync + VocabularyMut<Iri = I, BlankId = B>,
M: Clone + Send + Sync,
L: Loader<I, M> + ContextLoader<I, M> + Send + Sync,
L::Output: Into<Value<M>>,
L::Error: Send,
L::Context: Into<C>,
L::ContextError: Send,
fn compact_full<'a, B, C, N, L>(
&'a self,
vocabulary: &'a mut N,
context: RemoteDocumentReference<I, M, C>,
loader: &'a mut L,
options: Options<I, M, C>,
warnings: impl 'a + Send + WarningHandler<N, M> + WarningHandler<B, N, M>
) -> BoxFuture<'a, CompactResult<I, M, L>>where
I: Clone + Eq + Hash + Send + Sync,
B: 'a + Clone + Eq + Hash + Send + Sync,
C: 'a + ProcessMeta<I, B, M> + From<Value<M>>,
N: Send + Sync + VocabularyMut<Iri = I, BlankId = B>,
M: Clone + Send + Sync,
L: Loader<I, M> + ContextLoader<I, M> + Send + Sync,
L::Output: Into<Value<M>>,
L::Error: Send,
L::Context: Into<C>,
L::ContextError: Send,
context
with the given vocabulary
and loader
, using the given options
and warning handler. Read moresource§fn flatten_full<'a, B, C, N, L>(
&'a self,
vocabulary: &'a mut N,
generator: &'a mut impl Send + Generator<N, M>,
context: Option<RemoteDocumentReference<I, M, C>>,
loader: &'a mut L,
options: Options<I, M, C>,
warnings: impl 'a + Send + WarningHandler<N, M> + WarningHandler<B, N, M>
) -> BoxFuture<'a, Result<MetaValue<M>, FlattenError<I, B, M, <L as Loader<I, M>>::Error, <L as ContextLoader<I, M>>::ContextError>>>where
I: Clone + Eq + Hash + Send + Sync,
B: 'a + Clone + Eq + Hash + Send + Sync,
C: 'a + ProcessMeta<I, B, M> + From<Value<M>>,
N: Send + Sync + VocabularyMut<Iri = I, BlankId = B>,
M: Clone + Send + Sync,
L: Loader<I, M> + ContextLoader<I, M> + Send + Sync,
L::Output: Into<Value<M>>,
L::Error: Send,
L::Context: Into<C>,
L::ContextError: Send,
fn flatten_full<'a, B, C, N, L>(
&'a self,
vocabulary: &'a mut N,
generator: &'a mut impl Send + Generator<N, M>,
context: Option<RemoteDocumentReference<I, M, C>>,
loader: &'a mut L,
options: Options<I, M, C>,
warnings: impl 'a + Send + WarningHandler<N, M> + WarningHandler<B, N, M>
) -> BoxFuture<'a, Result<MetaValue<M>, FlattenError<I, B, M, <L as Loader<I, M>>::Error, <L as ContextLoader<I, M>>::ContextError>>>where
I: Clone + Eq + Hash + Send + Sync,
B: 'a + Clone + Eq + Hash + Send + Sync,
C: 'a + ProcessMeta<I, B, M> + From<Value<M>>,
N: Send + Sync + VocabularyMut<Iri = I, BlankId = B>,
M: Clone + Send + Sync,
L: Loader<I, M> + ContextLoader<I, M> + Send + Sync,
L::Output: Into<Value<M>>,
L::Error: Send,
L::Context: Into<C>,
L::ContextError: Send,
vocabulary
, generator
and loader
, using the given options
and warning handler. Read more