pub struct StringSink { /* private fields */ }Expand description
Query-scoped sink for strings produced by expression evaluation — the result
of CONCAT/SUBSTR/UCASE/…, an xsd:dateTime lexical from NOW, a UUID
string, or a value-producing BIND. EvalResult only carries a u64 hash, so a
produced string must be interned somewhere its hash can be resolved again; this is
that table.
It uses interior mutability (RefCell) so it can be carried by the Copy
TextResolver and written during evaluation without threading &mut through
the recursive evaluator. This is the cold expression-eval tier (which already
allocates Strings for text builtins), not the §6 zero-heap hot path, so a small
interning table here does not violate the hot-path invariant.
Implementations§
Source§impl StringSink
impl StringSink
pub fn new() -> Self
Sourcepub fn intern(&self, text: &str) -> u64
pub fn intern(&self, text: &str) -> u64
Intern a produced plain string, returning its stable content-derived token. Deterministic (same text → same token), so repeated/reordered evaluation of a pure builtin is referentially transparent (plan §4.4, QISP-R06).
Sourcepub fn intern_tagged(
&self,
text: &str,
lang: Option<&str>,
datatype: Option<&str>,
) -> u64
pub fn intern_tagged( &self, text: &str, lang: Option<&str>, datatype: Option<&str>, ) -> u64
Intern a produced string carrying an optional language tag / datatype IRI
(STRLANG/STRDT). The token distinguishes "x", "x"@en, "x"^^:t via
literal_term_hash, so LANG/DATATYPE can read the tag back.
Sourcepub fn resolve(&self, hash: u64) -> Option<String>
pub fn resolve(&self, hash: u64) -> Option<String>
Resolve a previously-interned produced string.
Trait Implementations§
Source§impl Debug for StringSink
impl Debug for StringSink
Source§impl Default for StringSink
impl Default for StringSink
Source§fn default() -> StringSink
fn default() -> StringSink
Auto Trait Implementations§
impl !Freeze for StringSink
impl !RefUnwindSafe for StringSink
impl Send for StringSink
impl !Sync for StringSink
impl Unpin for StringSink
impl UnsafeUnpin for StringSink
impl UnwindSafe for StringSink
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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