pub struct Context {
pub file: Option<String>,
pub project_root: String,
pub run: RunInfo,
pub vars: Map<String, Value>,
pub cli_vars: BTreeMap<String, String>,
pub locale: String,
pub each: Option<Map<String, Value>>,
}Expand description
A format write request’s template for the html and pdf formats.
Fields§
§file: Option<String>The template file, resolved by core (crate::template_file), absolute. None: the
output names no template, and the plugin uses its default (a table per query).
project_root: StringThe project root: includes and assets are looked up inside it, never outside.
run: RunInfo§vars: Map<String, Value>The Binding’s vars with the schedule’s on top: what var() reads after --var.
cli_vars: BTreeMap<String, String>--var values, as typed on the command line: var() reads them first.
locale: StringThe Binding’s locale: tag, for the number filters.
each: Option<Map<String, Value>>A per-row output’s driver row: each.<column>.
Implementations§
Source§impl Context
impl Context
Sourcepub fn new(
file: Option<&Path>,
project_root: &Path,
run: &RunContext,
vars: JsonMap<String, Json>,
cli_vars: BTreeMap<String, String>,
) -> Context
pub fn new( file: Option<&Path>, project_root: &Path, run: &RunContext, vars: JsonMap<String, Json>, cli_vars: BTreeMap<String, String>, ) -> Context
Build the context of a run.
Sourcepub fn calendar(&self) -> Result<Calendar, String>
pub fn calendar(&self) -> Result<Calendar, String>
The run’s calendar: its timezone and week settings.
pub fn locale(&self) -> Result<Locale, String>
Sourcepub fn run_context(&self) -> Result<RunContext, String>
pub fn run_context(&self) -> Result<RunContext, String>
The run.* context core’s templates read.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Context
impl<'de> Deserialize<'de> for Context
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Context
Auto Trait Implementations§
impl Freeze for Context
impl RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnsafeUnpin for Context
impl UnwindSafe for Context
Blanket Implementations§
impl<T> Allocation for T
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