[][src]Trait tstr::StrValue

pub trait StrValue: Debug + Copy + Default + 'static {
    pub const STR: &'static str;
    pub fn to_str(self) -> &'static str { ... }
}
This is supported on crate feature const_generics only.

For getting the &'static str value of this TStr.

You can use this as the bound for a generic TStr parameter.

Example

use tstr::{StrValue, ts};

asserts(ts!(foo), ts!(bar), ts!(baz));

fn asserts<A, B, C>(foo: A, bar: B, baz: C)
where
    A: StrValue,
    B: StrValue,
    C: StrValue,
{
    assert_eq!(A::STR, "foo");
    assert_eq!(foo.to_str(), "foo");

    assert_eq!(B::STR, "bar");
    assert_eq!(bar.to_str(), "bar");

    assert_eq!(C::STR, "baz");
    assert_eq!(baz.to_str(), "baz");

}

Associated Constants

pub const STR: &'static str[src]

The &'static str value of this TStr.

Loading content...

Provided methods

pub fn to_str(self) -> &'static str[src]

Gets the &'static str value of this TStr.

Loading content...

Implementors

impl<const S: &'static str> StrValue for TStr<___<S>>[src]

Loading content...