Trait noneifempty::NoneIfEmpty[][src]

pub trait NoneIfEmpty where
    Self: Sized
{ type Output; fn none_if_empty(self) -> Option<Self::Output>; }
Expand description

Trait for converting an empty T to None

Associated Types

Loading content...

Required methods

fn none_if_empty(self) -> Option<Self::Output>[src]

Loading content...

Implementations on Foreign Types

impl<N: NoneIfEmpty> NoneIfEmpty for Option<N>[src]

Automatically implement NoneIfEmpty for Option<T: NoneIfEmpty>

This is basically a flatten

type Output = <N as NoneIfEmpty>::Output

fn none_if_empty(self) -> Option<Self::Output>[src]

impl<'s> NoneIfEmpty for &'s str[src]

Converts a &str to None if empty

type Output = &'s str

fn none_if_empty(self) -> Option<&'s str>[src]

impl NoneIfEmpty for String[src]

Converts a String to None if empty

impl<T> NoneIfEmpty for Vec<T>[src]

Converts a Vec to None if empty

type Output = Self

fn none_if_empty(self) -> Option<Self::Output>[src]

impl<K, V> NoneIfEmpty for HashMap<K, V>[src]

Converts a HashMap to None if empty

type Output = Self

fn none_if_empty(self) -> Option<Self::Output>[src]

impl<T> NoneIfEmpty for HashSet<T>[src]

Converts a HashSet to None if empty

type Output = Self

fn none_if_empty(self) -> Option<Self::Output>[src]

Loading content...

Implementors

Loading content...