#[non_exhaustive]pub struct UnknownTypeKeyword {
pub keyword: String,
}Expand description
Error returned by type_keyword_to_kind when the supplied keyword is
not a recognized magic type keyword.
This is a tight, structured error surfaced from a pure mapping function
that has no access to line-number context. Callers that do have line
context (e.g. the grammar layer wrapping a higher-level parse) can
convert it into a richer crate::error::ParseError variant if needed.
The struct is #[non_exhaustive] so future fields (e.g. suggested
alternatives) can be added without a major version bump.
§Examples
use libmagic_rs::parser::types::{type_keyword_to_kind, UnknownTypeKeyword};
let err = type_keyword_to_kind("notarealtype").unwrap_err();
assert_eq!(err.keyword, "notarealtype");Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.keyword: StringThe keyword string that was not recognized.
Trait Implementations§
Source§impl Clone for UnknownTypeKeyword
impl Clone for UnknownTypeKeyword
Source§fn clone(&self) -> UnknownTypeKeyword
fn clone(&self) -> UnknownTypeKeyword
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for UnknownTypeKeyword
impl Debug for UnknownTypeKeyword
Source§impl Display for UnknownTypeKeyword
impl Display for UnknownTypeKeyword
Source§impl Error for UnknownTypeKeyword
impl Error for UnknownTypeKeyword
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()
Source§impl PartialEq for UnknownTypeKeyword
impl PartialEq for UnknownTypeKeyword
impl Eq for UnknownTypeKeyword
impl StructuralPartialEq for UnknownTypeKeyword
Auto Trait Implementations§
impl Freeze for UnknownTypeKeyword
impl RefUnwindSafe for UnknownTypeKeyword
impl Send for UnknownTypeKeyword
impl Sync for UnknownTypeKeyword
impl Unpin for UnknownTypeKeyword
impl UnsafeUnpin for UnknownTypeKeyword
impl UnwindSafe for UnknownTypeKeyword
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