pub struct FutuFrame {
pub header: FutuHeader,
pub body: Bytes,
}Expand description
Stable API — FutuOpenD 协议帧(帧头 + body)。
44 字节 FutuHeader + 变长 [bytes::Bytes] body。SHA1 基于 body 明文
在 FutuFrame::new 中自动计算。加密在更上层(futu-net)完成。
Fields§
§header: FutuHeader§body: BytesImplementations§
Source§impl FutuFrame
impl FutuFrame
Sourcepub fn new(proto_id: u32, serial_no: u32, body: Bytes) -> Self
pub fn new(proto_id: u32, serial_no: u32, body: Bytes) -> Self
Stable API — 构造新协议帧,自动计算 body SHA1 + 填帧头。
Sourcepub fn with_sha1(
proto_id: u32,
serial_no: u32,
body: Bytes,
body_sha1: [u8; 20],
) -> Self
pub fn with_sha1( proto_id: u32, serial_no: u32, body: Bytes, body_sha1: [u8; 20], ) -> Self
Stable API — 构造新协议帧,使用调用方已计算好的 body SHA1。
Futu 协议的 body_sha1 基于明文 body;加密发送路径会先计算明文
SHA1,再把 body 替换成密文。该构造器避免先对密文重复计算一次无用
SHA1 再覆盖帧头。
Sourcepub fn verify_sha1(&self) -> bool
pub fn verify_sha1(&self) -> bool
Stable API — 校验 body 的 SHA1 是否与帧头中的一致。
解密后立即调用,失败返 false → 上层报 FutuError::Sha1Mismatch。
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for FutuFrame
impl RefUnwindSafe for FutuFrame
impl Send for FutuFrame
impl Sync for FutuFrame
impl Unpin for FutuFrame
impl UnsafeUnpin for FutuFrame
impl UnwindSafe for FutuFrame
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more