pub enum MtpError {
Show 13 variants
Endpoint(EndpointError),
InvalidContainerType(u16),
UnexpectedContainerType {
expected: ContainerType,
actual: ContainerType,
},
InvalidLength,
PacketTooShort,
BufferTooSmall,
TooManyParameters,
InvalidString,
StringTooLong,
LengthMismatch,
Truncated,
Cancelled(u32),
Reset,
}Expand description
Errors produced by MTP transport, container framing, and dataset codecs.
Variants§
Endpoint(EndpointError)
Underlying USB endpoint error.
InvalidContainerType(u16)
Unknown ContainerType value on the wire.
UnexpectedContainerType
Container type did not match the expected phase.
Fields
expected: ContainerTypeExpected container type.
actual: ContainerTypeActual container type received.
InvalidLength
Container length field was invalid (e.g. smaller than 12 bytes).
PacketTooShort
USB packet was shorter than the 12-byte container header.
BufferTooSmall
Caller buffer was too small for the encoded or decoded data.
TooManyParameters
More than the allowed number of container parameters were present.
InvalidString
String payload contained invalid UTF-16 or exceeded the output buffer.
StringTooLong
String exceeded the 254 UTF-16 code unit limit of PTP/MTP strings.
LengthMismatch
Payload length did not match the declared ContainerLength.
Truncated
Data-OUT transfer ended early with a short packet before ContainerLength bytes arrived.
Cancelled(u32)
Transaction was cancelled by the host via REQ_CANCEL.
Reset
Transport was reset by the host via REQ_RESET.
Trait Implementations§
impl Copy for MtpError
impl Eq for MtpError
Source§impl Error for MtpError
impl Error for MtpError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()