Iterable

Trait Iterable 

Source
pub trait Iterable: Sized {
    type Iterator: Iterator<Item = Self> + Clone + DoubleEndedIterator + ExactSizeIterator + FusedIterator;

    // Required method
    fn iter() -> Self::Iterator;
}
Expand description

This trait designates that an Enum can be iterated over. It can be auto generated using the EnumIter derive macro.

ยงExample

// You need to bring the type into scope to use it!!!
use strum::{EnumIter, IntoEnumIterator};

#[derive(EnumIter, Debug)]
enum Color {
    Red,
    Green { range: usize },
    Blue(usize),
    Yellow,
}

// Iterate over the items in an enum and perform some function on them.
fn generic_iterator<E, F>(pred: F)
where
    E: IntoEnumIterator,
    F: Fn(E),
{
    for e in E::iter() {
        pred(e)
    }
}

generic_iterator::<Color, _>(|color| println!("{:?}", color));

Required Associated Typesยง

Required Methodsยง

Source

fn iter() -> Self::Iterator

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.

Implementorsยง

Sourceยง

impl IntoEnumIterator for sea_orm::rbac::entity::permission::Column

Available on crate feature rbac only.
Sourceยง

impl IntoEnumIterator for sea_orm::rbac::entity::permission::PrimaryKey

Available on crate feature rbac only.
Sourceยง

impl IntoEnumIterator for sea_orm::rbac::entity::permission::Relation

Available on crate feature rbac only.
Sourceยง

impl IntoEnumIterator for sea_orm::rbac::entity::resource::Column

Available on crate feature rbac only.
Sourceยง

impl IntoEnumIterator for sea_orm::rbac::entity::resource::PrimaryKey

Available on crate feature rbac only.
Sourceยง

impl IntoEnumIterator for sea_orm::rbac::entity::resource::Relation

Available on crate feature rbac only.
Sourceยง

impl IntoEnumIterator for sea_orm::rbac::entity::role::Column

Available on crate feature rbac only.
Sourceยง

impl IntoEnumIterator for sea_orm::rbac::entity::role::PrimaryKey

Available on crate feature rbac only.
Sourceยง

impl IntoEnumIterator for sea_orm::rbac::entity::role::Relation

Available on crate feature rbac only.
Sourceยง

impl IntoEnumIterator for sea_orm::rbac::entity::role_hierarchy::Column

Available on crate feature rbac only.
Sourceยง

impl IntoEnumIterator for sea_orm::rbac::entity::role_hierarchy::PrimaryKey

Available on crate feature rbac only.
Sourceยง

impl IntoEnumIterator for sea_orm::rbac::entity::role_hierarchy::Relation

Available on crate feature rbac only.
Sourceยง

impl IntoEnumIterator for sea_orm::rbac::entity::role_permission::Column

Available on crate feature rbac only.
Sourceยง

impl IntoEnumIterator for sea_orm::rbac::entity::role_permission::PrimaryKey

Available on crate feature rbac only.
Sourceยง

impl IntoEnumIterator for sea_orm::rbac::entity::role_permission::Relation

Available on crate feature rbac only.
Sourceยง

impl IntoEnumIterator for sea_orm::rbac::entity::user_override::Column

Available on crate feature rbac only.
Sourceยง

impl IntoEnumIterator for sea_orm::rbac::entity::user_override::PrimaryKey

Available on crate feature rbac only.
Sourceยง

impl IntoEnumIterator for sea_orm::rbac::entity::user_override::Relation

Available on crate feature rbac only.
Sourceยง

impl IntoEnumIterator for sea_orm::rbac::entity::user_role::Column

Available on crate feature rbac only.
Sourceยง

impl IntoEnumIterator for sea_orm::rbac::entity::user_role::PrimaryKey

Available on crate feature rbac only.
Sourceยง

impl IntoEnumIterator for sea_orm::rbac::entity::user_role::Relation

Available on crate feature rbac only.