Commit graph

374 commits

Author SHA1 Message Date
Alistair Francis
1fb76ae745 yaml: Implement IndexMut
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>
2024-03-30 18:52:39 +01:00
Ethiraric
bf2aaf8044 Add doc checks to before_commit. 2024-03-28 21:06:32 +01:00
David Aguilar
5c7e11ea3f maint: version-up and minimize where we mention the version
Remove the version number from tools/gen_large_yaml so that we
can avoid needing to update the version in two places.
2024-03-25 22:25:46 -07:00
David Aguilar
f34c6869f1 yaml-rust2 v0.8.0 2024-03-25 22:18:38 -07:00
David Aguilar
67ec4899c0 CHANGELOG: mention the linguist development-related updates 2024-03-25 22:18:37 -07:00
David Aguilar
3f128e806c garden: access yaml-rust2 pull requests as yaml-rust2/pull/* 2024-03-25 22:18:37 -07:00
David Aguilar
728bd8b391 garden: update urls and remove old forks and links
We have the commits in git now.
2024-03-25 22:18:37 -07:00
Spenser Black
c7689fb84b Add linguist attributes for tests/*.rs.inc files
This informs Linguist (used by GitHub) that these files are Rust (they
are currently detected as C++). This also marks them as generated.
2024-03-25 20:11:04 +01:00
John Vandenberg
6ec65e636f fix typos 2024-03-25 14:52:44 +01:00
David Aguilar
697550e112 README: update the installation snippet to use yaml-rust2 0.7 2024-03-24 17:00:57 -07:00
David Aguilar
77bf4eaeef README: add self-links to make things more discoverable
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.
2024-03-24 17:00:19 -07:00
David Aguilar
d7f7c7ce15 yaml: add YamlLoader::load_from_parser(&Parser)
Make it easier to load documents from a prebuilt Parser.
2024-03-25 00:06:10 +01:00
David Aguilar
c00b27bb95 parser: add Parser::new_from_str(&str) 2024-03-25 00:06:10 +01:00
David Aguilar
61b0e70a4e parser: fixup typos from github 2024-03-24 15:01:38 -07:00
David Aguilar
86f008196c CHANGELOG: simplify the formatting and document YamlLoader::documents() 2024-03-24 14:45:52 -07:00
David Aguilar
06708ee787 CHANGELOG: document the keep_tags API addition 2024-03-24 14:27:04 -07:00
David Aguilar
c8e82c00d1 parser: add a test for keep_tags(false)
Co-authored-by: Ethiraric <ethiraric@gmail.com>
2024-03-24 14:21:33 -07:00
David Aguilar
dec6bf35bb parser: better document keep_tags
Co-authored-by: Ethiraric <ethiraric@gmail.com>
2024-03-24 14:21:33 -07:00
David Aguilar
150b6f0927 parser: add an option to keep tags across multiple documents
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
2024-03-24 14:21:33 -07:00
David Aguilar
16f3ea39e1 yaml: add YamlLoader::documents() to get a read-only view of the parsed documents 2024-03-24 14:21:33 -07:00
Ethiraric
ee92e953f1 Switch from encoding to encoding_rs.
See https://github.com/rustsec/advisory-db/issues/1605.
2024-03-24 17:14:44 +01:00
Gregor Purdy
c5c9f4af16 Typo fix 4 in 2024-03-15-FirstRelease.md 2024-03-21 14:22:39 +01:00
Gregor Purdy
6e9351f84b Typo fix 3 in 2024-03-15-FirstRelease.md 2024-03-21 14:22:14 +01:00
Gregor Purdy
a4ce3e9696 Typo fix 2 in 2024-03-15-FirstRelease.md 2024-03-21 14:22:00 +01:00
Gregor Purdy
f5cb266a43 Typo fix 2024-03-21 14:21:26 +01:00
Ethiraric
580d7b0525 Remove no longer needed test files.
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.
2024-03-21 12:37:10 +01:00
Ethiraric
2fe52cf1c2 Run CI only on master pushes. 2024-03-21 12:33:00 +01:00
Ethiraric
0f97d2b9e4 Make gen_large_yaml reproductible.
* Use a seedable RNG so that we can have the same number sequence.
* Replace `HashMap`s with `Vec`s to avoid undeterministic iteration.
2024-03-20 23:07:08 +01:00
Ethiraric
60bf9c80ba Edit v0.6 post with cargo alias. 2024-03-20 21:39:38 +01:00
Ethiraric
3279baaab9 Fix rustdoc ignore directive. 2024-03-20 16:00:33 +01:00
Ethiraric
ccd7b6e718 Add missing_docs warning. 2024-03-20 16:00:30 +01:00
Ethiraric
8247f481c7 Forgot to bump some v0.6.0 to v0.7.0. 2024-03-20 16:00:15 +01:00
Ethiraric
a87922680c Update cargo version to 0.7. 2024-03-20 14:42:31 +01:00
David Aguilar
d9a3d49468 CHANGELOG: move recent updates to v0.7.0 and add a v0.6.0 section 2024-03-20 14:21:27 +01:00
David Aguilar
71003055a7 README: add an "Upgrading from yaml-rust" section 2024-03-20 14:21:27 +01:00
Ethiraric
f497d2c49f Add serde-yaml to benchmark.
This internally uses `libfyaml`, so this is more of a benchmark of
libfyaml in the end.
2024-03-19 19:29:25 +01:00
Ethiraric
011e81ee85 Re-enable clippy warnings. 2024-03-19 18:18:59 +01:00
David Aguilar
cccf769b1c Enable all clippy warnings
Rename Scanner::next() to Scanner::next_token() to avoid
confusiong with the Iterator trait.
2024-03-19 15:26:16 +01:00
David Aguilar
a120d93e7d Enable the missing-errors-doc clippy checks 2024-03-19 15:26:16 +01:00
David Aguilar
9e505d552f Eliminate panics and enable the missing panics docs check 2024-03-19 15:26:16 +01:00
David Aguilar
a42f26b306 Enable the redundant-else clippy checks 2024-03-19 15:26:16 +01:00
David Aguilar
b2bed366cf Add a CHANGELOG to keep track of yaml-rust2 development 2024-03-19 15:26:16 +01:00
David Aguilar
49464b43d9 README: trivial grammar tweak 2024-03-19 15:26:16 +01:00
David Aguilar
aa1afd38d5 Add a garden file for dev tasks
Garden is a simple command runner that uses YAML (via yaml-rust) as its
file format. Garden will be switching over to yaml-rust2 shortly.
2024-03-19 15:26:16 +01:00
Ben Boeckel
8110c942ec doc: mention that types are not interpreted
Closes: #87
2024-03-19 15:26:16 +01:00
David Aguilar
e36369d69c Enable the case-arms clippy checks 2024-03-19 15:26:16 +01:00
lincoln auster [they/them]
7b4422bb5d implement borrowed_or
Allow the usage of `or` without consuming self. This can be useful
for pipelines that maintain some sort of owned state.
2024-03-19 15:26:16 +01:00
lincoln auster [they/them]
f8542f0f97 introduce or function
Similarly to `or` for Rust's options, this patch provides a way to
'override' the value of a Yaml node if it's some form of error.
2024-03-19 15:26:16 +01:00
David Aguilar
9764f399fb Update to quickcheck 1.0 2024-03-19 15:26:16 +01:00
Marko Mikulicic
c32db2986c Use a YamlDecoder builder to implement optional encoding_trap parameter. 2024-03-19 15:26:16 +01:00