Struct bililive_core::packet::Packet [−][src]
pub struct Packet { /* fields omitted */ }Expand description
Bililive packet.
Packet can be used to encode/parse raw bilibili live packets, and extract information from it.
Implementations
Set the sequence id. By default it’s 1.
Construct a new packet.
To construct a zlib-compressed packet, you should create a JSON/Int32BE packet first,
then call Packet::compress to convert it to a zlib one.
Get the packet length.
Get the header length.
Get bytes of the body.
Try to parse the body by json.
Errors
It may fail if the model is incorrect or it’s not a json packet.
You may check the type of the packet by Packet::proto.
Try to parse the body by big endian int32.
Errors
It may fail if it’s not a int packet.
You may check the type of the packet by Packet::proto.
Trait Implementations
impl<T, E> Sink<Packet> for HeartbeatStream<T, E> where
T: Sink<Packet, Error = StreamError<E>> + Unpin,
E: Error,
impl<T, E> Sink<Packet> for HeartbeatStream<T, E> where
T: Sink<Packet, Error = StreamError<E>> + Unpin,
E: Error,
type Error = StreamError<E>
type Error = StreamError<E>
The type of value produced by the sink when an error occurs.
Attempts to prepare the Sink to receive a value. Read more
Begin the process of sending a value to the sink.
Each call to this function must be preceded by a successful call to
poll_ready which returned Poll::Ready(Ok(())). Read more
Flush any remaining output from this sink. Read more
Auto Trait Implementations
impl RefUnwindSafe for Packet
impl UnwindSafe for Packet
Blanket Implementations
Mutably borrows from an owned value. Read more