rune_alloc::str

Function into_string

Source
pub fn into_string<A: Allocator>(this: Box<str, A>) -> String<A>
Expand description

Converts a Box<str> into a String without copying or allocating.

ยงExamples

Basic usage:

use rune::alloc::String;
use rune::alloc::str;
use rune::alloc::prelude::*;

let string = String::try_from("birthday gift")?;
let boxed_str = string.try_clone()?.try_into_boxed_str()?;

assert_eq!(str::into_string(boxed_str), string);