diff options
| author | Eskil Queseth <eskilq@kth.se> | 2021-05-22 01:31:00 +0200 |
|---|---|---|
| committer | Eskil Queseth <eskilq@kth.se> | 2021-05-22 01:31:00 +0200 |
| commit | 3cba90118b900706ea356eee601195b6bf4b50ee (patch) | |
| tree | 33a7e51fda0783f561512df1865288b88614c53c | |
| parent | aa710a3420ef4d834ee1df4099b25f3c83b9c31d (diff) | |
| download | mum-3cba90118b900706ea356eee601195b6bf4b50ee.tar.gz | |
add some documentation
| -rw-r--r-- | mumctl/src/main.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/mumctl/src/main.rs b/mumctl/src/main.rs index 318aa3c..4ef30e7 100644 --- a/mumctl/src/main.rs +++ b/mumctl/src/main.rs @@ -645,6 +645,7 @@ fn parse_state(server_state: &mumlib::state::Server) { } } +/// Tries to find a running mumd instance and tries to receive one response from it. fn send_command( command: MumCommand, ) -> Result<mumlib::error::Result<Option<CommandResponse>>, CliError> { @@ -666,6 +667,8 @@ fn send_command( bincode::deserialize_from(&mut connection).map_err(|_| CliError::ConnectionError) } +/// Tries to find a running mumd instance and sends a single command to it. Returns an iterator which +/// yields all responses that mumd sends for that particular command. fn send_command_multi( command: MumCommand, ) -> Result<impl Iterator<Item = mumlib::error::Result<Option<CommandResponse>>>, CliError> { @@ -687,12 +690,14 @@ fn send_command_multi( Ok(BincodeIter::new(connection)) } +/// A struct to represent an iterator that deserializes bincode-encoded data from a `Reader`. struct BincodeIter<R, I> { reader: R, phantom: PhantomData<*const I>, } impl<R, I> BincodeIter<R, I> { + /// Creates a new `BincodeIter` from a reader. fn new(reader: R) -> Self { Self { reader, |
