From 1c8e55b60c774eccb01a5b42a223af5e2acd2bb8 Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Sun, 1 Aug 2021 19:00:34 +0200 Subject: docs(users/Profpatsch/netencode): some docstrings Change-Id: I447113d408cf51f1ed9f9d7571b2229e166e7680 Reviewed-on: https://cl.tvl.fyi/c/depot/+/3281 Tested-by: BuildkiteCI Reviewed-by: Profpatsch --- users/Profpatsch/netencode/netencode.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'users/Profpatsch/netencode') diff --git a/users/Profpatsch/netencode/netencode.rs b/users/Profpatsch/netencode/netencode.rs index fcf642ca0262..5bd43f992f0b 100644 --- a/users/Profpatsch/netencode/netencode.rs +++ b/users/Profpatsch/netencode/netencode.rs @@ -690,8 +690,10 @@ pub mod dec { fn dec(&self, u: U<'a>) -> Result; } + /// Any netencode, as `T`. #[derive(Clone, Copy)] pub struct AnyT; + /// Any netencode, as `U`. #[derive(Clone, Copy)] pub struct AnyU; @@ -709,8 +711,11 @@ pub mod dec { } } + /// A text #[derive(Clone, Copy)] pub struct Text; + + /// A bytestring // TODO: rename to Bytes #[derive(Clone, Copy)] pub struct Binary; @@ -735,6 +740,7 @@ pub mod dec { } } + /// Any scalar, converted to bytes. #[derive(Clone, Copy)] pub struct ScalarAsBytes; @@ -755,6 +761,7 @@ pub mod dec { } } + /// A map of Ts (TODO: rename to map) #[derive(Clone, Copy)] pub struct Record(pub T); @@ -773,6 +780,7 @@ pub mod dec { } } + /// Assume a record and project out the field with the given name and type. #[derive(Clone, Copy)] pub struct RecordDot<'a, T> { pub field: &'a str, @@ -794,6 +802,7 @@ pub mod dec { } } + /// Equals one of the listed `A`s exactly, after decoding. #[derive(Clone)] pub struct OneOf{ pub inner: T, @@ -816,6 +825,7 @@ pub mod dec { } } + /// Try decoding as `T`. #[derive(Clone)] pub struct Try(pub T); -- cgit 1.4.1