Struct bracket::render::context::Context [−][src]
pub struct Context<'call> { /* fields omitted */ }
Expand description
Context for the call to a helper exposes immutable access to the arguments and hash parameters.
It also provides some useful functions for asserting on argument arity and type.
Implementations
Get the map of hash parameters.
Get an argument at an index and use a fallback string value when the argument is missing.
Get a hash parameter for the name and use a fallback string value when the parameter is missing.
Get the value for a missing argument.
When the value for an argument is missing it is coerced to
Value::Null
; this function allows a helper to distinguish
between a literal null value and a null resulting from a missing
value.
Get the value for a missing parameter.
When the value for a parameter is missing it is coerced to
Value::Null
; this function allows a helper to distinguish
between a literal null value and a null resulting from a missing
value.
Get the raw string value for an argument at an index.
Get the raw string value for a hash parameter with the given name.
Get an argument at an index and assert that the value is one of the given types.
If no argument exists at the given index the value is treated as null and type assertion is performed on the null value.
Get a hash parameter for the name and assert that the value is one of the given types.
If no parameter exists for the given name the value is treated as null and type assertion is performed on the null value.
Assert that a value is one of the given kinds.
Get the text for this context.
Only available when invoked as a raw block.
Get a resolved property.
Only available to blockHelperMissing
handlers.
Assert that the call arguments have a valid arity.
If the range start and end are equal than an exact number of arguments are expected and a more concise error message is used. Range ends are inclusive so 0..1 indicates zero or one arguments are allowed.
Assert on the type of a value.
Map an optional template to a result.
If the template is None
this will yield an error; use this
to assert when an inner block template is required.
Assert that a block template is empty.
Helpers that do not accept inner block templates can call this to ensure that they are not invoked with the block syntax.
Lookup a field of a value.
If the target value is not an object or array then this
will yield None
.
Auto Trait Implementations
impl<'call> RefUnwindSafe for Context<'call>
impl<'call> UnwindSafe for Context<'call>