pub enum IncludeError {
Cycle {
include_site: Range,
path: PathBuf,
chain: Vec<PathBuf>,
},
DepthExceeded {
include_site: Range,
limit: usize,
chain: Vec<PathBuf>,
},
TotalIncludesExceeded {
include_site: Range,
limit: usize,
},
FileTooLarge {
include_site: Range,
path: PathBuf,
size: u64,
limit: u64,
},
RootEscape {
path: PathBuf,
root: PathBuf,
},
AbsolutePath {
path: PathBuf,
},
NotFound {
include_site: Range,
path: PathBuf,
},
ParseFailed {
path: PathBuf,
message: String,
},
ContainerPolicy {
include_site: Range,
container: &'static str,
file: PathBuf,
violation: &'static str,
},
LoaderIo {
path: PathBuf,
message: String,
},
MissingSrc {
include_site: Range,
},
}Expand description
Errors the include resolver can produce.
Variants§
Cycle
An include chain looped back on itself. chain is the resolution
stack at the moment the duplicate path was about to be pushed,
in source-order (entry first, deepest last). include_site is the
range of the offending lex.include annotation in its host file —
useful for diagnostics that highlight the exact line.
DepthExceeded
The include depth exceeded ResolveConfig::max_depth. chain
shows the resolution stack at the moment of failure, in source
order. include_site is the range of the offending
lex.include annotation in its host file.
TotalIncludesExceeded
The total number of includes resolved across the document
exceeded ResolveConfig::max_total_includes. Bounds adversarial
fan-out (which max_depth alone does not). include_site is the
lex.include annotation that pushed the count past the limit.
FileTooLarge
The included file’s size exceeded the loader’s configured limit.
Surfaced by loaders that read from a real filesystem (FsLoader)
to bound memory allocation per include. include_site is the
offending annotation; size and limit are in bytes.
RootEscape
A path resolved outside the configured ResolveConfig::root.
AbsolutePath
The include src was a platform-absolute filesystem path
(e.g. Windows C:\foo, \\server\share, \foo). The spec
forbids absolute filesystem paths from entering the
resolution pipeline; the root-absolute form (leading /
resolved against the includes root) is the only spec-allowed
way to write a path that doesn’t start from the host’s
directory. On Unix the only thing that’s Path::is_absolute()
is a leading /, which is consumed by the root-absolute
branch first; this variant therefore only fires in practice
for Windows-shaped absolute paths.
NotFound
The loader could not find or read the included file. include_site
is the range of the offending lex.include annotation in its host
file, so editors can squiggle the line that asked for the missing
file rather than the document head.
ParseFailed
The loader returned text that the parser rejected.
ContainerPolicy
The included file’s content is not legal in the include site’s parent container.
Today this only occurs when an included file has top-level Sessions
and the include site is inside a GeneralContainer (Definition,
ListItem, or another Annotation’s body). The violation field
names the offending content kind (e.g. "Sessions") so future
container/policy combinations can reuse this variant without a
breaking change.
LoaderIo
Loader propagated a non-NotFound I/O error.
MissingSrc
lex.include annotation was missing the mandatory src= parameter.
Trait Implementations§
Source§impl Clone for IncludeError
impl Clone for IncludeError
Source§fn clone(&self) -> IncludeError
fn clone(&self) -> IncludeError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for IncludeError
impl Debug for IncludeError
Source§impl Display for IncludeError
impl Display for IncludeError
Source§impl Error for IncludeError
impl Error for IncludeError
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
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for IncludeError
impl RefUnwindSafe for IncludeError
impl Send for IncludeError
impl Sync for IncludeError
impl Unpin for IncludeError
impl UnsafeUnpin for IncludeError
impl UnwindSafe for IncludeError
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more