pub struct Packet { /* fields omitted */ }
An arbitrary chunk of bytes with a user-defined ID.
The maximum size a packet can be.
Create a new empty Packet
.
Create a Packet
already filled with data.
Get the Packet
's identifier.
pub fn contents(&self) -> &[u8] | [src] |
Get the contents of the Packet
.
How long is the Packet
's contents?
How many more bytes can be added to this Packet
before it is full?
The number of bytes this Packet
will take up when encoded and written
to a buffer.
Encode a Packet
and copy it into the provided buffer.
The minimum required buffer size can be determined via the
total_length()
method. If the buffer isn't big enough, nothing will
be written to the buffer and this method will fail with an
InsufficientCapacity
error.
Try to append some data to the Packet
's contents, bailing without
writing anything if there isn't enough space.
Performs copy-assignment from source
. Read more
Formats the value using the given formatter. Read more
This method tests for self
and other
values to be equal, and is used by ==
. Read more
This method tests for !=
.
Returns the "default value" for a type. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more