pub trait Strung {
// Provided methods
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_generic<const A: char, const Z: char>(
&self,
_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!
Provided Methods§
Sourcefn strung(&self, _text: &str) -> String
fn strung(&self, _text: &str) -> String
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
Sourcefn strung_dynamic(&self, _pre: &str, _post: &str, _text: &str) -> String
fn strung_dynamic(&self, _pre: &str, _post: &str, _text: &str) -> String
Replacement with custom inline Postfixes and Prefixes
Sourcefn strung_generic<const A: char, const Z: char>(&self, _text: &str) -> String
fn strung_generic<const A: char, const Z: char>(&self, _text: &str) -> String
Replacement with custom generic constant char 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>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.