CfgPath overhaul
- May 03, 2022
-
-
Ian Jackson authored
Use MessagePack. Signed-off-by:
Ian Jackson <ijackson@chiark.greenend.org.uk>
-
Ian Jackson authored
And provide round-trip tests. As per #371
-
Ian Jackson authored
Document that this can contain either a string for expansion, or a literal PathBuf not for expansion. Rename the `from_path` method to `new_literal`: a very important difference is whether it gets expanded - less important than the Rust type. Also, now it takes `Into<PathBuf>`, which avoids a needless clone. (We don't change the API in `arti-client` because `&tempfile::Tempdir()` doesn't implement `Into<PathBuf>`, so `arti-client` has to have some new `as_ref` calls.) Provide accessors `as_unexpanded_str` and `as_literal_path`. The deserialisation already makes this part of the stable API,l so not pvoding accessors seems just obstructive. They are useful for tests, too. Add tests for the new entrypoints, and for deserialisation of both variants from TOML (via config, or directly) and JSON.
-
Ian Jackson authored
We introduce LiteralPath struct, so that a literal path deserialises from some_path = { literal: "actual path string" } This makes the deserialisation unambiguous.
-
Ian Jackson authored
arti uses this. Somehow this seems to be enabled by some other thing in the crate graph, but I found that adding a similar dependency to another crate resulted in a `config` which doesn't compile.
-