pub enum GlobError {
Build(BuildError),
Walk(WalkError),
}
Expand description
General errors concerning Program
s.
This is the most general error and each of its variants exposes a particular error type that describes the details of its associated error condition. This error is not used in any Wax APIs directly, but can be used to encapsulate the more specific errors that are.
Examples
To encapsulate different errors in the Wax API behind a function, convert them into a
GlobError
via ?
.
ⓘ
use std::path::PathBuf;
use wax::{Glob, GlobError};
fn read_all(directory: impl Into<PathBuf>) -> Result<Vec<u8>, GlobError> {
let mut data = Vec::new();
let glob = Glob::new("**/*.data.bin")?;
for entry in glob.walk(directory) {
let entry = entry?;
// ...
}
Ok(data)
}
Variants§
Trait Implementations§
source§impl Diagnostic for GlobError
impl Diagnostic for GlobError
source§fn code(&self) -> Option<Box<dyn Display + '_>>
fn code(&self) -> Option<Box<dyn Display + '_>>
Unique diagnostic code that can be used to look up more information
about this
Diagnostic
. Ideally also globally unique, and documented
in the toplevel crate’s documentation for easy searching. Rust path
format (foo::bar::baz
) is recommended, but more classic codes like
E0123
or enums will work just fine.source§fn help(&self) -> Option<Box<dyn Display + '_>>
fn help(&self) -> Option<Box<dyn Display + '_>>
Additional help text related to this
Diagnostic
. Do you have any
advice for the poor soul who’s just run into this issue?source§fn severity(&self) -> Option<Severity>
fn severity(&self) -> Option<Severity>
Diagnostic severity. This may be used by
ReportHandler
s to change the display format
of this diagnostic. Read moresource§fn labels(&self) -> Option<Box<dyn Iterator<Item = LabeledSpan> + '_>>
fn labels(&self) -> Option<Box<dyn Iterator<Item = LabeledSpan> + '_>>
Labels to apply to this
Diagnostic
’s [Diagnostic::source_code
]source§fn source_code(&self) -> Option<&dyn SourceCode>
fn source_code(&self) -> Option<&dyn SourceCode>
Source code to apply this
Diagnostic
’s [Diagnostic::labels
] to.Additional related
Diagnostic
s.source§fn url(&self) -> Option<Box<dyn Display + '_>>
fn url(&self) -> Option<Box<dyn Display + '_>>
URL to visit for a more detailed explanation/help about this
Diagnostic
.source§fn diagnostic_source(&self) -> Option<&dyn Diagnostic>
fn diagnostic_source(&self) -> Option<&dyn Diagnostic>
The cause of the error.
source§impl Error for GlobError
impl Error for GlobError
source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
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<BuildError> for GlobError
impl From<BuildError> for GlobError
source§fn from(error: BuildError) -> Self
fn from(error: BuildError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl !RefUnwindSafe for GlobError
impl Send for GlobError
impl Sync for GlobError
impl Unpin for GlobError
impl !UnwindSafe for GlobError
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