Skip to main content

WithGenerator

Struct WithGenerator 

Source
pub struct WithGenerator<G, I = StaticDomain<Term>> { /* private fields */ }
Expand description

Combines any RDF interpretation with a node id generator.

  • Provides a GenDomain implementation, using the given generator to create fresh node identifiers.
  • Assigns a node identifier to each new resource created by GenDomain::new_resource, based on the generator.

Note that in the case of the unit (()) interpretation, using GenDomain will give you a similar result but with other advantages (such as a ConstGenDomain implementation).

Implementations§

Source§

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

Source

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

Combines the given interpretation with the given generator.

Source

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

Discards this wrapper, returning the inner interpretation and generator.

Source

pub fn inner_interpretation(&self) -> &I

Returns a reference to the inner interpretation.

Source

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

Returns a mutable reference to the inner interpretation.

Source

pub fn generator(&self) -> &G

Returns a reference to the inner generator.

Source

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

Returns a mutable reference to the inner generator.

Source

pub fn into_inner_interpretation(self) -> I

Discards this wrapper and the generator, returning the inner interpretation.

Source

pub fn into_generator(self) -> G

Discards this wrapper and the interpretation, returning the inner generator.

Trait Implementations§

Source§

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

Source§

type Resource = <I as Domain>::Resource

Resource type.
Source§

impl<I: InterpretationMut, G: Generator> GenDomain for WithGenerator<G, I>

Source§

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

Create a new resource.
Source§

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

Source§

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

Interprets the given IRI, if possible.
Source§

fn literal<'a>( &self, literal: impl Into<LiteralRef<'a>>, ) -> Option<Self::Resource>

Interprets the given literal, if possible.
Source§

fn ground_term<'a>( &self, term: impl Into<GroundTermRef<'a>>, ) -> Option<Self::Resource>

Interprets the given ground term (an IRI or a literal), if possible.
Source§

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

Source§

fn insert_iri<'a>(&mut self, iri: impl Into<Cow<'a, Iri>>) -> Self::Resource

Interprets the given IRI, inserting a fresh resource for it if none exists yet.
Source§

fn insert_literal<'a>( &mut self, literal: impl Into<CowLiteral<'a>>, ) -> Self::Resource

Interprets the given literal, inserting a fresh resource for it if none exists yet.
Source§

fn insert_ground_term<'a>( &mut self, term: impl Into<CowGroundTerm<'a>>, ) -> Self::Resource

Interprets the given ground term, inserting a fresh resource for it if none exists yet.
Source§

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

Source§

fn blank_id<'a>(&'a self, blank_id: &'a BlankId) -> Option<Self::Resource>

Interprets the given blank node identifier, if possible.
Source§

fn term<'a>(&self, term: impl Into<TermRef<'a>>) -> Option<Self::Resource>

Interprets the given term (a blank node identifier or a ground term), if possible.
Source§

fn id<'a>(&self, id: impl Into<IdRef<'a>>) -> Option<Self::Resource>

Interprets the given identifier (a blank node identifier or an IRI), if possible.
Source§

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

Source§

fn insert_blank_id<'a>( &mut self, blank_id: impl Into<Cow<'a, BlankId>>, ) -> Self::Resource

Interprets the given blank node identifier, inserting a fresh resource for it if none exists yet.
Source§

fn insert_term<'a>(&mut self, term: impl Into<CowTerm<'a>>) -> Self::Resource

Interprets the given term, inserting a fresh resource for it if none exists yet.
Source§

fn insert_id<'a>(&mut self, term: impl Into<CowId<'a>>) -> Self::Resource

Interprets the given identifier, inserting a fresh resource for it if none exists yet.
Source§

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

Source§

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

Iterator over the IRIs of a resource.
Source§

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

Iterator over the literals of a resource.
Source§

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

Returns an iterator over the IRIs of resource.
Source§

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

Returns an iterator over the literals of resource.
Source§

fn ground_terms_of<'a>( &'a self, resource: &'a Self::Resource, ) -> GroundTermsOf<'a, Self>

Returns an iterator over the ground terms (IRIs and literals) of resource.
Source§

fn is_anonymous(&self, resource: &Self::Resource) -> bool

Checks whether resource has no ground term lexical representation.
Source§

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

Source§

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

Iterator over the blank node identifiers of a resource.
Source§

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

Returns an iterator over the blank node identifiers of resource.
Source§

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

Returns an iterator over the terms (ground terms and blank node identifiers) of resource.

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

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

§

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> TryDomain for I
where I: Domain,

Source§

type Error = Infallible

Error type.
Source§

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

Source§

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

Source§

type Error = Infallible

Error type.
Source§

fn try_iri( &self, iri: &Iri, ) -> Result<Option<<I as Domain>::Resource>, <I as TryGroundInterpretation>::Error>

Interprets the given IRI, if possible.
Source§

fn try_literal<'a>( &self, literal: impl Into<LiteralRef<'a>>, ) -> Result<Option<<I as Domain>::Resource>, <I as TryGroundInterpretation>::Error>

Interprets the given literal, if possible.
Source§

