Skip to main content

IncludeRequest

Struct IncludeRequest 

Source
#[non_exhaustive]
pub struct IncludeRequest<'a> { pub spec: &'a str, pub from_name: &'a str, pub from_id: Option<&'a str>, pub stack: Vec<String>, pub size_remaining: Option<usize>, pub location: Location, }
Expand description

A request passed to the include resolver to resolve an include directive.

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.
§spec: &'a str

The include specification (e.g. the path or URL).

§from_name: &'a str

The name of the file or source currently being parsed (top of the include stack).

§from_id: Option<&'a str>

The canonical identity of the source currently being parsed, or None for the root parser.

§stack: Vec<String>

The full chain of inclusions leading to this request, with the current file at the end.

§size_remaining: Option<usize>

Remaining decoded byte quota available for additional reader-backed input, if configured.

§location: Location

The location in the source file where the include was requested.

Implementations§

Source§

impl<'a> IncludeRequest<'a>

Source

pub fn new(spec: &'a str, from_name: &'a str, location: Location) -> Self

Construct a root-level include request.

This is primarily useful when testing a resolver directly. Parser-created requests populate the same fields and may include parent-source and budget metadata.

Source

pub fn with_from_id(self, from_id: &'a str) -> Self

Set the canonical identity of the source containing the include.

Source

pub fn with_stack(self, stack: Vec<String>) -> Self

Set the include chain leading to this request.

Source

pub fn with_size_remaining(self, size_remaining: usize) -> Self

Set the remaining reader-input byte budget.

Trait Implementations§

Source§

impl<'a> Debug for IncludeRequest<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for IncludeRequest<'a>

§

impl<'a> RefUnwindSafe for IncludeRequest<'a>

§

impl<'a> Send for IncludeRequest<'a>

§

impl<'a> Sync for IncludeRequest<'a>

§

impl<'a> Unpin for IncludeRequest<'a>

§

impl<'a> UnsafeUnpin for IncludeRequest<'a>

§

impl<'a> UnwindSafe for IncludeRequest<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.