[−][src]Trait asciii::templater::IsKeyword
Simple template style keyword replacement.
This allows replacing a known set of keywords looking like ##THIS##
.
Here it is implemented for Deref<Target=str>
.
Required Methods
fn is_keyword(&self) -> bool
Checks if the whole string is a keyword
fn get_keyword(&self) -> Option<String>
Captures keywords from string.
fn list_keywords(&self) -> Vec<String>
Well, it lists the keywords in a string, duh!
fn map_keywords<F>(&self, closure: F) -> String where
F: Fn(&str) -> String,
F: Fn(&str) -> String,
This one is usefull.
Takes a clorsure that replaces keywords. Careful, this replaces either way! If you get a keywords you don't want to replace, please place it back where you got it from.
Example
.map_keywords|keyword| match data.get(keyword){ Some(content) => String::from(*content), None => format!("##{}##", keyword) }
Implementors
impl<U: Deref<Target = str>> IsKeyword for U
[src]
impl<U: Deref<Target = str>> IsKeyword for U
Allows very simplistic ##KEYWORD##
replacement.
fn is_keyword(&self) -> bool
[src]
fn is_keyword(&self) -> bool
Checks if the whole string is a keyword
fn get_keyword(&self) -> Option<String>
[src]
fn get_keyword(&self) -> Option<String>
Captures keywords from string.
fn list_keywords(&self) -> Vec<String>
[src]
fn list_keywords(&self) -> Vec<String>
Well, it lists the keywords in a string, duh!
fn map_keywords<F>(&self, closure: F) -> String where
F: Fn(&str) -> String,
[src]
fn map_keywords<F>(&self, closure: F) -> String where
F: Fn(&str) -> String,
This one is usefull.
Takes a clorsure that replaces keywords. Careful, this replaces either way! If you get a keywords you don't want to replace, please place it back where you got it from.
Example
.map_keywords|keyword| match data.get(keyword){ Some(content) => String::from(*content), None => format!("##{}##", keyword) }