fn try_ground_term<'a>( &self, term: impl Into<GroundTermRef<'a>>, ) -> Result<Option<<I as Domain>::Resource>, <I as TryGroundInterpretation>::Error>

Interprets the given ground term (an IRI or a literal), if possible.
Source§

impl<I> TryGroundInterpretationMut for I

Source§

fn try_insert_iri<'a>( &mut self, iri: impl Into<Cow<'a, Iri>>, ) -> Result<<I as Domain>::Resource, <I as TryGroundInterpretation>::Error>

Interprets the given IRI, inserting a fresh resource for it if none exists yet.
Source§

fn try_insert_literal<'a>( &mut self, literal: impl Into<CowLiteral<'a>>, ) -> Result<<I as Domain>::Resource, <I as TryGroundInterpretation>::Error>

Interprets the given literal, inserting a fresh resource for it if none exists yet.
Source§

fn try_insert_ground_term<'a>( &mut self, term: impl Into<CowGroundTerm<'a>>, ) -> Result<<I as Domain>::Resource, <I as TryGroundInterpretation>::Error>

Interprets the given ground term, inserting a fresh resource for it if none exists yet.
Source§

impl<I> TryInterpretation for I
where I: Interpretation,

Source§

fn try_blank_id( &self, blank_id: &BlankId, ) -> Result<Option<<I as Domain>::Resource>, <I as TryGroundInterpretation>::Error>

Interprets the given blank node identifier, if possible.
Source§

fn try_term<'a>( &self, term: impl Into<TermRef<'a>>, ) -> Result<Option<<I as Domain>::Resource>, <I as TryGroundInterpretation>::Error>

Interprets the given term (a blank node identifier or a ground term), if possible.
Source§

fn try_id<'a>( &self, id: impl Into<IdRef<'a>>, ) -> Result<Option<<I as Domain>::Resource>, <I as TryGroundInterpretation>::Error>

Interprets the given identifier (a blank node identifier or an IRI), if possible.
Source§

impl<I> TryInterpretationMut for I

Source§

fn try_insert_blank_id<'a>( &mut self, blank_id: impl Into<Cow<'a, BlankId>>, ) -> Result<<I as Domain>::Resource, <I as TryGroundInterpretation>::Error>

Interprets the given blank node identifier, inserting a fresh resource for it if none exists yet.
Source§

fn try_insert_term<'a>( &mut self, term: impl Into<CowTerm<'a>>, ) -> Result<<I as Domain>::Resource, <I as TryGroundInterpretation>::Error>

Interprets the given term, inserting a fresh resource for it if none exists yet.
Source§

fn try_insert_id<'a>( &mut self, term: impl Into<CowId<'a>>, ) -> Result<<I as Domain>::Resource, <I as TryGroundInterpretation>::Error>

Interprets the given identifier, inserting a fresh resource for it if none exists yet.
Source§

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

Source§

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

Source§

type TryIris<'a> = InfallibleIterator<MapIntoOwned<<I as ReverseGroundInterpretation>::Iris<'a>>> where I: 'a

Iterator over the IRIs of a resource.
Source§

type TryLiterals<'a> = InfallibleIterator<MapIntoOwned<<I as ReverseGroundInterpretation>::Literals<'a>>> where I: 'a

Iterator over the literals of a resource.
Source§

fn try_iris_of<'a>( &'a self, resource: &'a <I as Domain>::Resource, ) -> Result<<I as TryReverseGroundInterpretation>::TryIris<'a>, <I as TryGroundInterpretation>::Error>

Returns an iterator over the IRIs of resource.
Source§

fn try_literals_of<'a>( &'a self, resource: &'a <I as Domain>::Resource, ) -> Result<<I as TryReverseGroundInterpretation>::TryLiterals<'a>, <I as TryGroundInterpretation>::Error>

Returns an iterator over the literals of resource.
Source§

fn try_is_anonymous( &self, resource: &<I as Domain>::Resource, ) -> Result<bool, <I as TryGroundInterpretation>::Error>

Checks whether resource has no ground term lexical representation.
Source§

fn try_ground_terms_of<'a>( &'a self, resource: &'a Self::Resource, ) -> Result<TryGroundTermsOf<'a, Self>, Self::Error>

Returns an iterator over the ground terms (IRIs and literals) of resource.
Source§

impl<I> TryReverseInterpretation for I

Source§

type TryBlankIds<'a> = InfallibleIterator<MapIntoOwned<<I as ReverseInterpretation>::BlankIds<'a>>> where I: 'a

Iterator over the blank node identifiers of a resource.
Source§

fn try_blank_ids_of<'a>( &'a self, resource: &'a <I as Domain>::Resource, ) -> Result<<I as TryReverseInterpretation>::TryBlankIds<'a>, <I as TryGroundInterpretation>::Error>

Returns an iterator over the blank node identifiers of resource.
Source§

fn try_terms_of<'a>( &'a self, resource: &'a Self::Resource, ) -> Result<TryTermsOf<'a, Self>, Self::Error>

Returns an iterator over the terms (ground terms and blank node identifiers) of resource.