pub struct ProcessingStack<I> { /* private fields */ }Expand description
The chain of remote context URLs currently being processed.
This is the specification’s remote contexts array. It serves two purposes:
spotting a context that includes itself, and bounding the length of a remote
context chain at MAX_REMOTE_CONTEXTS. Whether it is empty also tells the
algorithm whether the context being processed came from a remote document,
which is what decides if its @base entry applies.
Implemented as an immutable singly-linked list behind Arcs, so the copy
each recursive call receives is a pointer bump rather than a clone of the
chain.
Implementations§
Source§impl<I> ProcessingStack<I>
impl<I> ProcessingStack<I>
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Checks whether no remote context has been entered, i.e. the context being processed is not itself remote.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of remote contexts on the stack.
Walks the chain, so this is linear in the stack depth.
Sourcepub fn cycle(&self, url: &I) -> boolwhere
I: PartialEq,
pub fn cycle(&self, url: &I) -> boolwhere
I: PartialEq,
Checks whether url is already on the stack, meaning entering it would
close a loop.
Sourcepub fn push(&mut self, url: I) -> boolwhere
I: PartialEq,
pub fn push(&mut self, url: I) -> boolwhere
I: PartialEq,
Pushes url onto the stack, unless it is already there.
Returns true when the URL was added, and false when it was already on
the stack and nothing changed. What false means is version-dependent:
JSON-LD 1.0 treats it as a recursive context inclusion error, while 1.1
simply skips reprocessing the context.
Trait Implementations§
Source§impl<I: Clone> Clone for ProcessingStack<I>
impl<I: Clone> Clone for ProcessingStack<I>
Auto Trait Implementations§
impl<I> Freeze for ProcessingStack<I>
impl<I> RefUnwindSafe for ProcessingStack<I>
impl<I> Send for ProcessingStack<I>
impl<I> Sync for ProcessingStack<I>
impl<I> Unpin for ProcessingStack<I>
impl<I> UnsafeUnpin for ProcessingStack<I>
impl<I> UnwindSafe for ProcessingStack<I>
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
Source§impl<T> BorrowUnordered for T
impl<T> BorrowUnordered for T
Source§fn as_unordered(&self) -> &Unordered<T>
fn as_unordered(&self) -> &Unordered<T>
Unordered reference.