aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-config
Commit message (Collapse)AuthorAgeFilesLines
...
| * arti-config abolition: Add deps to tor-configIan Jackson2022-05-131-0/+2
| | | | | | | | These are needed to support the code which is moving.
* | impl_standard_builder: Better comments explaining the parserIan Jackson2022-05-131-1/+7
| |
* | impl_standard_builder: Have it generate FooConfig::builderIan Jackson2022-05-121-0/+7
| | | | | | | | | | This deletes many handcoded impls. It also generates lots of impls that we previously didn't have.
* | impl_standard_builder: Test the Deserialize implIan Jackson2022-05-121-14/+69
|/ | | | | | | | | | Test the Deserialize impl of every config struct. This detects bugs like the one fixed in !502. The macro now becomes more complex because it needs to take options. Right now this tt-munching option parser is overkill, but this leave space for further options in the future.
* Rename impl_standard_builder from impl_default_via_builderIan Jackson2022-05-121-3/+8
| | | | | | | | | | | | I have Plans for this macro. In particular: * I have a wip branch which tests that the Builder can be deserialised from an empty config (ie, that config reading of a config with a blank section for this item works). * I think we should autogenerate $Config::builder(), and promote that, rather than $ConfigBuilder::default(). This macro could do that.
* Merge branch 'arti-config-1' into 'main'eta2022-05-123-0/+210
|\ | | | | | | | | arti-config: Move cmdline to tor-config See merge request tpo/core/arti!498
| * arti-config: Move cmdline to tor-configIan Jackson2022-05-113-0/+210
| | | | | | | | | | | | This does not know anything about arti, only about TOML and Config. Code motion, plus necessary import adjustments.
* | Define and use impl_default_via_builderIan Jackson2022-05-111-0/+25
|/
* tor-config: Export CfgPathErrorIan Jackson2022-05-111-1/+1
| | | | | It is not clear to me how this `pub enum` survived the "inaccessible pub" lint.
* Bump the version of every* crate to 0.3.0Nick Mathewson2022-05-061-3/+3
| | | | * Except for safelog and fs-mistrust, which are new.
* Switch to derive_builder_arti_forkIan Jackson2022-05-061-1/+1
| | | | | | | | | For reference, the git source for this crate (and the others in its workspace) currently lives in my personal github account (ijackson). If this fork turns out to be long-lived and gains features and/or users, it would be good to move it to a gitlab somewhere. I have granted Nick crate ownership on the crates.io system.
* Merge branch 'typos-20220504' into 'main'eta2022-05-051-3/+3
|\ | | | | | | | | Fix typos (using the typos-cli tool). See merge request tpo/core/arti!486
| * Fix typos (using the typos-cli tool).Nick Mathewson2022-05-041-3/+3
| |
* | config derive attrs: Make builders serde, and validated structs notIan Jackson2022-05-051-11/+13
|/ | | | | | | | | | | | | | | * Builders additionally derive: Debug, Serialize, Deserialize. * Validated structs no longer derive: Serialize, Deserialize and all related attributes deleted. * As a consequence, all the `#[serde(deny_unknown_fields)]` are gone. That means that right now unknown fields are totally ignored. This is good for compatibility but poor for useability. Doing something better here is arti#417, in progress. * As a consequence, delete tor_dirmgr::retry::default_parallelism. (The default value was already duplicated into a builder attr.)
* list_builder: Add some xrefs about macro_rules limitationsIan Jackson2022-05-041-0/+8
| | | | | Apropos https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/474#note_2800481
* Fix typoNick Mathewson2022-05-041-1/+1
|
* list_builder: Provide VecBuilderIan Jackson2022-05-041-0/+41
| | | | This is for lists of plain types (non-builder types).
* list_builder: Use Educe to derive DefaultIan Jackson2022-05-043-1/+4
| | | | | | This allows us to use this with an item builder type which doesn't impl Default. (Obviously this only makes sense for items which aren't actually builders.)
* list_builder: Make helper capable of handling genericsIan Jackson2022-05-041-3/+15
| | | | | | | | It is Quite Vexing that we have to use [ ] rather than the < > around the generics, particularly given that we are also using [ ] to signal "this is arrayish". Signed-off-by: Ian Jackson <[email protected]>
* list_builder: Actually honour attributesIan Jackson2022-05-041-1/+4
| | | | | | The docs were a lie. $docs_and_attrs was missing from the expander. And add a note about how any supplied docs are handled.
* Fix typosNick Mathewson2022-05-041-2/+2
|
* Change builder list APIIan Jackson2022-05-042-114/+276
| | | | | | | | | | | | | | | | | | | | | | | | | | | The new API is (roughly) as discussed in https://gitlab.torproject.org/tpo/core/arti/-/issues/451 This is quite a large commit and it is not convenient to split it up. It contains the following changes: * Redo the list builder and accessor macros implemnetation, including docs and tests. * Change uses of define_list_config_builder. In each case: - Move the docs about the default value to the containing field. - Remove the other docs (which were just recapitulations, and are now not needed since the ListBuilder is no longer public). - Rewmove or replace `pub` in the define_list_builder_helper call, so that the builder is no longer public. - Change the main macro call site to use define_list_builder_helper. - Add a call to define_list_builder_accessors. * Make the module `list_builder` pub so that we have somewhere to put the overview documentation. * Consequential changes: - Change `outer.inner().replace(X)` to `outer.set_inner(X)` - Consequential changes to imports (`use` statements).
* Introduce ThingListBuilder::default_listIan Jackson2022-05-041-5/+8
| | | | | This removes a caveat from the API and will be convenient for what is coming.
* Add dependency on paste crateIan Jackson2022-05-042-0/+2
| | | | The list accessor macro is going to want this.
* Fix config versionIan Jackson2022-05-041-1/+1
| | | | This matches Cargo.lock. I suspect a mismerge in arti!478.
* CfgPath: Test serialisation round-trip with a binary formatIan Jackson2022-05-032-0/+9
| | | | | | Use MessagePack. Signed-off-by: Ian Jackson <[email protected]>
* CfgPath: Make it SerializeIan Jackson2022-05-031-5/+69
| | | | | | And provide round-trip tests. As per https://gitlab.torproject.org/tpo/core/arti/-/issues/371
* CfgPath: Overhaul APIIan Jackson2022-05-032-6/+89
| | | | | | | | | | | | | | | | | | | | | | 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.
* CfgPath: Change deserialisaation of Literal variantIan Jackson2022-05-031-5/+17
| | | | | | | | We introduce LiteralPath struct, so that a literal path deserialises from some_path = { literal: "actual path string" } This makes the deserialisation unambiguous.
* derive_builder: Use git dep everywhere, rather than cargo patchIan Jackson2022-04-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The `[patch]` approach causes the tree not to build when used as a dependency, unless the `[patch]` is replicated into the depending project. Instead, replace our `derive_builer =` dependencies with a reference to a specific git commit: perl -i~ -pe 'next unless m/^derive_builder/; s#"(0\.11\.2)"#{ version = "$1", git = "https://github.com/ijackson/rust-derive-builder", rev = "ba0c1a5311bd9f93ddf5f5b8ec2a5f6f03b22fbe" }#' crates/*/Cargo.toml Note that the commitid has changed. This is because derive_builder is in fact a workspace of 4 crates. 3 of them are of interest to arti itself (the 4th exists only for testing). So the same "add git revision" treatment had to be done to the `derive_builder` and `derive_builder_macro` crates. Each dependency edge involves a new commit in the derive_builder workspace, since we can't create a git commit containing its own commitid. (We want to use commits, rather than a branch, so that what we are depending on is actually properly defined, and not subject to the whims of my personal github namespace.) There are no actual code changes in derive_builder.
* Merge branch 'main' into 'msrv_1_56'Nick Mathewson2022-04-263-0/+197
|\ | | | | | | | | | | # Conflicts: # crates/tor-config/Cargo.toml # crates/tor-dirmgr/src/state.rs # doc/semver_status.md
| * list-builder: Provide tests of all methodsIan Jackson2022-04-251-0/+31
| | | | | | | | | | Because the macro output is private, if we miss one out of the tests, it doesn't fail due to dead code :-).
| * list_builder: Allow the struct to not be pubIan Jackson2022-04-251-6/+6
| | | | | | | | | | | | | | | | | | Really, we probably don't want any of these not to be pub, but it triggers "unreachable pub" in my test cases, and making it not pub by mistake seems not very serious, and likely to be noticed. Making the struct private in the test cases has the useful effect of checking that all the methods are tested.
| * list_builder: Use $crate namespaced importsIan Jackson2022-04-252-3/+4
| | | | | | | | | | | | | | I don't think we need to bother with things in the prelude, but doing it for serde and ConfigBuildError seems nice. Noticed while writing a test case.
| * Document defaults for all the config listsIan Jackson2022-04-251-0/+1
| | | | | | | | | | | | | | And add an imprecation in define_list_config_builder's doc comment do do so in future for other invocations of the macro. Add add the missing full stops.
| * define_list_config_builder: Provide example of item_buildIan Jackson2022-04-251-0/+30
| | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/471#note_2798027
| * define_list_config_builder: Expand generated docs for methods etc.Ian Jackson2022-04-251-4/+16
| | | | | | | | | | Requested in https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/471#note_2798022
| * Rename macro_first_nonempty (from macro_coalesce_args)Ian Jackson2022-04-252-2/+2
| | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/471#note_2798026
| * Rename ThingListBuilder::replace (from set)Ian Jackson2022-04-251-2/+2
| | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/471#note_2798024
| * Use better syntax for doc comment attributeIan Jackson2022-04-251-7/+3
| | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/471#note_2798020
| * config list-builder: Allow overriding the per-item build methodIan Jackson2022-04-253-2/+16
| | | | | | | | | | This will be useful especially for simple lists where the entry doesn't need a separate builder type.
| * Introduce define_list_config_builder macroIan Jackson2022-04-252-0/+112
| | | | | | | | | | | | This replaces two almost-identical sets of structs and impls. More are on the way, as per https://gitlab.torproject.org/tpo/core/arti/-/issues/447
* | Bump every crate's edition to 2021.Nick Mathewson2022-04-251-1/+1
| | | | | | | | | | | | | | | | | | | | This is an automated change made with a perl one-liner and verified with grep -L and grep -l. Some warnings are introduced with this change; they will be removed in subsequent commits. See arti#208 for older discussion on this issue.
* | Add 'rust-version = "1.56"' to every Cargo.toml file.Nick Mathewson2022-04-251-0/+1
| | | | | | | | | | | | | | This change was made automatically with a perl one-liner, and confirmed with `grep -L`. The `rust-version` field itself was introduced in 1.56.0.
* | Reformat all not-yet-reformatted Cargo.toml files.Nick Mathewson2022-04-251-1/+1
|/ | | | | There are no semantic changes here; only formatting. This is in preparation for other changes (wrt MSRV and edition)
* impl From<SubfieldBuildError> for ConfigBuildErrorIan Jackson2022-04-221-0/+7
| | | | We are going to be using sub-field builders.
* Use git source for derive_builder for now, for sub_builder featureIan Jackson2022-04-211-1/+1
| | | | | | | | | | | | | | | This commitid is the current head of my MR branch https://github.com/colin-kiegel/rust-derive-builder/pull/253 https://github.com/ijackson/rust-derive-builder/tree/field-builder Using the commitid prevents surprises if that branch is updated. We will require this newer version of derive_builder. The version will need to be bumped again later, assuming the upstream MR is merged and upstream do a release containing the needed changes. We will need the new version of not only `derive_builder_core` (the main macro implementation) but also`derive_builder` for a new error type.
* Bump all arti*, tor* crates to 0.2.0Nick Mathewson2022-04-011-2/+2
| | | | | | | | Not all of these strictly need to be bumped to 0.2.0; many could go to 0.1.1 instead. But since everything at the tor-rtcompat and higher layers has had breaking API changes, it seems not so useful to distinguish. (It seems unlikely that anybody at this stage is depending on e.g. tor-protover but not arti-client.)
* derive_builder: Switch to upstream 0.11Ian Jackson2022-03-161-1/+1
| | | | | | | | | This has the different syntax for builder field attributes than what I originally proposed in my MR, and which therefore is in the pinned branch. My upstream MR for the field attributes feature was morged: https://github.com/colin-kiegel/rust-derive-builder/issues/239
* Merge branch 'config-no-retcon' into 'main'Ian Jackson2022-03-101-1/+1
|\ | | | | | | | | Drop config back-conversion from FooConfig to FooConfigBuilder See merge request tpo/core/arti!391