aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-netdoc/src/parse2/multiplicity.rs
Commit message (Collapse)AuthorAgeFilesLines
* tor-netdoc: Document that parse2 vs encode multiplicity match req'tIan Jackson2026-05-181-0/+15
|
* tor-netdoc: Introduce RetainedOrderVec parse/encode typeIan Jackson2026-04-231-0/+23
|
* tor-netdoc: parse2 multiplicity: Add debugging methods to traitsIan Jackson2026-04-131-0/+99
|
* Fix typosTobias Stoeckmann2026-03-241-1/+1
| | | | Typos found with codespell
* tor-netdoc: parse2: Move hash out of signature itemsIan Jackson2026-03-191-1/+2
| | | | | | | | | | 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: Provide NetdocParseable::is_structural_keywordIan Jackson2026-01-151-0/+8
| | | | Roughly as per the proposal in `doc/dev/notes/authcert-in-consensus.md`.
* tor-netdoc: encoding: Provide multiplicity moduleIan Jackson2025-12-101-1/+12
| | | | | | | | 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: NetdocParseable: Document that BTreeSet is allowedIan Jackson2025-12-101-0/+4
| | | | | | | 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.
* tor-netdoc: parse2: Combine all the multiplicity SelectorsIan Jackson2025-11-191-44/+29
| | | | | There is no conflict between the different uses. Having just one type makes things simpler.
* tor-netdoc: parse2: Move multiplicity docs examples into Methods traitsIan Jackson2025-11-191-32/+32
| | | | | | | We're going to combine all the Selector types, so it won't be able to have these. The diff is misleading: it's docs for the Selectors that's moving.
* tor-netdoc: parse2: Introduce ParseInput intermediate structIan Jackson2025-11-181-4/+6
| | | | | | | We're going to add options arguments, effectively, to the parsing entrypoints. To avoid a proliferation of entrypoints (eg, parse_multiple_with_options), encapsulate the run-time input values in this structure.
* tor-netdoc: impl parse2 multiplicity for BTreeSetIan Jackson2025-10-151-0/+33
|
* tor-netdoc: Abolish now-obsolete field argument to from_args (fmt)Ian Jackson2025-10-091-20/+4
|
* tor-netdoc: Abolish now-obsolete field argument to from_argsIan Jackson2025-10-091-12/+8
|
* tor-netdoc: Introduce ArgumentErrorIan Jackson2025-10-091-8/+8
| | | | | This will allow us to (1) move field name handling out of the argument parser method, and also (2) add columns more easily.
* tor-netdoc: parse2: Rename methods on ArgumentStreamIan Jackson2025-10-091-2/+2
|
* netdoc parse2 tests: Avoid <String as TryFrom<Vec<u8>>> (3)Ian Jackson2025-09-291-1/+1
|
* netdoc parse2: ArgumentSetMethods: take a parser functionIan Jackson2025-09-291-12/+59
| | | | We need this to support `with`.
* netdoc parse2: New single_item attributeIan Jackson2025-09-291-0/+6
| | | | | | Many of the existing netdoc structs have items that are just the single argument. We don't want to turn them all into singleton tuples. Provide a macro feature for this instead.
* netdoc parse2: Fix Object handlingIan Jackson2025-09-291-0/+75
| | | | | | | | | | Use the standard multiplicity technique rather than the ad-hoc impl on Option. This allows us to support an ad-hoc parsing function for a field that's `Option`. Disentangle the `label` field attribute, which did both setting the label, and expecting a different parsing approach: replace it with `with`.
* Produce better error messages from bad field types (fmt)Ian Jackson2025-09-021-3/+15
| | | | Worsify formatting as demanded by rustfmt.
* Produce better error messages from bad field typesIan Jackson2025-09-021-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this change, this diff > --- a/crates/tor-netdoc/src/parse2/poc/netstatus.rs > +++ b/crates/tor-netdoc/src/parse2/poc/netstatus.rs > @@ -24,5 +24,4 @@ pub enum NdaNetworkStatusVersion { > /// `params` value > #[derive(Clone, Debug, Default, Deftly)] > -#[derive_deftly(ItemValueParseable)] > #[non_exhaustive] > pub struct NdiParams { gives the errors below. So the first reported error points to the errant field, albeit with the slightly mendacious phrasing "this call". Previously there was only the 2nd message. Disagnosing that requires hunting through the document struct looking for fields of the right type, which can be seriously awkward when there are type aliases involved as there often are in tor-netdoc. > error[E0277]: the trait bound `parse2::poc::netstatus::NdiParams: parse2::traits::ItemValueParseable` is not satisfied > --> crates/tor-netdoc/src/parse2/poc/netstatus/flavoured.rs:27:10 > | > 27 | #[derive(Deftly, Clone, Debug)] > | ^^^^^^ the trait `parse2::traits::ItemValueParseable` is not implemented for `parse2::poc::netstatus::NdiParams` > ... > 55 | pub params: NdiParams, > | ------ required by a bound introduced by this call > | > = help: the following other types implement trait `parse2::traits::ItemValueParseable`: > () > (T0, T1) > (T0, T1, T2) > (T0, T1, T2, T3) > (T0, T1, T2, T3, T4) > (T0, T1, T2, T3, T4, T5) > (T0, T1, T2, T3, T4, T5, T6) > (T0, T1, T2, T3, T4, T5, T6, T7) > and 16 others > note: required by a bound in `parse2::multiplicity::ItemSetMethods::check_item_value_parseable` > --> crates/tor-netdoc/src/parse2/multiplicity.rs:109:59 > | > 109 | fn check_item_value_parseable(self) where Self::Each: ItemValueParseable {} > | ^^^^^^^^^^^^^^^^^^ required by this bound in `ItemSetMethods::check_item_value_parseable` > > error[E0277]: the trait bound `parse2::poc::netstatus::NdiParams: parse2::traits::ItemValueParseable` is not satisfied > --> crates/tor-netdoc/src/parse2/derive.rs:438:34 > | > 438 | let item = ItemValueParseable::from_unparsed(item)?; > | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `parse2::traits::ItemValueParseable` is not implemented for `parse2::poc::netstatus::NdiParams` > | > ::: crates/tor-netdoc/src/parse2/poc/netstatus/flavoured.rs:27:10 > | > 27 | #[derive(Deftly, Clone, Debug)] > | ------ in this derive macro expansion > | > = help: the following other types implement trait `parse2::traits::ItemValueParseable`: > () > (T0, T1) > (T0, T1, T2) > (T0, T1, T2, T3) > (T0, T1, T2, T3, T4) > (T0, T1, T2, T3, T4, T5) > (T0, T1, T2, T3, T4, T5, T6) > (T0, T1, T2, T3, T4, T5, T6, T7) > and 16 others > = note: this error originates in the macro `derive_deftly_template_NetdocParseable` which comes from the expansion of the derive macro `Deftly` (in Nightly builds, run with -Z macro-backtrace for more info)
* tor-netdoc: multiplicity: Introduce can_accumulateIan Jackson2025-09-021-2/+20
| | | | | | We're going to use this to check that we can accept a sub-document before we parse it. That will make the error come out in the right place.
* tor-netdoc: parse2: multiplicity: Remove now-obsolete trait itemsIan Jackson2025-08-261-12/+0
|
* tor-netdoc: parse2: Know that we always accumulate into Option<Field>Ian Jackson2025-08-261-1/+1
|
* tor-netdoc: parse2: Always accumulate into Option<Field> (fmt)Ian Jackson2025-08-261-1/+5
|
* tor-netdoc: parse2: Always accumulate into Option<Field>Ian Jackson2025-08-261-13/+22
|
* tor-netdoc: parse2: Report subdoc intro item keyword for missing itemIan Jackson2025-08-261-0/+10
| | | | This corrects the error message.
* tor-netdoc: Introduce parse2, new parserIan Jackson2025-08-141-0/+196
This isn't used anywhere yet. We're going to demonstrate it, and test the demo, in a moment.