pub struct WithGenerator<G, I = ()> { /* private fields */ }
Expand description

Combines any RDF interpretation with a node id generator to make it implement InterpretationMut.

§Use cases

§() does not implement InterpretationMut

The transparent interpretation (the unit type ()) does not implement InterpretationMut because the new_resource method would require the creation of a fresh, unused, blank node identifier, which the transparent interpretation cannot create without a node id generator.

§Resources returned by InterpretationMut::new_resource have no lexical representation

Interpreted resources are not required to have a lexical representation. This is most probably the case for new resources returned by InterpretationMut::new_resource. You can use WithGenerator to pair the interpretation with a node id generator so that new_resource will assign a lexical representation to new resources (a fresh blank node id for instance).

Implementations§

source§

impl<G, I> WithGenerator<G, I>

source

pub fn new(interpretation: I, generator: G) -> Self

source

pub fn into_parts(self) -> (I, G)

source

pub fn inner_interpretation(&self) -> &I

source

pub fn inner_interpretation_mut(&mut self) -> &mut I

source

pub fn generator(&self) -> &G

source

pub fn generator_mut(&mut self) -> &mut G

source

pub fn into_inner_interpretation(self) -> I

source

pub fn into_generator(self) -> G

Trait Implementations§

source§

impl<B, I: BlankIdInterpretation<B>, G> BlankIdInterpretation<B> for WithGenerator<G, I>

source§

fn blank_id_interpretation(&self, blank_id: &B) -> Option<Self::Resource>

Returns the interpretation of the given blank node identifier, if any.
source§

fn lexical_blank_id_interpretation( &self, vocabulary: &impl BlankIdVocabulary<BlankId = B>, blank_id: &BlankId ) -> Option<Self::Resource>
where B: Sized,

source§

impl<B, I: BlankIdInterpretationMut<B>, G> BlankIdInterpretationMut<B> for WithGenerator<G, I>

source§

fn interpret_blank_id(&mut self, blank_id: B) -> Self::Resource

Interprets the given blank node identifier.
source§

fn interpret_lexical_blank_id( &mut self, vocabulary: &mut impl BlankIdVocabularyMut<BlankId = B>, blank_id: &BlankId ) -> Self::Resource

source§

fn interpret_owned_lexical_blank_id( &mut self, vocabulary: &mut impl BlankIdVocabularyMut<BlankId = B>, blank_id: BlankIdBuf ) -> Self::Resource

source§

impl<I: Interpretation, G> Interpretation for WithGenerator<G, I>

§

type Resource = <I as Interpretation>::Resource

Resource identifier type.
source§

impl<V: IriVocabulary + BlankIdVocabulary, I, G: Generator<V>> InterpretationMut<V> for WithGenerator<G, I>

source§

fn new_resource(&mut self, vocabulary: &mut V) -> Self::Resource

Creates a new resource.
source§

impl<Iri, I: IriInterpretation<Iri>, G> IriInterpretation<Iri> for WithGenerator<G, I>

source§

fn iri_interpretation(&self, iri: &Iri) -> Option<Self::Resource>

Returns the interpretation of the given IRI, if any.
source§

fn lexical_iri_interpretation( &self, vocabulary: &impl IriVocabulary<Iri = I>, iri: &Iri ) -> Option<Self::Resource>
where I: Sized,

source§

impl<Iri, I: IriInterpretationMut<Iri>, G> IriInterpretationMut<Iri> for WithGenerator<G, I>

source§

fn interpret_iri(&mut self, iri: Iri) -> Self::Resource

Interprets the given IRI.
source§

fn interpret_lexical_iri( &mut self, vocabulary: &mut impl IriVocabularyMut<Iri = I>, iri: &Iri ) -> Self::Resource

source§

fn interpret_owned_lexical_iri( &mut self, vocabulary: &mut impl IriVocabularyMut<Iri = I>, iri: IriBuf ) -> Self::Resource

source§

impl<L, I: LiteralInterpretation<L>, G> LiteralInterpretation<L> for WithGenerator<G, I>

source§

fn literal_interpretation(&self, literal: &L) -> Option<Self::Resource>

