summaryrefslogtreecommitdiff
path: root/crates/tor-netdoc/src/encode.rs
Commit message (Collapse)AuthorAgeFilesLines
* tor-netdoc: Add two TODOs re trait namingIan Jackson2025-12-101-0/+2
|
* tor-netdoc: derive netdoc encoding traitsIan Jackson2025-12-101-0/+3
| | | | | Signature encoding is not yet supported. We need to consider how this will work.
* tor-netdoc: encoding: Provide multiplicity moduleIan Jackson2025-12-101-0/+6
| | | | | | | | 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-101-2/+18
| | | | | Adding these all at the beginning helped me with churn in this branch. The allow(unused) will go away again shortly.
* 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-041-3/+1
| | | | | | | | 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: 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: Rename ItemArgument method to write_arg_ontoIan Jackson2025-11-261-9/+9
| | | | | | | tor_bytes also has a write_onto method. And types (especially utility types like `Ignored`) might conceivably implement both! No need for semver update since this was pub(crate) in the previous release.
* tor-netdoc: encode: Explain why NetdocEncoder contains a ResultIan Jackson2025-11-191-1/+2
|
* tor-netdoc: impl Default for NetdocEncoderIan Jackson2025-11-181-0/+7
| | | | | clippy points out that if argument-less `new` can exist, so should Default.
* tor-netdoc: Make much more of the encode module contents publicIan Jackson2025-11-181-13/+12
| | | | | My planned new derive for encoding will be pub, but cfg gated, like parse2 is.
* tor-netdoc: Add a note about the nature of NetdocBuilderIan Jackson2025-11-181-1/+13
|
* tor-netdoc: Split off Keyword::to_str into its own traitIan Jackson2025-11-181-2/+2
| | | | | My planned encoding derive macro is not going to use `decl_keyword!` but will need to call `NetdocEncoder::item`.
* tor-netdoc: Rename the `build` module to `encode`Ian Jackson2025-11-101-0/+435
The word "build" so often in Rust means builder pattern. This module contains functions for encoding.