pub trait IntoFlex<T> {
    fn into_flex(self) -> FlexStr<T>;
}
Expand description

A trait that converts the source to a FlexStr<T> while consuming the original

use flexstr::{FlexStr, IntoFlex};

let a: FlexStr = "This is a wrapped static string literal no matter how long it is!!!!!".into_flex();
assert!(a.is_static());

Required methods

Converts the source to a FlexStr<T> while consuming the original

Implementations on Foreign Types

use flexstr::{AFlexStr, IntoFlex};

let a = "This can just be wrapped as a static string literal!";
let b: AFlexStr = a.into_flex();
assert!(b.is_static());
assert_eq!(b, a);
use flexstr::{AFlexStr, IntoFlex};

let a = "Inlined!".to_string();
let b: AFlexStr = a.clone().into_flex();
assert!(b.is_inlined());
assert_eq!(b, a);
use flexstr::{AFlexStr, IntoFlex};

let a: AFlexStr = 't'.into_flex();
assert!(a.is_inlined());
assert_eq!(a, "t");

Implementors