pub enum UnavailableReason {
NoShapePng,
UnsupportedTipKind(String),
Corrupt(String),
MissingTip {
uuid: String,
},
TooLarge {
width: u32,
height: u32,
},
OverBudget,
}Expand description
Why an entry has no tip.
This enum is not #[non_exhaustive], so a consumer can match every
reason. A new reason is a breaking change, so while brushkit is 0.x it
ships in a new minor version. An exhaustive match then stops compiling
until it handles the new reason.
use brushkit_preview::UnavailableReason;
fn label(reason: &UnavailableReason) -> &'static str {
match reason {
UnavailableReason::NoShapePng => "no tip image",
UnavailableReason::UnsupportedTipKind(_) => "unsupported tip",
UnavailableReason::Corrupt(_) => "damaged tip",
UnavailableReason::MissingTip { .. } => "tip missing from the file",
UnavailableReason::TooLarge { .. } => "tip too large",
UnavailableReason::OverBudget => "not loaded",
}
}Variants§
NoShapePng
UnsupportedTipKind(String)
Corrupt(String)
MissingTip
The preset names a sampledData uuid that no sampled tip in the file
carries. uuid is that uuid.
TooLarge
A side over procreate::MAX_PNG_DIMENSION, or a decode over
procreate::MAX_ENTRY_BYTES, counted as TipImageError::TooLarge
describes.
OverBudget
The tip was not returned because it would take the call’s available
tips past MAX_PREVIEW_BYTES. Every later entry that has a tip to
render is OverBudget too, and its tip is not decoded.
Trait Implementations§
Auto Trait Implementations§
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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
Compare self to
key and return true if they are equal.