pub enum RemoteDocumentReference<I = IriBuf, T = Value> {
Iri(I),
Loaded(RemoteDocument<I, T>),
}Expand description
Remote document, loaded or not.
Either an IRI or the actual document content.
Variants§
Implementations§
Source§impl<I, T> RemoteDocumentReference<I, T>
impl<I, T> RemoteDocumentReference<I, T>
Source§impl<I> RemoteDocumentReference<I>
impl<I> RemoteDocumentReference<I>
Sourcepub async fn load_with<V, L>(
self,
vocabulary: &mut V,
loader: &L,
) -> LoadingResult<I, L::Error>
pub async fn load_with<V, L>( self, vocabulary: &mut V, loader: &L, ) -> LoadingResult<I, L::Error>
Loads the remote document with the given vocabulary and loader.
If the document is already Self::Loaded, simply returns the inner
RemoteDocument.
§Errors
Returns the loader’s error when the document cannot be fetched or parsed.
Sourcepub async fn loaded_with<V, L>(
&self,
vocabulary: &mut V,
loader: &L,
) -> Result<Cow<'_, RemoteDocument<V::Iri>>, LoadError<L::Error>>
pub async fn loaded_with<V, L>( &self, vocabulary: &mut V, loader: &L, ) -> Result<Cow<'_, RemoteDocument<V::Iri>>, LoadError<L::Error>>
Loads the remote document with the given vocabulary and loader.
For Self::Iri returns an owned RemoteDocument with
Cow::Owned.
For Self::Loaded returns a reference to the inner RemoteDocument
with Cow::Borrowed.
§Errors
Returns the loader’s error when the document cannot be fetched or parsed.
Source§impl<I> RemoteDocumentReference<I, Context>
impl<I> RemoteDocumentReference<I, Context>
Sourcepub async fn load_context_with<V, L: Loader>(
self,
vocabulary: &mut V,
loader: &L,
) -> Result<RemoteContext<I>, ContextLoadError<L::Error>>
pub async fn load_context_with<V, L: Loader>( self, vocabulary: &mut V, loader: &L, ) -> Result<RemoteContext<I>, ContextLoadError<L::Error>>
Loads the remote context with the given vocabulary and loader.
If the context is already Self::Loaded, simply returns the inner
RemoteContext.
§Errors
Returns an error when the document cannot be fetched, or when it holds no @context entry.
Sourcepub async fn loaded_context_with<V, L: Loader>(
&self,
vocabulary: &mut V,
loader: &L,
) -> Result<Cow<'_, RemoteContext<I>>, ContextLoadError<L::Error>>
pub async fn loaded_context_with<V, L: Loader>( &self, vocabulary: &mut V, loader: &L, ) -> Result<Cow<'_, RemoteContext<I>>, ContextLoadError<L::Error>>
Loads the remote context with the given vocabulary and loader.
For Self::Iri returns an owned RemoteContext with
Cow::Owned.
For Self::Loaded returns a reference to the inner RemoteContext
with Cow::Borrowed.
§Errors
Returns an error when the document cannot be fetched, or when it holds no @context entry.
Trait Implementations§
Auto Trait Implementations§
impl<I, T> Freeze for RemoteDocumentReference<I, T>
impl<I, T> RefUnwindSafe for RemoteDocumentReference<I, T>
impl<I, T> Send for RemoteDocumentReference<I, T>
impl<I, T> Sync for RemoteDocumentReference<I, T>
impl<I, T> Unpin for RemoteDocumentReference<I, T>
impl<I, T> UnsafeUnpin for RemoteDocumentReference<I, T>
impl<I, T> UnwindSafe for RemoteDocumentReference<I, T>
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.