#[non_exhaustive]pub enum QrError {
DataTooLong,
InvalidVersion {
version: Version,
ec_level: EcLevel,
},
UnsupportedCharacterSet,
InvalidEciDesignator {
value: u32,
},
InvalidCharacter {
position: usize,
byte: u8,
},
InvalidStructuredAppend {
value: u8,
},
}Expand description
QrError encodes the error encountered when generating a QR code.
This enum is #[non_exhaustive]: future versions may add variants, so
external callers should match with a _ arm.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
DataTooLong
The data is too long to encode into a QR code for the given version.
InvalidVersion
The provided version / error correction level combination is invalid.
Carries the offending Version and EcLevel.
Fields
UnsupportedCharacterSet
Some characters in the data cannot be supported by the provided QR code version.
InvalidEciDesignator
The provided ECI designator is invalid. Carries the offending value;
a valid designator must be between 0 and 999999.
InvalidCharacter
A character not belonging to the character set is found. Carries the
byte position (offset into the input) and the offending byte value.
Fields
InvalidStructuredAppend
Invalid Structured Append parameter — the symbol count is not in 2..=16,
or the position is not in 1..=total. Carries the offending value.
Implementations§
Source§impl QrError
impl QrError
Sourcepub fn suggestion(&self) -> Option<&'static str>
pub fn suggestion(&self) -> Option<&'static str>
Returns an actionable hint for fixing this error, if one applies — useful for surfacing user-facing guidance alongside the error message.
§Examples
use qrcode_core::QrError;
let err = QrError::DataTooLong;
assert!(err.suggestion().is_some());Trait Implementations§
impl Copy for QrError
Source§impl<'de> Deserialize<'de> for QrError
impl<'de> Deserialize<'de> for QrError
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<QrError, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<QrError, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for QrError
Source§impl Error for QrError
impl Error for QrError
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()
Source§impl Serialize for QrError
impl Serialize for QrError
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for QrError
Auto Trait Implementations§
impl Freeze for QrError
impl RefUnwindSafe for QrError
impl Send for QrError
impl Sync for QrError
impl Unpin for QrError
impl UnsafeUnpin for QrError
impl UnwindSafe for QrError
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.