diff options
author | Joey Sacchini <joey@sacchini.net> | 2021-01-09 14:43:21 -0500 |
---|---|---|
committer | Joey Sacchini <joey@sacchini.net> | 2021-01-09 14:43:21 -0500 |
commit | c321bdd5ffd0e893dd9166f4052b70c72a09d4e6 (patch) | |
tree | f06582ed4be7e116a1729486dafaaa5c5547affe | |
parent | cf46e1fde6bdb105b9706e3d19aaf7ae8eb0109b (diff) | |
download | craftio-rs-c321bdd5ffd0e893dd9166f4052b70c72a09d4e6.tar.gz craftio-rs-c321bdd5ffd0e893dd9166f4052b70c72a09d4e6.tar.bz2 craftio-rs-c321bdd5ffd0e893dd9166f4052b70c72a09d4e6.zip |
document CraftReader
-rw-r--r-- | src/reader.rs | 10 |
1 files changed, 10 insertions, 0 deletions
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>>, |