Browse Source

Fix `MessageReader` documentation

feature_link
Anton Tarasenko 3 years ago
parent
commit
b846fcf55b
  1. 15
      src/link/mod.rs

15
src/link/mod.rs

@ -45,13 +45,16 @@ pub struct MessageReader {
received_bytes: u64, received_bytes: u64,
} }
/// For converting byte stream expected to be generated by Acedia mod from the game server into /// For converting byte stream that is expected from the ue-server into actual messages.
/// actual messages. Expected format is a sequence of either: /// Expected format is a sequence of either:
/// [HEAD_UE_RECEIVED: 1 byte] [amount of bytes received by game server since last update: 4 bytes] /// 1. [HEAD_UE_RECEIVED: marker byte | 1 byte]
/// [HEAD_UE_MESSAGE: 1 byte] [length of the message: 4 bytes] [utf8-encoded string: ??? bytes] /// [AMOUNT: amount of bytes received by ue-server since last update | 4 bytes: u32 BE]
/// On any invalid input enters a failure state (can be checked by `is_broken()`) and /// 2. [HEAD_UE_MESSAGE: marker byte | 1 byte]
/// [LENGTH: length of the JSON message in utf8 encoding | 4 bytes: u32 BE]
/// [PAYLOAD: utf8-encoded string | `LENGTH` bytes]
/// On any invalid input enters into a failure state (can be checked by `is_broken()`) and
/// never recovers from it. /// never recovers from it.
/// Use either `push_byte()` or `push()` to input byte stream from game server and `pop()` to /// Use either `push_byte()` or `push()` to input byte stream from ue-server and `pop()` to
/// retrieve resulting messages. /// retrieve resulting messages.
impl MessageReader { impl MessageReader {
pub fn new() -> MessageReader { pub fn new() -> MessageReader {

Loading…
Cancel
Save