Expand description
Process-wide string interner used by crate::context::definition::Key.
Backed by lasso::ThreadedRodeo. Interned strings live for the lifetime
of the program and are never freed.
§Untrusted input
Every term key of every parsed @context is interned, so the interner’s
memory usage grows with the number of distinct context keys the process
ever parses — a quantity that is attacker-controlled when parsing
untrusted documents. A long-running service accepting arbitrary JSON-LD
should bound the size of the documents it accepts (for example via
Options::max_document_size on the reqwest loader of the main crate,
or an equivalent limit at the transport layer) to keep this growth
proportional to the traffic it chooses to serve.
Structs§
- Spur
- The default key for every Rodeo, uses only 32 bits of space
Functions§
- intern
- Interns the given string and returns its
Spur. - intern_
static - Interns the given string and returns the canonical
&'static strdirectly. - interner
- Returns the global interner, initializing it on first call.
- resolve
- Resolves a
Spurback to its&'static str. - try_
resolve - Resolves a
Spurback to its&'static str, returningNoneif the key was never handed out byintern(e.g. forged vialasso::Key::try_from_usize).