Skip to main content

EnsureList

Trait EnsureList 

Source
pub trait EnsureList {
    type Item;

    // Required method
    fn ensure_list(self) -> Vec<Self::Item>;
}
Expand description

Ensures that a value is wrapped in a Vec if it isn’t already a collection.

This is a generic trait that can be implemented for different types.

Required Associated Types§

Required Methods§

Source

fn ensure_list(self) -> Vec<Self::Item>

Implementations on Foreign Types§

Source§

impl<T> EnsureList for Option<T>

Source§

type Item = T

Source§

fn ensure_list(self) -> Vec<Self::Item>

Source§

impl<T> EnsureList for Vec<T>

Source§

type Item = T

Source§

fn ensure_list(self) -> Vec<Self::Item>

Implementors§