pub trait ToStkStr<const N: usize> {
// Required method
fn to_stk_str(&self) -> Str<N>;
}Required Methods§
Sourcefn to_stk_str(&self) -> Str<N>
fn to_stk_str(&self) -> Str<N>
Converts the given value to a Str<N>.
§Examples
use stx::{Str, ToStkStr};
struct Num(u8);
impl<const N: usize> ToStkStr<N> for Num {
fn to_stk_str(&self) -> Str<N> {
match self.0 {
5 => Str::from("5"),
_ => Str::from("?"),
}
}
}
let five = ToStkStr::<16>::to_stk_str(&Num(5));
assert_eq!(five, Str::<16>::from("5"));