aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-netdoc/src/parse2/derive.rs
Commit message (Collapse)AuthorAgeFilesLines
* Use new TimeRangeBound name throughout the treeIan Jackson2026-07-161-3/+3
|
* Use new TimeBound name throughout the treeIan Jackson2026-07-161-1/+1
|
* tor-netdoc: parse2 derive: allow setting deprecated fieldsIan Jackson2026-06-161-0/+4
| | | | | | | | | This makes it possible to derive from a struct with deprecated fields, without triggering the warning. This doesn't yet treat encoding as yet, because the only deprecated field I encountered was `skip` which means the derived encoder never mentions it.
* tor-netcoc: NetdocParseableUnverified derive: forbid NetdocParseableIan Jackson2026-06-101-0/+11
|
* tor-netdoc: parse2: Add more docs about verificationIan Jackson2026-06-101-3/+26
| | | | | Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/4070#note_3422636
* tor-netdoc: parse2: use TimeRangebound in exampleIan Jackson2026-06-101-3/+6
|
* tor-netdoc: fix a doc formatting typoIan Jackson2026-06-031-1/+1
|
* tor-netdoc: Add crate:: to docs xrefs to avoid broken linksIan Jackson2026-06-021-2/+2
| | | | | | | | | | | | | | | | Apparently, it is only correct to write [`NetdocParseableUnverified`](derive_deftly_template_NetdocParseableUnverified), *after* the definition of that template. Before then, the macro isn't in scope. Worse, rustdoc just treats it as a filename and doesn't spot the link, so you don't get any kind of warning. I think this is an upstream bug, https://github.com/rust-lang/rust/issues/157304 I found rustdoc's behaviour capricious. I don't intend to go through the arti tree right now looking for similar patterns. Instead let's hope the upstream bug gets fixed, and in the meantime do this crate:: thing when we notice we need it.
* tor-netdoc: Rename NetdocUnverified trait to NetdocParseableUnverifiedIan Jackson2026-06-021-3/+3
| | | | | | | | | | | | The NetdocParseableUnverified derive macro implements this trait (amongst other things). Traits and derive macros should have aligned names. This is only used for parsing, so let's keep the "Parseable" part of the name. I don't think the effort of deprecated alias, for downstream compatibility, is worth it, our compatibility policy notwithstanding.
* tor-netdoc: Fix two references to NetdocUnverified d-d templateIan Jackson2026-06-021-2/+2
| | | | | | | The trait is called NetdocUnverified, but the template is NetdocParseableUnverified. This fixes a dead docs link (which somehow isn't spotted by rustdoc, but is instead taken to refer to a nonexistent file).
* tor-netdoc: NetdocParseableFields: Pass ItemStream to finishIan Jackson2026-05-271-2/+12
|
* tor-netdoc: Parsing with `#[netdoc(flatten)]`: cope with non-path typesIan Jackson2026-05-131-1/+1
| | | | ns_type! is a non-path type.
* tor-netdoc: parse2: Improve another error span for missing trait implIan Jackson2026-04-291-1/+1
|
* tor-netdoc: ItemValueParseable: Tolerate non-snake-case fieldsIan Jackson2026-04-271-0/+1
| | | | We'll want this with Constructor's __non_exhaustive.
* Merge branch 'parse2-more-debug' into 'main'Clara Engler2026-04-211-16/+43
|\ | | | | | | | | Add debugging support to ItemValueParseable derive See merge request tpo/core/arti!3881
| * tor-netdoc: Add debugging to ItemValueParseable, demo in testIan Jackson2026-04-131-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With cargo test --all-features -p tor-netdoc -- --no-capture test2 the output now contains, amongst many other things: netdoc TestItem parse: item start, "test-item", "N", Some("TEST OBJECT") netdoc TestItem parse: field needed, normal, args=1, "N" netdoc TestItem parse: field optional, normal, args=Option<_>, "" netdoc TestItem parse: field rest, normal, args=Vec<_>, "" netdoc TestItem parse: field object, object, object=1, Some(("TEST OBJECT", Ok(5))) netdoc TestItem parse: item complete Ok
| * tor-netdoc: Add debugging to ItemValueParseableIan Jackson2026-04-131-1/+16
| |
| * tor-netdoc: parse2 derives: use NetdocParseAnyCommon in ItemValueParseableIan Jackson2026-04-131-2/+1
| | | | | | | | So far this just abolishes a duplicate P.
| * tor-netdoc: parse2 derives: Break out NetdocParseAnyCommonIan Jackson2026-04-131-13/+21
| | | | | | | | | | | | | | We're going to want tio reuse dtrace from here in the ItemValueParseable derive (which doesn't use NetdocSomeItemsParseableCommon because it derives for one item type, not a document containing multiple items).
| * tor-netdoc: parse2: with debug for items parsing, show multiplicityIan Jackson2026-04-131-0/+1
| |
* | tor-netdoc: Support `#[deftly(netdoc(skip))]` in itemsIan Jackson2026-04-201-0/+7
| | | | | | | | Ie for "arguments" that don't actually appear.
* | tor-netdoc: derives: Expect an intro itemIan Jackson2026-04-141-0/+1
| | | | | | | | | | | | This can't trigger, but when messing about with some new features, I messed up and got a syntax error here. Let's try this feature out, here.
* | tor-netdoc: derives: Reformat a long lineIan Jackson2026-04-141-2/+4
|/ | | | No functional change.
* Merge branch 'netdoc-fixes' into 'main'Clara Engler2026-04-081-1/+6
|\ | | | | | | | | tor-netdoc: Three fixes to parsing and encoding See merge request tpo/core/arti!3862
| * tor-netdoc: Fix handling of netdoc(skip) in NetdocParseableFieldsIan Jackson2026-04-071-1/+6
| |
* | tor-netdoc: parse2/encode derive: Show unquoted attributes in the docsIan Jackson2026-04-071-7/+7
| |
* | tor-netdoc: parse2/encode derive: Use meta_quoted rigorousIan Jackson2026-04-071-6/+6
|/ | | | | | | | | | | The `doctype_for_error` attribute needs immediate adjustment, because a string expression value is expected. With `quoted retain`, that would be re-interpreted, silently. This kind of thing is why `quoted rigorous` exists. So change its docs and the one use site. The macros' docs, and the other calls ites, we'll deal with shortly.
* tor-netdoc: parse2 derive: Use $/// deftly feature in a few placesIan Jackson2026-04-011-4/+4
| | | | No change to the generated docs.
* Fix typosTobias Stoeckmann2026-03-241-2/+2
| | | | Typos found with codespell
* tor-netdoc: signature orderliness: add some xrefsIan Jackson2026-03-191-0/+3
|
* tor-netdoc: signature ordering: discuss an alternative impl approachIan Jackson2026-03-191-0/+3
| | | | Suggested-by: Clara Engler <[email protected]>
* tor-netdoc: NetdocParseableSignatures: discuss orderingIan Jackson2026-03-191-0/+44
|
* tor-netdoc: parse2: Add some navigational commentsIan Jackson2026-03-191-1/+64
| | | | I have been losing my way in this file a lot. This may help.
* tor-netdoc: parse2: Don't impl NetdocParseable for bodies of signed docsIan Jackson2026-03-191-9/+56
| | | | Such an impl is a footgun. Explain this in docs & comments.
* tor-netdoc: parse2: Unify top-level derive as NetdocUParseablenverifiedIan Jackson2026-03-191-31/+33
| | | | | | | | | | | | | | | | Replace the two separate NetdocParseable and NetdocUnverified derives, for toplevel signed documents, with a single derive. This makes the derive API simpler. It will also make it reasonably possible to avoid deriving NetdocParseable directly for body structs. Such impls are a security hazard! In detail: * Rename NetdocUnverified to NetdocParseableUnverified * Have it use $IMPL_NETDOC_PARSEABLE from the NetdocParseable deftly module so that it derives NetdocParseable for the body. (We'll change this later in the series.) * Adjust the docs and all call sites.
* tor-netdoc: parse2: Break out IMPL_NETDOC_PARSEABLE in a deftly moduleIan Jackson2026-03-191-161/+175
| | | | | We are going to want to reuse this parsing implementation in another top-level deftly template.
* tor-netdoc: parse2: Move hash out of signature itemsIan Jackson2026-03-191-29/+59
| | | | | | | | | | During encoding, including these hashes in the signature items makes no sense. The hashes are an *input* to the signature items, but not part of them. Move the hashes out of the items. Instead, provide each signatures section type with a hash accumulator type, in which the hash(es) are stored.
* tor-netdoc: parse2: Move hash out of signature items (prep)Ian Jackson2026-03-191-8/+11
| | | | | Nonfunctional and formatting changes which reduce noise in the next commit.
* tor-netdoc: parse2: Introduce SignatureData structIan Jackson2026-03-191-15/+20
| | | | This is going to contain body information, and the hashes, too.
* tor-netdoc: NetdocParseableSignatures: Make into its own traitIan Jackson2026-03-191-20/+3
|
* tor-netdoc: NetdocParseableSignatures: Make into its own macroIan Jackson2026-03-191-25/+120
| | | | | | This is going to be its own trait and it is usually best if macros are named after traits, rather than having the macro derive a different trait depending on meta attributes.
* tor-netdoc: parse2 derive: break out INIT_ACCUMULATE_VARSIan Jackson2026-03-191-17/+25
| | | | For reuse when we split up the NetdocParseable derive.
* tor-netdoc: parse2: Fix an error messageIan Jackson2026-03-191-1/+1
|
* tor-netdoc: parse2: Use eprint for dtraceIan Jackson2026-03-031-3/+7
|
* tor-netdoc: Rename *Signed to *UnverifiedIan Jackson2026-03-031-16/+16
| | | | | | | | | | This was a weird name, and while working in this area it all seemed to make the docs strange. Rename it. This is quite invasive! In theory we could have the macros generate compatibility aliases, but that seems quite complex.
* tor-netdoc: parse2: Provide NetdocParseable::is_structural_keywordIan Jackson2026-01-151-2/+27
| | | | Roughly as per the proposal in `doc/dev/notes/authcert-in-consensus.md`.
* tor-netdoc: derives: New `skip` document field optionIan Jackson2026-01-141-4/+16
| | | | | This lets us having document items that are "manually non exhaustive" which is necessary for struct literal constructors.
* tor-netdoc: Use $P for prelude in one placeIan Jackson2025-12-181-1/+1
| | | | This was missed, apparently.
* tor-netdoc: derive netdoc encoding traitsIan Jackson2025-12-101-0/+8
| | | | | Signature encoding is not yet supported. We need to consider how this will work.
* tor-netdoc: debug: Add a placeholder debug print to all the other derivesIan Jackson2025-12-101-0/+15
| | | | | | | | 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.