pub struct Sigma<'s> { /* fields omitted */ }
Sigma, Template Language made simple !
Example:
let result = Sigma::new("Hello {{ username }}")
.bind("username", "someone")
.parse()
.map_err(|e| eprintln!("{}", e))?
.compile()
.map_err(|e| eprintln!("{}", e))?;
assert_eq!("Hello someone", result);
pub fn new(input: &'s str) -> Self | |
Create new Sigma with some template
pub fn bind(self, key: &'s str, value: &'s str) -> Self | |
bind some key in the template for some value
bind one or more keys with values in one run.
remove all the previous binded keys, and use that one
ignore parse error for unbinded variables
register a helper function
The Function Name Must be in UPPERCASE
Parse the template before compiling it to ensure no runtime erros.
Compile the template with the binded values
this will panic if the current template
not parsed yet.
This method tests for self
and other
values to be equal, and is used by ==
. Read more
This method tests for !=
.
Performs copy-assignment from source
. Read more
Formats the value using the given formatter. Read more
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Mutably borrows from an owned value. Read more