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>

source

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.

source

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.

source

pub fn map<U>(self, f: impl Fn(T) -> U) -> RemoteDocument<I, U>

Maps the content of the remote document.

source

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.

source

pub fn url(&self) -> Option<&I>

Returns a reference to the final URL of the loaded document, after eventual redirection.

source

pub fn content_type(&self) -> Option<&Mime>

Returns the HTTP Content-Type header value of the loaded document, exclusive of any optional parameters.

source

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.

source

pub fn document(&self) -> &T

Returns a reference to the content of the document.

source

pub fn document_mut(&mut self) -> &mut T

Returns a mutable reference to the content of the document.

source

pub fn into_document(self) -> T

Drops the original URL and returns the content of the document.

source

pub fn into_url(self) -> Option<I>

Drops the content and returns the original URL of the document.

source

pub fn set_url(&mut self, url: Option<I>)

Sets the URL of the document.

Trait Implementations§

source§

impl<I, B> Borrow<RemoteDocument<I>> for Document<I, B>

source§

fn borrow(&self) -> &RemoteDocument<I>

Immutably borrows from an owned value. Read more
source§

impl<I, T> Clone for RemoteDocument<I, T>
where I: Clone, T: Clone,

source§

fn clone(&self) -> RemoteDocument<I, T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<I, T> Debug for RemoteDocument<I, T>
where I: Debug, T: Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

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>

Returns the default base URL passed to the expansion algorithm and used to initialize the default empty context when calling 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>,

Expand the document with full options. Read more
source§

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>
where N: VocabularyMut<Iri = I>, I: Clone + Eq + Hash, N::BlankId: 'a + Clone + Eq + Hash, L: Loader<I>,

Compare this document against other with a custom vocabulary using the given options and warnings handler. Read more
source§

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>
where N: VocabularyMut<Iri = I>, I: Clone + Eq + Hash, N::BlankId: 'a + Clone + Eq + Hash, L: Loader<I>,

Expand the document with the given vocabulary and loader, using the given options and warning handler. Read more
source§

async 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>
where N: VocabularyMut<Iri = I>, I: 'a + Clone + Eq + Hash, N::BlankId: 'a + Clone + Eq + Hash, L: Loader<I>,

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>
where N: VocabularyMut<Iri = I>, I: Clone + Eq + Hash, N::BlankId: 'a + Clone + Eq + Hash, L: Loader<I>,

Compact the document relative to context with the given vocabulary and loader, using the given options and warning handler. Read more
source§

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>
where N: VocabularyMut<Iri = I>, I: Clone + Eq + Hash, N::BlankId: 'a + Clone + Eq + Hash, L: Loader<I>,

Flatten the document with the given vocabulary, generator and loader, using the given options and warning handler. Read more

Auto Trait Implementations§

§

impl<I, T> Freeze for RemoteDocument<I, T>
where T: Freeze, I: Freeze,

§

impl<I, T> RefUnwindSafe for RemoteDocument<I, T>

§

impl<I, T> Send for RemoteDocument<I, T>
where T: Send, I: Send,

§

impl<I, T> Sync for RemoteDocument<I, T>
where T: Sync, I: Sync,

§

impl<I, T> Unpin for RemoteDocument<I, T>
where T: Unpin, I: Unpin,

§

impl<I, T> UnwindSafe for RemoteDocument<I, T>
where T: UnwindSafe, I: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> At for T

source§

fn at<M>(self, metadata: M) -> Meta<T, M>

Wraps self inside a Meta<Self, M> using the given metadata. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> BorrowStripped for T

source§

fn stripped(&self) -> &Stripped<T>

source§

impl<T> BorrowUnordered for T

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, C> FromWithContext<T, C> for T

source§

fn from_with(value: T, _context: &C) -> T

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U, C> IntoWithContext<U, C> for T
where U: FromWithContext<T, C>,

source§

fn into_with(self, context: &C) -> U

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToOwned for T

§

type Owned = T

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U, C> TryFromWithContext<U, C> for T
where U: IntoWithContext<T, C>,

§

type Error = Infallible

source§

fn try_from_with( value: U, context: &C ) -> Result<T, <T as TryFromWithContext<U, C>>::Error>

source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T, U, C> TryIntoWithContext<U, C> for T
where U: TryFromWithContext<T, C>,

§

type Error = <U as TryFromWithContext<T, C>>::Error

source§

fn try_into_with( self, context: &C ) -> Result<U, <T as TryIntoWithContext<U, C>>::Error>

source§

impl<T> WithContext for T
where T: ?Sized,

source§

fn with<C>(&self, context: C) -> Contextual<&T, C>

source§

fn into_with<C>(self, context: C) -> Contextual<T, C>

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more