Returns the interpretation of the given literal value, if any.
source§

fn lexical_literal_interpretation<V: LiteralVocabulary<Literal = L>>( &self, vocabulary: &V, literal: &Literal<V::Iri> ) -> Option<Self::Resource>

source§

impl<L, I: LiteralInterpretationMut<L>, G> LiteralInterpretationMut<L> for WithGenerator<G, I>

source§

fn interpret_literal(&mut self, literal: L) -> Self::Resource

Interprets the given literal value.
source§

fn interpret_lexical_literal<V: LiteralVocabularyMut<Literal = L>>( &mut self, vocabulary: &mut V, literal: &Literal<V::Iri> ) -> Self::Resource

source§

fn interpret_owned_lexical_literal<V: LiteralVocabularyMut<Literal = L>>( &mut self, vocabulary: &mut V, literal: Literal<V::Iri> ) -> Self::Resource

source§

fn interpret_full_lexical_literal( &mut self, vocabulary: &mut (impl IriVocabularyMut + LiteralVocabularyMut<Literal = L>), literal: Literal ) -> Self::Resource

source§

impl<I: ReverseBlankIdInterpretation, G> ReverseBlankIdInterpretation for WithGenerator<G, I>

§

type BlankId = <I as ReverseBlankIdInterpretation>::BlankId

§

type BlankIds<'a> = <I as ReverseBlankIdInterpretation>::BlankIds<'a> where Self: 'a

source§

fn blank_ids_of<'a>(&'a self, id: &'a Self::Resource) -> Self::BlankIds<'a>

source§

impl<I: ReverseBlankIdInterpretationMut, G> ReverseBlankIdInterpretationMut for WithGenerator<G, I>

source§

fn assign_blank_id( &mut self, id: &Self::Resource, blank_id: Self::BlankId ) -> bool

source§

impl<I: ReverseIriInterpretation, G> ReverseIriInterpretation for WithGenerator<G, I>

§

type Iri = <I as ReverseIriInterpretation>::Iri

§

type Iris<'a> = <I as ReverseIriInterpretation>::Iris<'a> where Self: 'a

source§

fn iris_of<'a>(&'a self, id: &'a Self::Resource) -> Self::Iris<'a>

source§

impl<I: ReverseIriInterpretationMut, G> ReverseIriInterpretationMut for WithGenerator<G, I>

source§

fn assign_iri(&mut self, id: &Self::Resource, iri: Self::Iri) -> bool

source§

impl<I: ReverseLiteralInterpretation, G> ReverseLiteralInterpretation for WithGenerator<G, I>

§

type Literal = <I as ReverseLiteralInterpretation>::Literal

§

type Literals<'a> = <I as ReverseLiteralInterpretation>::Literals<'a> where Self: 'a

source§

fn literals_of<'a>(&'a self, id: &'a Self::Resource) -> Self::Literals<'a>

source§

impl<I: ReverseLiteralInterpretationMut, G> ReverseLiteralInterpretationMut for WithGenerator<G, I>

source§

fn assign_literal( &mut self, resource: &Self::Resource, literal: Self::Literal ) -> bool

Assigns the given literal to the given resource.

Auto Trait Implementations§

§

impl<G, I> RefUnwindSafe for WithGenerator<G, I>

§

impl<G, I> Send for WithGenerator<G, I>
where G: Send, I: Send,

§

impl<G, I> Sync for WithGenerator<G, I>
where G: Sync, I: Sync,

§

impl<G, I> Unpin for WithGenerator<G, I>
where G: Unpin, I: Unpin,

§

impl<G, I> UnwindSafe for WithGenerator<G, I>
where G: 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> 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<I> FallibleInterpretation for I
where I: Interpretation,

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<I, B, T> IdInterpretation<I, B> for T

source§

fn id_interpretation(&self, id: &Id<I, B>) -> Option<Self::Resource>

Returns the interpretation of the given node identifier, if any.
source§

fn lexical_id_interpretation( &self, vocabulary: &(impl IriVocabulary<Iri = I> + BlankIdVocabulary<BlankId = B>), id: Id<&Iri, &BlankId> ) -> Option<Self::Resource>

