mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-09-08 20:20:40 +00:00
feat[rust]: compatible protocol
This commit is contained in:
@@ -51,6 +51,10 @@ impl IByteBuffer for ByteBuffer {
|
||||
}
|
||||
}
|
||||
|
||||
fn compatibleRead(&mut self, beforeReadIndex: i32, length: i32) -> bool{
|
||||
return length != -1 && self.getReadOffset() < length + beforeReadIndex;
|
||||
}
|
||||
|
||||
fn getBuffer(&self) -> &Vec<i8> {
|
||||
return &self.buffer;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ pub trait IPacket {
|
||||
#[allow(unused_parens)]
|
||||
pub trait IByteBuffer {
|
||||
fn adjustPadding(&mut self, predictionLength: i32, beforeWriteIndex: i32);
|
||||
fn compatibleRead(&mut self, beforeReadIndex: i32, length: i32) -> bool;
|
||||
fn getBuffer(&self) -> &Vec<i8>;
|
||||
fn getWriteOffset(&self) -> i32;
|
||||
fn setWriteOffset(&mut self, writeIndex: i32);
|
||||
|
||||
Reference in New Issue
Block a user