Skip to content
Snippets Groups Projects

CfgPath overhaul

Merged Ian Jackson requested to merge Diziet/arti:path into main
  1. May 03, 2022
    • Ian Jackson's avatar
      2da84857
    • Ian Jackson's avatar
      CfgPath: Make it Serialize · 1e6c6169
      Ian Jackson authored
      And provide round-trip tests.
      
      As per #371
      1e6c6169
    • Ian Jackson's avatar
      CfgPath: Overhaul API · ed970310
      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.
      ed970310
    • Ian Jackson's avatar
      CfgPath: Change deserialisaation of Literal variant · ae776392
      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.
      ae776392
    • Ian Jackson's avatar
      config: Enable "toml" feature · a150d53f
      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.
      a150d53f
Loading