Trait IfEmpty

Source
pub trait IfEmpty {
    // Required method
    fn if_empty(self, val: Self) -> Self;
}
Expand description

For checking IfEmpty on value semantics

Required Methods§

Source

fn if_empty(self, val: Self) -> Self

Returns val if the self is empty

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 IfEmpty for String

Implementation of IfEmpty for String

Source§

fn if_empty(self, input: Self) -> Self

Returns input if String::is_empty() returns true. Otherwise self is returned.

Source§

impl IfEmpty for OsString

Implementation of IfEmpty for OsString

Source§

fn if_empty(self, input: Self) -> Self

Returns input if OsString::is_empty() returns true. Otherwise self is returned.

Implementors§