Skip to main content

EnumModel

Trait EnumModel 

Source
pub trait EnumModel:
    Sized
    + Send
    + Sync
    + 'static {
    const NAME: &'static str;

    // Required methods
    fn values() -> Vec<EnumValue>;
    fn value_name(&self) -> &'static str;
    fn from_name(name: &str) -> Option<Self>;

    // Provided method
    fn description() -> Option<&'static str> { ... }
}
Expand description

A Rust enum that is a GraphQL enum.

Implemented by #[derive(Enum)].

Required Associated Constants§

Source

const NAME: &'static str

The GraphQL type name.

Required Methods§

Source

fn values() -> Vec<EnumValue>

Every value, in declaration order.

Source

fn value_name(&self) -> &'static str

The GraphQL name of this value.

Source

fn from_name(name: &str) -> Option<Self>

Look up a value by its GraphQL name.

Provided Methods§

Source

fn description() -> Option<&'static str>

The type’s description, if any.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§