pub struct RemoteDocument<I = Iri<String>, T = Value> {
pub url: Option<I>,
pub content_type: Option<MediaTypeBuf>,
pub context_url: Option<I>,
pub profile: HashSet<Profile<I>, GxBuildHasher>,
pub document: T,
}Expand description
Remote document.
Stores the content of a loaded remote document along with its original URL.
Fields§
§url: Option<I>The final URL of the loaded document, after eventual redirection.
content_type: Option<MediaTypeBuf>The HTTP Content-Type header value of the loaded document, exclusive
of any optional parameters.
context_url: Option<I>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<Profile<I>, GxBuildHasher>Profiles advertised by the document’s media type.
document: TThe retrieved document.
Implementations§
Source§impl<I, T> RemoteDocument<I, T>
impl<I, T> RemoteDocument<I, T>
Sourcepub fn new(
url: Option<I>,
content_type: Option<MediaTypeBuf>,
document: T,
) -> RemoteDocument<I, T>
pub fn new( url: Option<I>, content_type: Option<MediaTypeBuf>, 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<MediaTypeBuf>,
context_url: Option<I>,
profile: HashSet<Profile<I>, GxBuildHasher>,
document: T,
) -> RemoteDocument<I, T>
pub fn new_full( url: Option<I>, content_type: Option<MediaTypeBuf>, context_url: Option<I>, profile: HashSet<Profile<I>, GxBuildHasher>, 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.
§Errors
Returns whatever f returns for the contained document.
Sourcepub fn map_iris<J>(self, f: impl FnMut(I) -> J) -> RemoteDocument<J, T>
pub fn map_iris<J>(self, f: impl FnMut(I) -> J) -> RemoteDocument<J, T>
Maps all the IRIs.
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<&MediaTypeBuf>
pub fn content_type(&self) -> Option<&MediaTypeBuf>
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.
Source§impl<I> RemoteDocument<I>
impl<I> RemoteDocument<I>
Sourcepub fn from_value(
url: Option<I>,
content_type: Option<MediaTypeBuf>,
document: impl Into<Value>,
) -> RemoteDocument<I>
pub fn from_value( url: Option<I>, content_type: Option<MediaTypeBuf>, document: impl Into<Value>, ) -> RemoteDocument<I>
Creates a remote document from any value convertible into a
jstrict::Value.
With the serde_json feature enabled, this also accepts
serde_json::Value thanks to the From<serde_json::Value>
implementation provided by jstrict.
Source§impl<I> RemoteDocument<I>
impl<I> RemoteDocument<I>
Sourcepub fn from_serde_json(
url: Option<I>,
content_type: Option<MediaTypeBuf>,
document: Value,
) -> RemoteDocument<I>
Available on crate feature serde-json only.
pub fn from_serde_json( url: Option<I>, content_type: Option<MediaTypeBuf>, document: Value, ) -> RemoteDocument<I>
serde-json only.Creates a remote document from a serde_json::Value.
Sourcepub fn into_serde_json(self) -> RemoteDocument<I, Value>
Available on crate feature serde-json only.
pub fn into_serde_json(self) -> RemoteDocument<I, Value>
serde-json only.Consumes the document, returning a RemoteDocument<I, serde_json::Value>.
Source§impl<I> RemoteDocument<I>
impl<I> RemoteDocument<I>
Sourcepub fn from_sonic_rs(
url: Option<I>,
content_type: Option<MediaTypeBuf>,
document: Value,
) -> RemoteDocument<I>
Available on crate feature sonic-rs only.
pub fn from_sonic_rs( url: Option<I>, content_type: Option<MediaTypeBuf>, document: Value, ) -> RemoteDocument<I>
sonic-rs only.Creates a remote document from a sonic_rs::Value.
Sourcepub fn into_sonic_rs(self) -> RemoteDocument<I, Value>
Available on crate feature sonic-rs only.
pub fn into_sonic_rs(self) -> RemoteDocument<I, Value>
sonic-rs only.Consumes the document, returning a RemoteDocument<I, sonic_rs::Value>.
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 (const: unstable) · 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>
A remote document knows where it comes from: its own URL is used as default
base URL, so relative IRI references resolve as they would for a consumer
fetching the document.
impl<Iri> Expand<Iri> for RemoteDocument<Iri>
A remote document knows where it comes from: its own URL is used as default base URL, so relative IRI references resolve as they would for a consumer fetching the document.
Source§fn default_base_url(&self) -> Option<&Iri>
fn default_base_url(&self) -> Option<&Iri>
Expand::expand and Expand::expand_with. Read moreSource§async fn expand_full<N, L, W>(
&self,
vocabulary: &mut N,
context: Context<Iri, <N as BlankIdVocabulary>::BlankId>,
base_url: Option<&Iri>,
loader: &L,
options: Options,
warnings_handler: W,
) -> Result<ExpandedDocument<Iri, <N as BlankIdVocabulary>::BlankId>, Error<<L as Loader>::Error>>where
N: VocabularyMut<Iri = Iri>,
Iri: Clone + Eq + Hash,
<N as BlankIdVocabulary>::BlankId: Clone + Eq + Hash,
L: Loader,
W: WarningHandler<N>,
async fn expand_full<N, L, W>(
&self,
vocabulary: &mut N,
context: Context<Iri, <N as BlankIdVocabulary>::BlankId>,
base_url: Option<&Iri>,
loader: &L,
options: Options,
warnings_handler: W,
) -> Result<ExpandedDocument<Iri, <N as BlankIdVocabulary>::BlankId>, Error<<L as Loader>::Error>>where
N: VocabularyMut<Iri = Iri>,
Iri: Clone + Eq + Hash,
<N as BlankIdVocabulary>::BlankId: Clone + Eq + Hash,
L: Loader,
W: WarningHandler<N>,
Source§async fn expand_with<'a, N, L>(
&'a self,
vocabulary: &'a mut N,
loader: &'a L,
) -> Result<ExpandedDocument<Iri, <N as BlankIdVocabulary>::BlankId>, Error<<L as Loader>::Error>>where
N: VocabularyMut<Iri = Iri>,
Iri: 'a + Clone + Eq + Hash,
<N as BlankIdVocabulary>::BlankId: 'a + Clone + Eq + Hash,
L: Loader,
async fn expand_with<'a, N, L>(
&'a self,
vocabulary: &'a mut N,
loader: &'a L,
) -> Result<ExpandedDocument<Iri, <N as BlankIdVocabulary>::BlankId>, Error<<L as Loader>::Error>>where
N: VocabularyMut<Iri = Iri>,
Iri: 'a + Clone + Eq + Hash,
<N as BlankIdVocabulary>::BlankId: 'a + Clone + Eq + Hash,
L: Loader,
vocabulary. Read moreSource§impl<I> JsonLdProcessor<I> for RemoteDocument<I>
impl<I> JsonLdProcessor<I> for RemoteDocument<I>
Source§async fn compare_full<N, L>(
&self,
other: &Self,
vocabulary: &mut N,
loader: &L,
options: Options<I>,
warnings: impl WarningHandler<N> + WarningHandler<N>,
) -> CompareResult<L::Error>
async fn compare_full<N, L>( &self, other: &Self, vocabulary: &mut N, loader: &L, options: Options<I>, warnings: impl WarningHandler<N> + WarningHandler<N>, ) -> CompareResult<L::Error>
other with a custom vocabulary using the
given options and warnings handler. Read moreSource§async fn expand_full<N, L>(
&self,
vocabulary: &mut N,
loader: &L,
options: Options<I>,
warnings: impl WarningHandler<N> + WarningHandler<N>,
) -> ExpandResult<I, N::BlankId, L::Error>
async fn expand_full<N, L>( &self, vocabulary: &mut N, loader: &L, options: Options<I>, warnings: impl WarningHandler<N> + WarningHandler<N>, ) -> ExpandResult<I, N::BlankId, L::Error>
vocabulary and loader, using
the given options and warning handler. Read moreSource§async fn into_document_full<'a, N, L>(
self,
vocabulary: &'a mut N,
loader: &'a L,
options: Options<I>,
warnings: impl 'a + WarningHandler<N> + WarningHandler<N>,
) -> IntoDocumentResult<I, N::BlankId, L::Error>
async fn into_document_full<'a, N, L>( self, vocabulary: &'a mut N, loader: &'a L, options: Options<I>, warnings: impl 'a + WarningHandler<N> + WarningHandler<N>, ) -> IntoDocumentResult<I, N::BlankId, L::Error>
JsonLdProcessor, returning its document full.Source§async fn compact_full<'a, N, L>(
&'a self,
vocabulary: &'a mut N,
context: RemoteContextReference<I>,
loader: &'a L,
options: Options<I>,
warnings: impl 'a + WarningHandler<N> + WarningHandler<N>,
) -> CompactResult<L::Error>
async fn compact_full<'a, N, L>( &'a self, vocabulary: &'a mut N, context: RemoteContextReference<I>, loader: &'a L, options: Options<I>, warnings: impl 'a + WarningHandler<N> + WarningHandler<N>, ) -> CompactResult<L::Error>
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 LocalGenerator,
context: Option<RemoteContextReference<I>>,
loader: &'a L,
options: Options<I>,
warnings: impl 'a + WarningHandler<N> + WarningHandler<N>,
) -> FlattenResult<I, N::BlankId, L::Error>
async fn flatten_full<'a, N, L>( &'a self, vocabulary: &'a mut N, generator: &'a mut impl LocalGenerator, context: Option<RemoteContextReference<I>>, loader: &'a L, options: Options<I>, warnings: impl 'a + WarningHandler<N> + WarningHandler<N>, ) -> FlattenResult<I, N::BlankId, L::Error>
vocabulary, generator
and loader, using the given options and warning handler. Read moreSource§async fn compare_with_using<'a, N, L>(
&'a self,
other: &'a Self,
vocabulary: &'a mut N,
loader: &'a L,
options: Options<Iri>,
) -> CompareResult<L::Error>
async fn compare_with_using<'a, N, L>( &'a self, other: &'a Self, vocabulary: &'a mut N, loader: &'a L, options: Options<Iri>, ) -> CompareResult<L::Error>
Source§async fn compare_with<'a, N, L>(
&'a self,
other: &'a Self,
vocabulary: &'a mut N,
loader: &'a L,
) -> CompareResult<L::Error>
async fn compare_with<'a, N, L>( &'a self, other: &'a Self, vocabulary: &'a mut N, loader: &'a L, ) -> CompareResult<L::Error>
other with a custom vocabulary. Read moreSource§async fn compare_using<'a, L>(
&'a self,
other: &'a Self,
loader: &'a L,
options: Options<Iri>,
) -> CompareResult<L::Error>
async fn compare_using<'a, L>( &'a self, other: &'a Self, loader: &'a L, options: Options<Iri>, ) -> CompareResult<L::Error>
Source§async fn compare<'a, L>(
&'a self,
other: &'a Self,
loader: &'a L,
) -> CompareResult<L::Error>
async fn compare<'a, L>( &'a self, other: &'a Self, loader: &'a L, ) -> CompareResult<L::Error>
other with a custom vocabulary. Read moreSource§async fn expand_with_using<'a, N, L>(
&'a self,
vocabulary: &'a mut N,
loader: &'a L,
options: Options<Iri>,
) -> ExpandResult<Iri, N::BlankId, L::Error>
async fn expand_with_using<'a, N, L>( &'a self, vocabulary: &'a mut N, loader: &'a L, options: Options<Iri>, ) -> ExpandResult<Iri, N::BlankId, L::Error>
Source§async fn expand_with<'a, N, L>(
&'a self,
vocabulary: &'a mut N,
loader: &'a L,
) -> ExpandResult<Iri, N::BlankId, L::Error>
async fn expand_with<'a, N, L>( &'a self, vocabulary: &'a mut N, loader: &'a L, ) -> ExpandResult<Iri, N::BlankId, L::Error>
Source§async fn expand_using<'a, L>(
&'a self,
loader: &'a L,
options: Options<Iri>,
) -> ExpandResult<Iri, BlankIdBuf, L::Error>
async fn expand_using<'a, L>( &'a self, loader: &'a L, options: Options<Iri>, ) -> ExpandResult<Iri, BlankIdBuf, L::Error>
Source§async fn expand<'a, L>(
&'a self,
loader: &'a L,
) -> ExpandResult<Iri, BlankIdBuf, L::Error>
async fn expand<'a, L>( &'a self, loader: &'a L, ) -> ExpandResult<Iri, BlankIdBuf, L::Error>
loader. Read moreSource§async fn into_document_with_using<'a, N, L>(
self,
vocabulary: &'a mut N,
loader: &'a L,
options: Options<Iri>,
) -> IntoDocumentResult<Iri, N::BlankId, L::Error>
async fn into_document_with_using<'a, N, L>( self, vocabulary: &'a mut N, loader: &'a L, options: Options<Iri>, ) -> IntoDocumentResult<Iri, N::BlankId, L::Error>
JsonLdProcessor, returning its document with using.Source§async fn into_document_with<'a, N, L>(
self,
vocabulary: &'a mut N,
loader: &'a L,
) -> IntoDocumentResult<Iri, N::BlankId, L::Error>
async fn into_document_with<'a, N, L>( self, vocabulary: &'a mut N, loader: &'a L, ) -> IntoDocumentResult<Iri, N::BlankId, L::Error>
JsonLdProcessor, returning its document with.Source§async fn into_document<'a, L>(
self,
loader: &'a L,
) -> IntoDocumentResult<Iri, BlankIdBuf, L::Error>
async fn into_document<'a, L>( self, loader: &'a L, ) -> IntoDocumentResult<Iri, BlankIdBuf, L::Error>
JsonLdProcessor, returning its document.Source§async fn compact_with_using<'a, N, L>(
&'a self,
vocabulary: &'a mut N,
context: RemoteContextReference<Iri>,
loader: &'a L,
options: Options<Iri>,
) -> CompactResult<L::Error>
async fn compact_with_using<'a, N, L>( &'a self, vocabulary: &'a mut N, context: RemoteContextReference<Iri>, loader: &'a L, options: Options<Iri>, ) -> CompactResult<L::Error>
context with the given vocabulary
and loader, using the given options. Read moreSource§async fn compact_with<'a, N, L>(
&'a self,
vocabulary: &'a mut N,
context: RemoteContextReference<Iri>,
loader: &'a L,
) -> CompactResult<L::Error>
async fn compact_with<'a, N, L>( &'a self, vocabulary: &'a mut N, context: RemoteContextReference<Iri>, loader: &'a L, ) -> CompactResult<L::Error>
Source§async fn compact_using<'a, L>(
&'a self,
context: RemoteContextReference<Iri>,
loader: &'a L,
options: Options<Iri>,
) -> CompactResult<L::Error>
async fn compact_using<'a, L>( &'a self, context: RemoteContextReference<Iri>, loader: &'a L, options: Options<Iri>, ) -> CompactResult<L::Error>
Source§async fn compact<'a, L>(
&'a self,
context: RemoteContextReference<Iri>,
loader: &'a L,
) -> CompactResult<L::Error>
async fn compact<'a, L>( &'a self, context: RemoteContextReference<Iri>, loader: &'a L, ) -> CompactResult<L::Error>
Source§async fn flatten_with_using<'a, N, L>(
&'a self,
vocabulary: &'a mut N,
generator: &'a mut impl LocalGenerator,
loader: &'a L,
options: Options<Iri>,
) -> FlattenResult<Iri, N::BlankId, L::Error>
async fn flatten_with_using<'a, N, L>( &'a self, vocabulary: &'a mut N, generator: &'a mut impl LocalGenerator, loader: &'a L, options: Options<Iri>, ) -> FlattenResult<Iri, N::BlankId, L::Error>
vocabulary, generator
and loader, using the given options. Read moreSource§async fn flatten_with<'a, N, L>(
&'a self,
vocabulary: &'a mut N,
generator: &'a mut impl LocalGenerator,
loader: &'a L,
) -> FlattenResult<Iri, N::BlankId, L::Error>
async fn flatten_with<'a, N, L>( &'a self, vocabulary: &'a mut N, generator: &'a mut impl LocalGenerator, loader: &'a L, ) -> FlattenResult<Iri, N::BlankId, L::Error>
Source§async fn flatten_using<'a, L>(
&'a self,
generator: &'a mut impl LocalGenerator,
loader: &'a L,
options: Options<Iri>,
) -> FlattenResult<Iri, BlankIdBuf, L::Error>
async fn flatten_using<'a, L>( &'a self, generator: &'a mut impl LocalGenerator, loader: &'a L, options: Options<Iri>, ) -> FlattenResult<Iri, BlankIdBuf, L::Error>
Source§async fn flatten<'a, L>(
&'a self,
generator: &'a mut impl LocalGenerator,
loader: &'a L,
) -> FlattenResult<Iri, BlankIdBuf, L::Error>
async fn flatten<'a, L>( &'a self, generator: &'a mut impl LocalGenerator, loader: &'a L, ) -> FlattenResult<Iri, BlankIdBuf, L::Error>
Source§async fn to_rdf_full<N, G, L>(
&self,
vocabulary: N,
generator: G,
loader: &L,
options: Options<Iri>,
warnings: impl WarningHandler<N> + WarningHandler<N>,
) -> ToRdfResult<N, G, L::Error>where
N: VocabularyMut<Iri = Iri>,
Iri: Clone + Eq + Hash,
L: Loader,
N::BlankId: Clone + Eq + Hash,
G: LocalGenerator,
async fn to_rdf_full<N, G, L>(
&self,
vocabulary: N,
generator: G,
loader: &L,
options: Options<Iri>,
warnings: impl WarningHandler<N> + WarningHandler<N>,
) -> ToRdfResult<N, G, L::Error>where
N: VocabularyMut<Iri = Iri>,
Iri: Clone + Eq + Hash,
L: Loader,
N::BlankId: Clone + Eq + Hash,
G: LocalGenerator,
options and warnings handler. Read moreSource§async fn to_rdf_with_using<N, G, L>(
&self,
vocabulary: N,
generator: G,
loader: &L,
options: Options<Iri>,
) -> ToRdfResult<N, G, L::Error>where
N: VocabularyMut<Iri = Iri>,
Iri: Clone + Eq + Hash,
L: Loader,
N::BlankId: Clone + Eq + Hash,
G: LocalGenerator,
async fn to_rdf_with_using<N, G, L>(
&self,
vocabulary: N,
generator: G,
loader: &L,
options: Options<Iri>,
) -> ToRdfResult<N, G, L::Error>where
N: VocabularyMut<Iri = Iri>,
Iri: Clone + Eq + Hash,
L: Loader,
N::BlankId: Clone + Eq + Hash,
G: LocalGenerator,
options. Read moreSource§async fn to_rdf_with<N, G, L>(
&self,
vocabulary: N,
generator: G,
loader: &L,
) -> ToRdfResult<N, G, L::Error>where
N: VocabularyMut<Iri = Iri>,
Iri: Clone + Eq + Hash,
L: Loader,
N::BlankId: Clone + Eq + Hash,
G: LocalGenerator,
async fn to_rdf_with<N, G, L>(
&self,
vocabulary: N,
generator: G,
loader: &L,
) -> ToRdfResult<N, G, L::Error>where
N: VocabularyMut<Iri = Iri>,
Iri: Clone + Eq + Hash,
L: Loader,
N::BlankId: Clone + Eq + Hash,
G: LocalGenerator,
Source§async fn to_rdf_using<G, L>(
&self,
generator: G,
loader: &L,
options: Options<Iri>,
) -> ToRdfResult<(), G, L::Error>
async fn to_rdf_using<G, L>( &self, generator: G, loader: &L, options: Options<Iri>, ) -> ToRdfResult<(), G, L::Error>
options. Read moreAuto Trait Implementations§
impl<I, T> Freeze for RemoteDocument<I, T>
impl<I, T> RefUnwindSafe for RemoteDocument<I, T>where
T: RefUnwindSafe,
I: RefUnwindSafe,
impl<I, T> Send for RemoteDocument<I, T>
impl<I, T> Sync for RemoteDocument<I, T>
impl<I, T> Unpin for RemoteDocument<I, T>
impl<I, T> UnsafeUnpin for RemoteDocument<I, T>where
T: UnsafeUnpin,
I: UnsafeUnpin,
impl<I, T> UnwindSafe for RemoteDocument<I, T>where
T: UnwindSafe,
I: 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
Source§impl<T> BorrowUnordered for T
impl<T> BorrowUnordered for T
Source§fn as_unordered(&self) -> &Unordered<T>
fn as_unordered(&self) -> &Unordered<T>
Unordered reference.