pub struct TCString(/* private fields */);
Expand description
A TinyChain String
Implementations§
source§impl TCString
impl TCString
sourcepub fn render<T: Serialize>(&self, data: T) -> TCResult<TCString>
pub fn render<T: Serialize>(&self, data: T) -> TCResult<TCString>
Render this string as a Handlebars
template with the given data
.
Example:
let data: HashMap<_, _> = std::iter::once(("name", "world")).collect();
assert_eq!(
TCString::from("Hello, {{name}}!".to_string()).render(data).unwrap().as_str(),
"Hello, world!");
See the handlebars
documentation for a complete description of the formatting options.
Trait Implementations§
source§impl AsType<TCString> for Value
impl AsType<TCString> for Value
source§fn as_type_mut(&mut self) -> Option<&mut TCString>
fn as_type_mut(&mut self) -> Option<&mut TCString>
Borrow this instance mutably as an instance of
T
if possible.source§impl<'de> Deserialize<'de> for TCString
impl<'de> Deserialize<'de> for TCString
source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
source§impl FromStream for TCString
impl FromStream for TCString
source§impl GetSize for TCString
impl GetSize for TCString
source§fn get_stack_size() -> usize
fn get_stack_size() -> usize
Determines how may bytes this object occupies inside the stack. Read more
source§fn get_heap_size(&self) -> usize
fn get_heap_size(&self) -> usize
Determines how many bytes this object occupies inside the heap. Read more
source§impl<'en> IntoStream<'en> for TCString
impl<'en> IntoStream<'en> for TCString
source§impl PartialEq<String> for TCString
impl PartialEq<String> for TCString
source§impl PartialEq for TCString
impl PartialEq for TCString
source§impl TryCastFrom<TCString> for Bytes
impl TryCastFrom<TCString> for Bytes
source§fn can_cast_from(value: &TCString) -> bool
fn can_cast_from(value: &TCString) -> bool
Test if
value
can be cast into Self
.source§fn opt_cast_from(value: TCString) -> Option<Self>
fn opt_cast_from(value: TCString) -> Option<Self>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.source§impl TryCastFrom<Value> for TCString
impl TryCastFrom<Value> for TCString
source§fn can_cast_from(value: &Value) -> bool
fn can_cast_from(value: &Value) -> bool
Test if
value
can be cast into Self
.source§fn opt_cast_from(value: Value) -> Option<Self>
fn opt_cast_from(value: Value) -> Option<Self>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.impl Eq for TCString
impl StructuralPartialEq for TCString
Auto Trait Implementations§
impl RefUnwindSafe for TCString
impl Send for TCString
impl Sync for TCString
impl Unpin for TCString
impl UnwindSafe for TCString
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<F> Match for F
impl<F> Match for F
source§fn matches<T>(&self) -> boolwhere
T: TryCastFrom<Self>,
fn matches<T>(&self) -> boolwhere
T: TryCastFrom<Self>,
Returns
true
if self
can be cast into the target type T
.§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<F, T> TryCastFrom<F> for Twhere
T: CastFrom<F>,
impl<F, T> TryCastFrom<F> for Twhere
T: CastFrom<F>,
source§fn can_cast_from(_: &F) -> bool
fn can_cast_from(_: &F) -> bool
Test if
value
can be cast into Self
.source§fn opt_cast_from(f: F) -> Option<T>
fn opt_cast_from(f: F) -> Option<T>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.source§impl<F, T> TryCastInto<T> for Fwhere
T: TryCastFrom<F>,
impl<F, T> TryCastInto<T> for Fwhere
T: TryCastFrom<F>,
source§fn can_cast_into(&self) -> bool
fn can_cast_into(&self) -> bool
Test if
self
can be cast into T
.source§fn opt_cast_into(self) -> Option<T>
fn opt_cast_into(self) -> Option<T>
Returns
Some(T)
if self
can be cast into T
, otherwise None
.