Skip to main content

Module polymorphic_string

Module polymorphic_string 

Source
Expand description

Runtime fixed-capacity string where the user can provide a stateful allocator. String implementation with a polymorphic stateful allocator.

§Example


use iceoryx2_bb_elementary_traits::allocator::*;
use iceoryx2_bb_container::string::*;




let allocator = SomeAllocator::new();
let capacity: usize = 123;
let mut my_str =
    PolymorphicString::<SomeAllocator>::new(&allocator, capacity)?;

my_str.push_bytes(b"all glory to the hypnotoad"); // returns false, when capacity is exceeded

Structs§

PolymorphicString
Runtime fixed-size string variant with a polymorphic allocator, meaning an allocator with a state can be attached to the string instead of using a stateless allocator like the heap-allocator.