about summary refs log tree commit diff
path: root/users/Profpatsch
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2021-08-01T17·00+0200
committerProfpatsch <mail@profpatsch.de>2021-11-13T00·57+0000
commit1c8e55b60c774eccb01a5b42a223af5e2acd2bb8 (patch)
tree21fb42ddd2592312c153193245ddd6f940071f85 /users/Profpatsch
parentd41caf2dd60a20668cf6ec5de03df412622f1627 (diff)
docs(users/Profpatsch/netencode): some docstrings r/3041
Change-Id: I447113d408cf51f1ed9f9d7571b2229e166e7680
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3281
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
Diffstat (limited to 'users/Profpatsch')
-rw-r--r--users/Profpatsch/netencode/netencode.rs10
1 files changed, 10 insertions, 0 deletions
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<Self::A, DecodeError>;
     }
 
+    /// 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<T>(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<T, A>{
         pub inner: T,
@@ -816,6 +825,7 @@ pub mod dec {
         }
     }
 
+    /// Try decoding as `T`.
     #[derive(Clone)]
     pub struct Try<T>(pub T);