StringExt

Trait StringExt 

Source
pub trait StringExt: Sized {
    // Required methods
    fn optional(&self) -> Option<&Self>;
    fn into_optional(self) -> Option<Self>;
}

Required Methods§

Source

fn optional(&self) -> Option<&Self>

Returns Some if the string has content, otherwise None.

Source

fn into_optional(self) -> Option<Self>

Returns Some if the string has content, otherwise None.

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 StringExt for &str

Source§

fn optional(&self) -> Option<&Self>

Source§

fn into_optional(self) -> Option<Self>

Source§

impl StringExt for String

Source§

fn optional(&self) -> Option<&Self>

Source§

fn into_optional(self) -> Option<Self>

Source§

impl StringExt for CompactString

Source§

fn optional(&self) -> Option<&Self>

Source§

fn into_optional(self) -> Option<Self>

Implementors§