Feature/scanner/keys #16
No reviewers
Labels
No Label
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No Milestone
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: dolysis/yary#16
Loading…
Reference in New Issue
No description provided.
Delete Branch "feature/scanner/keys"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR adds limited support for scanning implicit YAML keys, currently only support flow scalar nodes. It expands test coverage to cover the new functionality, and also makes an API change to the scanner proper.
Components
Tokens<'de>
list to read tokens intoAPI Changes
The
Tokens<'de>
typedef holds parsed tokens which the caller can read from at their leisure. This change is important for a couple reasons. First it allows the Scanner to return >1 token per call, which greatly simplifies certain aspects of the Scanner, notably how it handlesToken::Key
generation. However this will also positively impact the handling of graph depth tokens generally (both flow and block), and likely provide room for optimizations around multi-doc streams.This change also decouples each Token's lifetime from the previously provided
&'c mut scratch
space, which lifetimes restricted to only a single token. Instead we now utilizeSlice<'de>
's ability to transport an ownedString
out thus removing the lifetime interaction, and allowing callers to retrieve (and thus parse) multiple tokens at once, which is a win for usability.Of course, the downside of this is that:
alloc
(and thereforestd
) dependentHowever 1. would happen anyway (due to how block indents must be stored) and may be fixable later by providing some feature that replaces the
Vec
andString
s with a trait over fallible allocation... or it may just be fixed for us by the boys over in Rust Kernel land merging their changes toalloc
upstream.