pub enum Error {
Success,
BufferTooShort {
required: usize,
had: usize,
},
InvalidFieldNumber {
field_number: u32,
what: String,
},
UnhandledWireType {
wire_type: u32,
},
TagTooLarge {
tag: u64,
},
VarintOverflow {
bytes: usize,
},
UnsignedOverflow {
value: u64,
},
SignedOverflow {
value: i64,
},
WrongLength {
required: usize,
had: usize,
},
StringEncoding,
UnknownDiscriminant {
discriminant: u32,
},
NotAChar {
value: u32,
},
}
Expand description
Error captures the possible error conditions for packing and unpacking.
Variants§
Success
The default error is succes.
BufferTooShort
BufferTooShort indicates that there was a need to pack or unpack more bytes than were available in the underlying memory.
Fields
InvalidFieldNumber
InvalidFieldNumber indicates that the field is not a user-assignable field.
Fields
UnhandledWireType
UnhandledWireType indicates that the wire_type is not understood by this process and cannot be skipped.
TagTooLarge
TagTooLarge indicates the tag would overflow a 32-bit number.
VarintOverflow
VarintOverflow indicates that a varint field did not terminate with a number < 128.
UnsignedOverflow
UnsignedOverflow indicates that a value will not fit its intended (unsigned) target.
SignedOverflow
SignedOverflow indicates that a value will not fit its intended (signed) target.
WrongLength
WrongLength indicates that a bytes32 did not have 32 bytes.
Fields
StringEncoding
StringEncoding indicates that a value is not UTF-8 friendly.
UnknownDiscriminant
UnknownDiscriminant indicates a variant that is not understood by this code.
NotAChar
NotAChar indicates that the prescribed value was tried to unpack as a char, but it’s not a char.
Trait Implementations§
source§impl<'a> FieldPackHelper<'a, message<Error>> for Error
impl<'a> FieldPackHelper<'a, message<Error>> for Error
source§fn field_pack_sz(&self, tag: &Tag) -> usize
fn field_pack_sz(&self, tag: &Tag) -> usize
source§fn field_pack(&self, tag: &Tag, out: &mut [u8])
fn field_pack(&self, tag: &Tag, out: &mut [u8])
source§impl<'a> FieldUnpackHelper<'a, message<Error>> for Error
impl<'a> FieldUnpackHelper<'a, message<Error>> for Error
source§fn merge_field(&mut self, proto: message<Error>)
fn merge_field(&mut self, proto: message<Error>)
source§impl Packable for Error
impl Packable for Error
source§fn pack_sz(&self) -> usize
fn pack_sz(&self) -> usize
pack_sz
returns the number of bytes required to serialize the Packable object.source§fn pack(&self, buf: &mut [u8])
fn pack(&self, buf: &mut [u8])
pack
fills in the buffer out
with the packed binary representation of the Packable
object. The implementor is responsible to ensure that out
is exactly pack_sz()
bytes
and implementations are encouraged to assert this. Read moresource§fn stream<W>(&self, writer: &mut W) -> Result<usize, Error>
fn stream<W>(&self, writer: &mut W) -> Result<usize, Error>
stream
writes the object to the provided writer using the same representation that would
be used in a call to pack
. The implementor is responsible for making sure that the
number of bytes written is exactly equal to the number of required bytes. Read moresource§impl<'a> Unpackable<'a> for Error
impl<'a> Unpackable<'a> for Error
impl Eq for Error
impl<'a> Message<'a> for Error
impl StructuralPartialEq for Error
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnwindSafe for Error
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)