Trait flexstr::ToAFlexStr
source · [−]pub trait ToAFlexStr {
fn to_a_flex_str(&self) -> AFlexStr;
}Expand description
A trait that converts the source to an AFlexStr without consuming it
use flexstr::ToAFlexStr;
let a = "This is a heap allocated string!!!!!".to_a_flex_str();
assert!(a.is_heap());Required methods
fn to_a_flex_str(&self) -> AFlexStr
fn to_a_flex_str(&self) -> AFlexStr
Converts the source to a AFlexStr without consuming it
Implementations on Foreign Types
sourceimpl ToAFlexStr for str
impl ToAFlexStr for str
sourcefn to_a_flex_str(&self) -> AFlexStr
fn to_a_flex_str(&self) -> AFlexStr
use flexstr::ToAFlexStr;
// Don't use for literals - use `into_flex_str` instead
let a = "test".to_a_flex_str();
assert!(a.is_inlined());sourceimpl ToAFlexStr for bool
impl ToAFlexStr for bool
sourcefn to_a_flex_str(&self) -> AFlexStr
fn to_a_flex_str(&self) -> AFlexStr
use flexstr::ToAFlexStr;
let s = false.to_a_flex_str();
assert!(s.is_static());
assert_eq!(s, "false");sourceimpl ToAFlexStr for char
impl ToAFlexStr for char
sourcefn to_a_flex_str(&self) -> AFlexStr
fn to_a_flex_str(&self) -> AFlexStr
use flexstr::ToAFlexStr;
let s = '☺'.to_a_flex_str();
assert!(s.is_inlined());
assert_eq!(s, "☺");sourceimpl ToAFlexStr for i8
impl ToAFlexStr for i8
sourcefn to_a_flex_str(&self) -> AFlexStr
fn to_a_flex_str(&self) -> AFlexStr
use flexstr::ToAFlexStr;
let s = 123i8.to_a_flex_str();
assert!(s.is_inlined());
assert_eq!(s, "123");sourceimpl ToAFlexStr for u8
impl ToAFlexStr for u8
sourcefn to_a_flex_str(&self) -> AFlexStr
fn to_a_flex_str(&self) -> AFlexStr
use flexstr::ToAFlexStr;
let s = 123u8.to_a_flex_str();
assert!(s.is_inlined());
assert_eq!(s, "123");sourceimpl ToAFlexStr for i16
impl ToAFlexStr for i16
sourcefn to_a_flex_str(&self) -> AFlexStr
fn to_a_flex_str(&self) -> AFlexStr
use flexstr::ToAFlexStr;
let s = 123i16.to_a_flex_str();
assert!(s.is_inlined());
assert_eq!(s, "123");sourceimpl ToAFlexStr for u16
impl ToAFlexStr for u16
sourcefn to_a_flex_str(&self) -> AFlexStr
fn to_a_flex_str(&self) -> AFlexStr
use flexstr::ToAFlexStr;
let s = 123u16.to_a_flex_str();
assert!(s.is_inlined());
assert_eq!(s, "123");sourceimpl ToAFlexStr for i32
impl ToAFlexStr for i32
sourcefn to_a_flex_str(&self) -> AFlexStr
fn to_a_flex_str(&self) -> AFlexStr
use flexstr::ToAFlexStr;
let s = 123i32.to_a_flex_str();
assert!(s.is_inlined());
assert_eq!(s, "123");sourceimpl ToAFlexStr for u32
impl ToAFlexStr for u32
sourcefn to_a_flex_str(&self) -> AFlexStr
fn to_a_flex_str(&self) -> AFlexStr
use flexstr::ToAFlexStr;
let s = 123u32.to_a_flex_str();
assert!(s.is_inlined());
assert_eq!(s, "123");sourceimpl ToAFlexStr for i64
impl ToAFlexStr for i64
sourcefn to_a_flex_str(&self) -> AFlexStr
fn to_a_flex_str(&self) -> AFlexStr
use flexstr::ToAFlexStr;
let s = 123i64.to_a_flex_str();
assert!(s.is_inlined());
assert_eq!(s, "123");sourceimpl ToAFlexStr for u64
impl ToAFlexStr for u64
sourcefn to_a_flex_str(&self) -> AFlexStr
fn to_a_flex_str(&self) -> AFlexStr
use flexstr::ToAFlexStr;
let s = 123u64.to_a_flex_str();
assert!(s.is_inlined());
assert_eq!(s, "123");sourceimpl ToAFlexStr for i128
impl ToAFlexStr for i128
sourcefn to_a_flex_str(&self) -> AFlexStr
fn to_a_flex_str(&self) -> AFlexStr
use flexstr::ToAFlexStr;
let s = 123i128.to_a_flex_str();
assert!(s.is_inlined());
assert_eq!(s, "123");sourceimpl ToAFlexStr for u128
impl ToAFlexStr for u128
sourcefn to_a_flex_str(&self) -> AFlexStr
fn to_a_flex_str(&self) -> AFlexStr
use flexstr::ToAFlexStr;
let s = 123u128.to_a_flex_str();
assert!(s.is_inlined());
assert_eq!(s, "123");sourceimpl ToAFlexStr for isize
impl ToAFlexStr for isize
sourcefn to_a_flex_str(&self) -> AFlexStr
fn to_a_flex_str(&self) -> AFlexStr
use flexstr::ToAFlexStr;
let s = 123isize.to_a_flex_str();
assert!(s.is_inlined());
assert_eq!(s, "123");sourceimpl ToAFlexStr for usize
impl ToAFlexStr for usize
sourcefn to_a_flex_str(&self) -> AFlexStr
fn to_a_flex_str(&self) -> AFlexStr
use flexstr::ToAFlexStr;
let s = 123usize.to_a_flex_str();
assert!(s.is_inlined());
assert_eq!(s, "123");sourceimpl ToAFlexStr for f32
impl ToAFlexStr for f32
sourcefn to_a_flex_str(&self) -> AFlexStr
fn to_a_flex_str(&self) -> AFlexStr
use flexstr::ToAFlexStr;
let s = 123.456f32.to_a_flex_str();
assert!(s.is_inlined());
assert_eq!(s, "123.456");sourceimpl ToAFlexStr for f64
impl ToAFlexStr for f64
sourcefn to_a_flex_str(&self) -> AFlexStr
fn to_a_flex_str(&self) -> AFlexStr
use flexstr::ToAFlexStr;
let s = 123.456f64.to_a_flex_str();
assert!(s.is_inlined());
assert_eq!(s, "123.456");