pub trait NonEmptyOrExt: Sized {
// Required method
fn nonempty_or_else(self, default: impl FnOnce() -> Self) -> Self;
// Provided method
fn nonempty_or(self, value: Self) -> Self { ... }
}Expand description
Extension trait for owned strings providing an empty-string fallback.
Required Methods§
Sourcefn nonempty_or_else(self, default: impl FnOnce() -> Self) -> Self
fn nonempty_or_else(self, default: impl FnOnce() -> Self) -> Self
Same as Self::nonempty_or but takes a factory function.
Provided Methods§
Sourcefn nonempty_or(self, value: Self) -> Self
fn nonempty_or(self, value: Self) -> Self
Return the string if it is non-empty, otherwise value.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".