The refactoring added `next_is` which takes a `&str` as parameter, while
we only use it with strings of lengths 2 and 3. Replacing this by 2
dedicated methods (which can be added to the trait interface and only
specialized if needed) removes almost all the overhead that was added by
`Input`.
Hiding character fetching behind this interface allows us to create more
specific implementations when is appropriate. For instance, an instance
of `Input` can be created for a `&str`, allowing for borrowing and more
efficient peeking and traversing than if we were to fetch characters one
at a time and placing them into a temporary buffer.
These are corner cases not tested by the `yaml-test-suite`.
Parsing for the reported input has been fixed, as well as other
similar-looking inputs which make use of nested implicit flow mappings
and implicit null keys and values.
Fixes#1.
Internally, `ScanError` stores a `String`. Having `new` take a `&str`
misleadingly indicates that it stores a `&str`. This commit changes
`new` so that it takes a `String`, and adds a convenience method,
`new_str` that takes a `&str` and allocates a `String` for it.
This implements the IndexMut trait for Yaml. This allows indexing the
Yaml type while having a mutable reference.
Unlike the Index, this will panic on a failure. That is allowed as per
the Rust documentation [1]. We don't have the option of returning a
mutable reference to BAD_VALUE as that is unsafe. So instead we just
panic.
1: https://doc.rust-lang.org/std/ops/trait.IndexMut.html#tymethod.index_mut
Resolves: https://github.com/chyh1990/yaml-rust/issues/123
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Co-authored-by: Ethiraric <ethiraric@gmail.com>
If someone lands on one of our forks on github there are still UI elements
that point them back to the original chyh1990 yaml-rust project.
Add links to make it easier to navigate back to the main fork when
viewing a yaml-rust2 fork.
Documents are self-contained and tags defined in the first document are not
visible to subsequent documents.
Add support for having tags that span across all documents by making the
clearing of tags in the parser opt-out.
Closes: #10
These tests were sucecssfully converted to Rust files to include and are
no longer necessary in this repository.
Should they become relevant again in the future, they can always be
checked out from a previous commit.