aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-netdoc
Commit message (Collapse)AuthorAgeFilesLines
...
* tor-netdoc: debug: Add a placeholder debug print to all the other derivesIan Jackson2025-12-102-0/+36
| | | | | | | | We want to recognise `#[deftly(netdoc(debug))]` because otherwise we have to make lots of these attributes conditional. So, implement it for *all* the derives, providing a nugatory debug statement.
* tor-netdoc: parse2: debug: Explain why we use io::stderr()Ian Jackson2025-12-101-0/+2
|
* tor-netdoc: parse2: debug: Fix an error messageIan Jackson2025-12-101-1/+1
| | | | What is being written to here is StderrLock, not a String.
* tor-netdoc: parse2: debug: Fix scoping of netdoc_parseable_derive_debugIan Jackson2025-12-102-1/+2
| | | | | | While testing I discovered that the `#[deftly(netdoc(debug))]` feature (which dumps parsing progress to stderr) didn't compile if the derive was invoked from elsewhere.
* tor-netdoc: derive: F_KEYWORD_REPORT: put concat on the outsideIan Jackson2025-12-101-2/+2
| | | | This makes it possible to use $F_KEYWORD_REPORT within another concat.
* tor-netdoc: derive_common: Break out docs for attrs in flattenIan Jackson2025-12-102-8/+13
| | | | | | Code motion fromk NetdocParseableFields to NetdocFieldsDeriveCommon. This uses the derive-deftly imported doc comment feature.
* tor-netdoc: derive_common: Break out field ordering checkIan Jackson2025-12-102-16/+18
| | | | Code motion from NetdocParseable to NetdocEntireDeriveCommon.
* tor-netdoc: derive_common: Break out item field type definitionsIan Jackson2025-12-102-6/+6
| | | | Code motion from ItemValueParseable to NetdocItemDeriveCommon.
* tor-netdoc: derive_common: Break out main field type definitionsIan Jackson2025-12-102-12/+11
| | | | | | | | Code motion from NetdocParseable to NetdocEntireDeriveCommon. Code motion from NetdocParseableFields to NetdocFieldsDeriveCommon. Again, the encoder wants exactly this logic.
* tor-netdoc: derive_common: Break out F_KEYWORD_*, F_FLATTEN, F_NORMALIan Jackson2025-12-102-34/+33
| | | | | | | Code motion from NetdocSomeItemsParseableCommon to NetdocSomeItemsDeriveCommon. Encoding wants exactly the same logic.
* tor-netdoc: Introduce new derive_common Rust module with d-d modulesIan Jackson2025-12-102-0/+68
| | | | | | | There is nothing actually in any of these yet. But it is most convenient to lay out the structure now. We'll move code into these modules in forthcoming commits.
* tor-netdoc: parse2: Rename NetdocParseableCommon d-d moduleIan Jackson2025-12-101-3/+3
| | | | | | | | This is only used for structs which contain items, not item value structs. We need a name that reflects this, especially as we are going to add a bunch more modules full of common macro elements.
* tor-netdoc: Break out netdoc_ordering_check into new derive_common.rsIan Jackson2025-12-103-34/+38
|
* tor-netdoc: Drop the allow(unused)Ian Jackson2025-12-101-1/+0
| | | | Now we use all the imports. We're still adding much code, though.
* tor-netdoc: recast Ignored and impl new encoding traitsIan Jackson2025-12-102-5/+52
| | | | | | | | | | | | This is a bit subtle. Ignored is used where we want to see and accept a value (for example, an Item or an Object), but we don't want to emit it. Update the docs and implement the various traits. We need an uninhabited helper type which implements ItemValueEncodable and ItemObjectEncodable but *not* ItemArgument. That prevents the use of Ignored for an argument, which would be wrong because what would we emit to keep the argument parser in step?
* tor-netdoc: encoding: impl new traits for NotPresentIan Jackson2025-12-101-0/+30
| | | | | | | Per the type-level docs for NotPresent: it's is a placeholder type mostly used when the document variety doesn't have this field. When encoding it, we emit nothing.
* tor-netdoc: encoding: Provide multiplicity moduleIan Jackson2025-12-103-1/+214
| | | | | | | | This is quite like the one for parse2, but separate for Reasons. Also add a bit of explanation to parse2's multiplicity.rs, about why there are all these different FooSetMethods traits, which the encoder doesn't need.
* tor-netdoc: encoding: Add new traits that we will deriveIan Jackson2025-12-101-0/+99
| | | | And implement them for Void and tuples, as applicable.
* tor-netdoc: Add imports to encode module, for new encode deriveIan Jackson2025-12-102-2/+20
| | | | | Adding these all at the beginning helped me with churn in this branch. The allow(unused) will go away again shortly.
* tor-netdoc: NetdocParseable: Document that BTreeSet is allowedIan Jackson2025-12-102-0/+5
| | | | | | | When we implemented this we documented it for ItemValueParseable but forgot to do so for NetdocParseable. Add some xrefs to the traits to try to stop similar mistakes.
* Remove unnecessary `doc(cfg(...))` attributesNeel Chauhan2025-12-041-2/+0
| | | | | | | | | Fixes part of #2193. (Edits from nickm: I selected the cases here that I could verify were correct from immediate context.) Edited-by: Nick Mathewson <[email protected]>
* tor-netdoc: Implement new authority certificatesClara Engler2025-12-0412-1/+1010
| | | | | | | | | This commit implements directory authority certificates using the `parse2` approaches. For now, those are in a module `doc::authcert::tmp`, with the eventual goal of moving it into its super module after removing/deprecating the legacy types.
* tor-netdoc: Implement (Partial)Eq for VerifyFailedClara Engler2025-12-041-1/+1
|
* Merge branch 'protover_refactor' into 'main'Nick Mathewson2025-12-0412-197/+51
|\ | | | | | | | | Make Protocols type inherently interned; add notes about usage. See merge request tpo/core/arti!3524
| * netdoc: Remove protocol interning.Nick Mathewson2025-12-038-70/+48
| | | | | | | | (It's now done in tor_protover.)
| * Move intern from tor-netdir to tor-basic-utils and make it pubNick Mathewson2025-12-036-130/+4
| |
| * tor_netdoc::intern: Note a future possible cleanup.Nick Mathewson2025-12-031-0/+2
| |
* | Merge branch 'n_authorities_usize' into 'main'Ian Jackson2025-12-042-5/+5
|\ \ | | | | | | | | | | | | tor-netdoc: Store n_authorities in usize See merge request tpo/core/arti!3522
| * | tor-netdoc: Remove unnecessary castsClara Engler2025-12-042-2/+2
| | |
| * | tor-netdoc: Store n_authorities in usizeClara Engler2025-12-022-3/+3
| | | | | | | | | | | | | | | | | | | | | Previously, this value was stored in a u16. However, because this number is usually always derived from some sort of list type, such as `Vec`, it makes more sense to use usize for this, as it avoid unnecessary casting and error checking.
* | | tor-netdoc: Provide ItemEncoder::finishIan Jackson2025-12-041-0/+5
| | | | | | | | | | | | | | | This provides a way to explicitly consume the encoder and finish the item, without use of mem::drop.
* | | tor-netdoc: Improve and expose args_raw_stringIan Jackson2025-12-042-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | The new derive is going to want this. So it would need to be at least `#[doc(hidden)]`. But it makes sense to expose it. But, it had a weird signature. Make its signature like that of `.arg_empty()`. (Note that an ItemEncoder contains just a `&mut NetdocEncoder`.)
* | | tor-netdoc: test2: Don't ever have raw String in defaulted argumentsIan Jackson2025-12-041-9/+9
| | | | | | | | | | | | | | | | | | | | | These cannot be encoded. So that is logically incoherent. (Perhaps String ought not to be NormalItemArgument, but let's not tackle that now.)
* | | tor-netdoc: Better error from empty argument (fmt)Ian Jackson2025-12-041-1/+4
| | |
* | | tor-netdoc: Better error from empty argumentIan Jackson2025-12-041-1/+1
| | | | | | | | | | | | | | | talking about the "keyword argument syntax" makes it sound a bit like its' the *keyword* that is wrong.
* | | tor-netdoc: Throw rather than squirreling error from NormalItemArgumentIan Jackson2025-12-041-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | NormalItemArgument is for types where we use the Display as the netdoc argument formatter. But what if gives the empty string? Previously we would allow `add_arg` to handle the error. That would record it in the NetdocEncoder. That's kind of OK, but it will prevent the caller from aborting early (and from elaborating the error).
* | | tor-netdoc: Explain some downsides to use of ItemEncoder::argIan Jackson2025-12-041-0/+3
| | |
* | | tor-netdoc: Suppress a clippy warning more thoroughlyIan Jackson2025-12-041-1/+2
| | |
* | | tor-netdoc: Suppress a clippy warningIan Jackson2025-12-031-0/+1
| | | | | | | | | | | | | | | | | | | | | This code sometimes expands to `let item = item;`. That's OK. In derive-deftly 1.5.x the two `item` wrongly had different hygiene span so the warning didn't trigger.
* | | Update to derive-deftly 1.6.0Ian Jackson2025-12-031-1/+1
| |/ |/| | | | | | | | | | | | | | | This has: * Fixes to hygiene spans from the new modules feature, needed for my WIP netdoc encoder derive. * A substantially richer `${error }` construct.
* | parse2: ItemValueParseable, netdoc(object, rest): docs: state signatureIan Jackson2025-12-021-1/+3
| | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3502/diffs?commit_id=f9a6d90ec6d5abf2958534d2c100c84f325e3634#2525aaf11b44162850101813478c4734160e11fa_920_919
* | parse2: ItemValueParseable, netdoc(object, rest): docs: clarify errorsIan Jackson2025-12-021-1/+1
| | | | | | | | | | | | The error is not really discarded (which would seem to mean ignoring it). The erorr *value* is discarded and is replaced with a less informative error value.
* | parse2: ItemValueParseable, netdoc(object, rest): docs: fix typoIan Jackson2025-12-021-1/+1
| |
* | parse2: ItemValueParseable, netdoc(rest, with): reworkIan Jackson2025-12-023-7/+11
| | | | | | | | | | | | | | | | | | | | The path in `with` must always be a module, not a function, because we need to use it for encoding too. In the case of `rest`, it's probably sensible to require a different function name, given that the semantics are subtly different to those of `rest` without `with`, since the latter can only get a single word but with `rest` you get the whole line.
* | parse2: ItemValueParseable, netdoc(rest): docs: clarify behaviourIan Jackson2025-12-021-1/+1
| |
* | Remove semver.md files post-releaseGabriela Moldovan2025-12-021-9/+0
|/
* Bump all the unstable tor- and arti- crates to 0.37.0.Gabriela Moldovan2025-12-021-13/+13
| | | | | | | | | Done using: ``` for crate in $(./maint/list_crates | rg '^(tor|arti-)'); do cargo set-version -p $crate 0.37.0 done
* netdoc: Add missing docs for encode_pow_params()Gabriela Moldovan2025-12-011-0/+1
|
* netdoc: allow unstable_name_collisions lint for exactly_one()Gabriela Moldovan2025-12-011-0/+5
| | | | This silences a new warning on nightly.
* parse2: Move naming convention to pocClara Engler2025-11-272-15/+15
| | | | | | | | | | | This commit moves the "Naming Convention" of the parse2::poc module into the respective module, as it does not apply to parse2 itself, as outlined in arti!3462. With this commit, there remains `NdaSystemTimeDeprecatedSyntax` as the only type outside poc following this naming schema. However, because it is more or less already deprecated anyways, there is no real need to bother with it any further.