pub struct NameError { /* private fields */ }Expand description
Why a Report could not give what was asked for by name.
There are three reasons, and the message says which: nothing has that name; a shortened name fits more than one thing, which are listed so that more of the name can be given; or the name is the name of something else, a comparison asked for as a single timing, say.
Printing it, with {} or {:?}, gives the message, so .expect("..") on a
failed lookup says what to fix. It is a std::error::Error, so ? works
in a main that returns Result<(), Box<dyn Error>>.
Trait Implementations§
Source§impl Debug for NameError
The same text as Display, so that unwrap and expect show it as it
reads rather than as a quoted string.
impl Debug for NameError
The same text as Display, so that unwrap and expect show it as it
reads rather than as a quoted string.
Source§impl Error for NameError
impl Error for NameError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl Forget for NameError
impl Freeze for NameError
impl RefUnwindSafe for NameError
impl Send for NameError
impl Sync for NameError
impl Unpin for NameError
impl UnsafeUnpin for NameError
impl UnwindSafe for NameError
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