pub struct Packet {
pub version: u8,
pub kind: PacketKind,
}Fields§
§version: u8§kind: PacketKindImplementations§
Source§impl Packet
impl Packet
Sourcepub fn eval(&self) -> Result<usize, PacketError>
pub fn eval(&self) -> Result<usize, PacketError>
Evaluates operator packets recursively
§Errors
Will return Err if any operators have an invalid number of arguments.
pub fn to_literal(&self) -> Result<Self, PacketError>
Sourcepub fn to_hex(&self) -> Result<String, PacketError>
pub fn to_hex(&self) -> Result<String, PacketError>
Sourcepub fn write_bits(
&self,
writer: &mut BitWriter<&mut Vec<u8>, BigEndian>,
) -> Result<(), PacketError>
pub fn write_bits( &self, writer: &mut BitWriter<&mut Vec<u8>, BigEndian>, ) -> Result<(), PacketError>
Sourcepub fn packet_count(&self) -> usize
pub fn packet_count(&self) -> usize
Returns number of sub-packets contained within this packet, and its packets, recursively
Sourcepub fn flat_packets(&self) -> Vec<&Self>
pub fn flat_packets(&self) -> Vec<&Self>
Returns a flattened vec containing Self and its sub-packets
Sourcepub fn to_expression(&self) -> Result<String, PacketError>
pub fn to_expression(&self) -> Result<String, PacketError>
Renders to mathematical expression representation
§Errors
Will return Err if packet does not evaluate properly
Trait Implementations§
impl Eq for Packet
impl StructuralPartialEq for Packet
Auto 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more