pub trait Strung {
fn strung(&self, text: &str) -> String;
fn strung_static(&self, text: &str) -> String;
fn strung_dynamic(&self, pre: &str, post: &str, text: &str) -> String;
fn strung_curly(&self, text: &str) -> String;
fn strung_dollar(&self, text: &str) -> String;
fn strung_dollry(&self, text: &str) -> String;
fn strung_hashtag(&self, text: &str) -> String;
fn strung_angle(&self, text: &str) -> String;
}
Expand description
Designed to be used with the strung-derive crate!
Required Methods
Default text replacement via {field_name}
, changable via #[strung("pre","post")]
This is the most efficient cause pre- anf postfixes are merged with the field-names on compilation time!
sourcefn strung_static(&self, text: &str) -> String
fn strung_static(&self, text: &str) -> String
Replacement with custom static postfixes and prefixes
- STRUNG_PRE for the prefix - Default: “$”
- STRUNG_POST for the postfix - Default: “”
Therefore by default replacement via
$field_name
.
Easy changable:
- File scope (shadowing): config::static_on_file
- Global scope (mut): config::static_global
Replacement with custom inline Postfixes and Prefixes
sourcefn strung_curly(&self, text: &str) -> String
fn strung_curly(&self, text: &str) -> String
Same as Strung::strung but not changable and always addressable by {field_name}
sourcefn strung_dollar(&self, text: &str) -> String
fn strung_dollar(&self, text: &str) -> String
Same as Strung::strung but not changable and always addressable by $field_name
sourcefn strung_dollry(&self, text: &str) -> String
fn strung_dollry(&self, text: &str) -> String
Same as Strung::strung but not changable and always addressable by ${field_name}
sourcefn strung_hashtag(&self, text: &str) -> String
fn strung_hashtag(&self, text: &str) -> String
Same as Strung::strung but not changable and always addressable by #field_name
sourcefn strung_angle(&self, text: &str) -> String
fn strung_angle(&self, text: &str) -> String
Same as Strung::strung but not changable and always addressable by <field_name>