From c321bdd5ffd0e893dd9166f4052b70c72a09d4e6 Mon Sep 17 00:00:00 2001 From: Joey Sacchini <joey@sacchini.net> Date: Sat, 9 Jan 2021 14:43:21 -0500 Subject: document CraftReader --- src/reader.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/reader.rs b/src/reader.rs index 1439a17..4ded308 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -131,6 +131,16 @@ pub trait CraftSyncReader { fn read_raw_untyped_packet(&mut self) -> ReadResult<(Id, &[u8])>; } +/// +/// Wraps some stream of type `R`, and implements either `CraftSyncReader` or `CraftAsyncReader` (or both) +/// based on what types `R` implements. +/// +/// You can construct this type calling the function `wrap_with_state`, which requires you to specify +/// a packet direction (are written packets server-bound or client-bound?) and a state +/// (`handshaking`? `login`? `status`? `play`?). +/// +/// This type holds some internal buffers but only allocates them when they are required. +/// pub struct CraftReader<R> { inner: R, raw_buf: Option<Vec<u8>>, -- cgit