Skip to content

Want various convenience methods on netdoc argument encoder etc.

I think we want at least

impl ItemEncoder {
    pub fn args(self, impl Iterator<Item=&dyn ItemArgument>) -> Self;
    pub fn arg_base64(self, t: impl Writeable) -> Result<Self, tor_bytes::Error>;
}

// and maybe
impl Extend<impl ItemArgument> for ItemEncoder {..}

I also think we want something like

/// Helper that encodes a list of `T` as a count (of type `N`) followed by the encodings of the items, concatenated
pub struct tor_bytes::CountedList<N, T>(T, PhantomData<N>);
impl Writeable for CountedList<N, T> where T: ExactSizeIterator<impl Writeable> {..}

Prompted by reading !1070 (merged)