#[non_exhaustive]pub struct ContentError {
pub file: String,
pub line: Option<u32>,
pub column: Option<u32>,
pub message: String,
pub code: Option<Code>,
}Expand description
One problem found while loading or validating an asset. Build it with
ContentError::new and its methods (ADR-0039).
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.file: StringHuman-facing file path, e.g. base/data/colors.ron.
line: Option<u32>1-based line, if known.
column: Option<u32>1-based column, if known (only shown together with a line).
message: StringWhat is wrong, in plain words.
code: Option<Code>Its problem code, if its class has one (codes).
Implementations§
Source§impl ContentError
impl ContentError
Sourcepub fn new(file: impl Into<String>, message: impl Into<String>) -> ContentError
pub fn new(file: impl Into<String>, message: impl Into<String>) -> ContentError
An error about a whole file (no position).
Sourcepub fn not_found(file: impl Into<String>) -> ContentError
pub fn not_found(file: impl Into<String>) -> ContentError
The error that file isn’t in the bundle
(NOT_FOUND, codes::MISSING_FILE).
Sourcepub fn at(self, line: u32, column: Option<u32>) -> ContentError
pub fn at(self, line: u32, column: Option<u32>) -> ContentError
Attaches a 1-based line and optional column.
Sourcepub fn with_code(self, code: Code) -> ContentError
pub fn with_code(self, code: Code) -> ContentError
Gives it problem code code.
Trait Implementations§
Source§impl Clone for ContentError
impl Clone for ContentError
Source§fn clone(&self) -> ContentError
fn clone(&self) -> ContentError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ContentError
impl Debug for ContentError
Source§impl Display for ContentError
impl Display for ContentError
impl Eq for ContentError
Source§impl Error for ContentError
impl Error for ContentError
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 From<NotText> for ContentError
impl From<NotText> for ContentError
Source§fn from(not_text: NotText) -> ContentError
fn from(not_text: NotText) -> ContentError
Converts to this type from the input type.
Source§impl PartialEq for ContentError
impl PartialEq for ContentError
impl StructuralPartialEq for ContentError
Auto Trait Implementations§
impl Freeze for ContentError
impl RefUnwindSafe for ContentError
impl Send for ContentError
impl Sync for ContentError
impl Unpin for ContentError
impl UnsafeUnpin for ContentError
impl UnwindSafe for ContentError
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