Skip to main content

StringLike

Trait StringLike 

Source
pub trait StringLike: Sealed + Sized {
    // Required method
    fn increment(self) -> Result<Self, Self>;
}
Expand description

Types that can hold a valid UTF-8 string.

Required Methods§

Source

fn increment(self) -> Result<Self, Self>

Replace the last codepoint in the string with the next codepoint.

This operation will attempt to reuse the original memory.

If incrementing the last char fails, or if the string is empty, we return an Err with the original unmodified string.

§Errors

Returns Err(self) if the string is empty or if incrementing the last char overflows.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl StringLike for String

Source§

impl StringLike for BufferString

Implementors§