#[non_exhaustive]pub enum ReflectError {
Show 13 variants
PartiallyInitialized {
field: Field,
},
NoSuchVariant {
enum_def: EnumDef,
},
WrongShape {
expected: &'static Shape,
actual: &'static Shape,
},
WasNotA {
expected: &'static str,
actual: &'static Shape,
},
UninitializedField {
shape: &'static Shape,
field_name: &'static str,
},
UninitializedEnumField {
shape: &'static Shape,
field_name: &'static str,
variant_name: &'static str,
},
NoVariantSelected {
shape: &'static Shape,
},
UninitializedValue {
shape: &'static Shape,
},
InvariantViolation {
invariant: &'static str,
},
MissingCharacteristic {
shape: &'static Shape,
characteristic: Characteristic,
},
OperationFailed {
shape: &'static Shape,
operation: &'static str,
},
FieldError {
shape: &'static Shape,
field_error: FieldError,
},
Unknown,
}Expand description
Errors that can occur when reflecting on types.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
PartiallyInitialized
Tried to build or build_in_place a struct/enum without initializing all fields.
NoSuchVariant
Tried to set an enum to a variant that does not exist
WrongShape
Tried to get the wrong shape out of a value — e.g. we were manipulating
a String, but .get() was called with a u64 or something.
Fields
WasNotA
Attempted to perform an operation that expected a struct or something
Fields
UninitializedField
A field was not initialized during build
Fields
UninitializedEnumField
A field in an enum variant was not initialized during build
Fields
NoVariantSelected
An enum had no variant selected during build
UninitializedValue
A scalar value was not initialized during build
InvariantViolation
An invariant of the reflection system was violated.
MissingCharacteristic
Attempted to set a value to its default, but the value doesn’t implement Default.
Fields
characteristic: CharacteristicThe characteristic that is missing.
OperationFailed
An operation failed for a given shape
Fields
FieldError
An error occurred when attempting to access or modify a field.
Fields
field_error: FieldErrorThe specific error that occurred with the field.
Unknown
An unknown error occurred.
Trait Implementations§
Source§impl Debug for ReflectError
impl Debug for ReflectError
Source§impl Display for ReflectError
impl Display for ReflectError
Source§impl Error for ReflectError
impl Error for ReflectError
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
Auto Trait Implementations§
impl Freeze for ReflectError
impl RefUnwindSafe for ReflectError
impl Send for ReflectError
impl Sync for ReflectError
impl Unpin for ReflectError
impl UnwindSafe for ReflectError
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> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);