source§

impl<I, B, T> IdInterpretationMut<I, B> for T

source§

fn interpret_id(&mut self, id: Id<I, B>) -> Self::Resource

Interprets the given identifier.
source§

fn interpret_lexical_id( &mut self, vocabulary: &mut (impl IriVocabularyMut<Iri = I> + BlankIdVocabularyMut<BlankId = B>), id: Id<&Iri, &BlankId> ) -> Self::Resource

source§

fn interpret_owned_lexical_id( &mut self, vocabulary: &mut (impl IriVocabularyMut<Iri = I> + BlankIdVocabularyMut<BlankId = B>), id: Id ) -> Self::Resource

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<I> ReverseIdInterpretation for I

source§

fn ids_of<'a>(&'a self, id: &'a Self::Resource) -> IdsOf<'a, Self>

source§

impl<I> ReverseIdInterpretationMut for I

source§

fn assign_id( &mut self, r: &Self::Resource, id: Id<Self::Iri, Self::BlankId> ) -> bool

source§

impl<I> ReverseTermInterpretation for I

source§

fn terms_of<'a>(&'a self, id: &'a Self::Resource) -> TermsOf<'a, Self>

source§

fn term_of<'a>(&'a self, id: &'a Self::Resource) -> Option<TermOf<'a, Self>>

source§

fn has_term(&self, id: &Self::Resource) -> bool

source§

fn quads_of<'a>( &'a self, quad: Quad<&'a Self::Resource, &'a Self::Resource, &'a Self::Resource, &'a Self::Resource> ) -> QuadsOf<'a, Self>

source§

fn grdf_quads_of<'a>( &'a self, quad: Quad<&'a Self::Resource, &'a Self::Resource, &'a Self::Resource, &'a Self::Resource> ) -> GrdfQuadsOf<'a, Self>

source§

impl<I> ReverseTermInterpretationMut for I

source§

fn assign_term( &mut self, resource: &Self::Resource, term: Term<Id<Self::Iri, Self::BlankId>, Self::Literal> ) -> bool

Assigns the given term to the given resource.
source§

fn assign_terms( &mut self, f: impl FnMut(&Self, &Self::Resource) -> Option<Term<Id<Self::Iri, Self::BlankId>, Self::Literal>> )

Assigns a term to all the interpreted resources.
source§

fn generate_ids<V: IriVocabulary + BlankIdVocabulary>( &mut self, vocabulary: &mut V, generator: &mut impl Generator<V> )
where Self::Resource: Clone, Self: TraversableInterpretation + ReverseTermInterpretationMut<Iri = V::Iri, BlankId = V::BlankId>,

Generates and assign a node identifier for all the resources that don’t have any term, using the given generator.
source§

impl<I, B, L, T> TermInterpretation<I, B, L> for T

source§

fn term_interpretation( &self, term: &Term<Id<I, B>, L> ) -> Option<Self::Resource>

Returns the interpretation of the given term, if any.
source§

fn lexical_term_interpretation( &self, vocabulary: &impl Vocabulary<Iri = I, BlankId = B, Literal = L>, term: Term<Id<&Iri, &BlankId>, &Literal<I>> ) -> Option<Self::Resource>

source§

impl<I, B, L, T> TermInterpretationMut<I, B, L> for T

source§

fn interpret_term(&mut self, term: Term<Id<I, B>, L>) -> Self::Resource

source§

fn interpret_lexical_term( &mut self, vocabulary: &mut impl VocabularyMut<Iri = I, BlankId = B, Literal = L>, term: Term<Id<&Iri, &BlankId>, &Literal<I>> ) -> Self::Resource

source§

fn interpret_owned_lexical_term( &mut self, vocabulary: &mut impl VocabularyMut<Iri = I, BlankId = B, Literal = L>, term: Term<Id, Literal<I>> ) -> Self::Resource

source§

fn interpret_full_lexical_term( &mut self, vocabulary: &mut impl VocabularyMut<Iri = I, BlankId = B, Literal = L>, term: Term ) -> Self::Resource

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> 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.