Skip to main content

Scope

Struct Scope 

Source
pub struct Scope<'a> {
    pub row: Option<Row<'a>>,
    pub args: Option<&'a BTreeMap<String, String>>,
    pub globals: &'a dyn Globals,
    pub missing_row_field: Option<&'a dyn Fn(&str)>,
}
Expand description

The scopes a placeholder can resolve against.

Each caller brings the scopes it has: a <for> row brings Self::row, a fragment instantiation brings Self::args, and a <for> inside a fragment body meets both in turn.

Fields§

§row: Option<Row<'a>>

The iteration in progress, absent outside a <for> body.

§args: Option<&'a BTreeMap<String, String>>

The arguments a fragment instance was built with, already folded over the declared defaults. Absent outside a fragment body.

§globals: &'a dyn Globals

Where a global placeholder reads its value.

§missing_row_field: Option<&'a dyn Fn(&str)>

Told the name of a row field the iteration record does not have. Absent when the caller has nowhere to report it.

Implementations§

Source§

impl<'a> Scope<'a>

Source

pub fn new(globals: &'a dyn Globals) -> Self

A scope with globals alone: no iteration, no arguments, nothing to report to.

Source

pub fn with_row(self, item: &'a ArrayItem, index: usize) -> Self

The same scope, iterating item at index.

Source

pub fn with_args(self, args: &'a BTreeMap<String, String>) -> Self

The same scope, inside a fragment instantiated with args.

Source

pub fn reporting_to(self, report: &'a dyn Fn(&str)) -> Self

The same scope, reporting a row field the record does not have.

Auto Trait Implementations§

§

impl<'a> Freeze for Scope<'a>

§

impl<'a> !RefUnwindSafe for Scope<'a>

§

impl<'a> !Send for Scope<'a>

§

impl<'a> !Sync for Scope<'a>

§

impl<'a> Unpin for Scope<'a>

§

impl<'a> UnsafeUnpin for Scope<'a>

§

impl<'a> !UnwindSafe for Scope<'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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

impl<T> IntoResult<T> for T

§

fn into_result(self) -> Result<T, RunSystemError>

Converts this type into the system output type.
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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more