Struct tera::Context [] [src]

pub struct Context { /* fields omitted */ }

The struct that holds the context of a template rendering.

Light wrapper around a BTreeMap for easier insertions of Serializable values

Methods

impl Context
[src]

[src]

Initializes an empty context

[src]

Converts the val parameter to Value and insert it into the context

Be careful when using this code, it's not being tested!
let mut context = Context::new();
// user is an instance of a struct implementing `Serialize`
context.add("number_users", 42);

[src]

Appends the data of the source parameter to self, overwriting existing keys. The source context will be dropped.

Be careful when using this code, it's not being tested!
let mut target = Context::new();
target.add("a", 1);
target.add("b", 2);
let mut source = Context::new();
source.add("b", 3);
source.add("d", 4);
target.extend(source);

Trait Implementations

impl Debug for Context
[src]

[src]

Formats the value using the given formatter.

impl Clone for Context
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl PartialEq for Context
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl Default for Context
[src]

[src]

Returns the "default value" for a type. Read more

impl Serialize for Context
[src]

[src]

Serialize this value into the given Serde serializer. Read more