pub struct Packet {
pub header: PacketHeader,
pub payload: BytesMut,
}Expand description
A TDS packet with header and payload.
Fields§
§header: PacketHeaderPacket header.
payload: BytesMutPacket payload (excluding header).
Implementations§
Source§impl Packet
impl Packet
Sourcepub fn new(header: PacketHeader, payload: BytesMut) -> Self
pub fn new(header: PacketHeader, payload: BytesMut) -> Self
Create a new packet with the given header and payload.
Sourcepub fn total_size(&self) -> usize
pub fn total_size(&self) -> usize
Get the total packet size including header.
Sourcepub fn is_end_of_message(&self) -> bool
pub fn is_end_of_message(&self) -> bool
Check if this is the last packet in a message.
Trait Implementations§
Source§impl<T> Sink<Packet> for PacketStream<T>where
T: AsyncWrite + Unpin,
impl<T> Sink<Packet> for PacketStream<T>where
T: AsyncWrite + Unpin,
Source§type Error = CodecError
type Error = CodecError
The type of value produced by the sink when an error occurs.
Source§fn poll_ready(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>>
fn poll_ready( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>
Attempts to prepare the
Sink to receive a value. Read moreSource§fn start_send(self: Pin<&mut Self>, item: Packet) -> Result<(), Self::Error>
fn start_send(self: Pin<&mut Self>, item: Packet) -> Result<(), Self::Error>
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 moreSource§impl<T> Sink<Packet> for PacketWriter<T>where
T: AsyncWrite + Unpin,
impl<T> Sink<Packet> for PacketWriter<T>where
T: AsyncWrite + Unpin,
Source§type Error = CodecError
type Error = CodecError
The type of value produced by the sink when an error occurs.
Source§fn poll_ready(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>>
fn poll_ready( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>
Attempts to prepare the
Sink to receive a value. Read moreSource§fn start_send(self: Pin<&mut Self>, item: Packet) -> Result<(), Self::Error>
fn start_send(self: Pin<&mut Self>, item: Packet) -> Result<(), Self::Error>
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 moreAuto Trait Implementations§
impl Freeze for Packet
impl RefUnwindSafe for Packet
impl Send for Packet
impl Sync for Packet
impl Unpin for Packet
impl UnwindSafe for Packet
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