Skip to main content

len

Function len 

Source
pub const fn len<S: IsTStr>(_: S) -> usize
Expand description

Gets the length of the IsTStr argument in utf8

This is a non-associated function for const compatibility, the (non-const) trait method equivalent of this is IsTStr::len

ยงExample

use tstr::ts;

const _: () = assert!(tstr::len(ts!(4)) == 1);

const _: () = assert!(tstr::len(ts!("hello")) == 5);

const _: () = assert!(tstr::len(ts!(rustacean)) == 9);