pub struct BlankNodeManager {
pub mapping: HashMap<String, String>,
/* private fields */
}Expand description
Converts blank-node identifiers (_:…) into stable, unique IRIs.
Fields§
§mapping: HashMap<String, String>Maps a blank-node id such as "_:b0" to the minted IRI.
Implementations§
Source§impl BlankNodeManager
impl BlankNodeManager
Sourcepub fn new(base_iri: impl Into<String>) -> Self
pub fn new(base_iri: impl Into<String>) -> Self
Create a new manager. Every minted IRI will start with base_iri.
Sourcepub fn mint(&mut self, blank_id: &str) -> String
pub fn mint(&mut self, blank_id: &str) -> String
Mint a fresh IRI for blank_id and remember the mapping.
If the same blank_id has already been minted, the existing IRI is
returned without incrementing the counter.
Sourcepub fn resolve(&mut self, s: &str) -> String
pub fn resolve(&mut self, s: &str) -> String
If s is a blank-node identifier return (or create) its minted IRI;
otherwise return s unchanged.
Sourcepub fn mapping_count(&self) -> usize
pub fn mapping_count(&self) -> usize
Total number of unique blank nodes minted so far.
Sourcepub fn get_minted(&self, blank_id: &str) -> Option<&str>
pub fn get_minted(&self, blank_id: &str) -> Option<&str>
Look up a previously minted IRI without mutating state.
Auto Trait Implementations§
impl Freeze for BlankNodeManager
impl RefUnwindSafe for BlankNodeManager
impl Send for BlankNodeManager
impl Sync for BlankNodeManager
impl Unpin for BlankNodeManager
impl UnsafeUnpin for BlankNodeManager
impl UnwindSafe for BlankNodeManager
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more