pub struct RemoteDocument<I = Index, M = Location<I>, T = Value<M>> { /* private fields */ }
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>

source

pub fn new( url: Option<I>, content_type: Option<Mime>, document: Meta<T, M> ) -> 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.

source

pub fn new_full( url: Option<I>, content_type: Option<Mime>, context_url: Option<I>, profile: HashSet<Profile<I>>, document: Meta<T, M> ) -> 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.

source

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.

source

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.

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) -> &Meta<T, M>

Returns a reference to the content of the document.

source

pub fn into_document(self) -> Meta<T, M>

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: Clone, M: Clone, T: Clone> Clone for RemoteDocument<I, M, T>

source§

fn clone(&self) -> RemoteDocument<I, M, 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

Auto Trait Implementations§

§

impl<I, M, T> RefUnwindSafe for RemoteDocument<I, M, T>where I: RefUnwindSafe, M: RefUnwindSafe, T: RefUnwindSafe,

§

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

§

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

§

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

§

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

Blanket Implementations§

source§

impl<T> Any for Twhere 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 Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · 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§

fn unordered(&self) -> &Unordered<T>

source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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> ToOwned for Twhere 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

source§

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

source§

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