pub trait ToFlex<T> {
    fn to_flex(&self) -> FlexStr<T>;
}
Expand description

A trait that converts the source to a FlexStr<T> without consuming it

use flexstr::{FlexStr, ToFlex};

let a: FlexStr = "This is a heap allocated string!!!!!".to_string().to_flex();
assert!(a.is_heap());

Required methods

Converts the source to a FlexStr<T> without consuming it

Implementations on Foreign Types

use flexstr::{AFlexStr, FlexStr, ToFlex};

// *** Don't do this - use `into_flex` on literals ***
let a: AFlexStr = "inlined".to_flex();
assert!(a.is_inlined());

let b: FlexStr = "This is too long to be inlined!!!!!!".to_flex();
assert!(b.is_heap())

Implementors