Struct parser_database::ast::Enum

source ·
pub struct Enum {
    pub name: Identifier,
    pub values: Vec<EnumValue>,
    pub attributes: Vec<Attribute>,
    pub span: Span,
    pub inner_span: Span,
    /* private fields */
}
Expand description

An enum declaration. Enumeration can either be in the database schema, or completely a Prisma level concept.

PostgreSQL stores enums in a schema, while in MySQL the information is in the table definition. On MongoDB the enumerations are handled in the Query Engine.

Fields§

§name: Identifier

The name of the enum.

enum Foo { ... }
     ^^^
§values: Vec<EnumValue>

The values of the enum.

enum Foo {
  Value1
  ^^^^^^
  Value2
  ^^^^^^
}
§attributes: Vec<Attribute>

The attributes of this enum.

enum Foo {
  Value1
  Value2

  @@map("1Foo")
  ^^^^^^^^^^^^^
}
§span: Span

The location of this enum in the text representation.

§inner_span: Span

The span of the inner contents.

Implementations§

Trait Implementations§

source§

impl Clone for Enum

source§

fn clone(&self) -> Enum

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Enum

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Index<EnumValueId> for Enum

§

type Output = EnumValue

The returned type after indexing.
source§

fn index(&self, index: EnumValueId) -> &<Enum as Index<EnumValueId>>::Output

Performs the indexing (container[index]) operation. Read more
source§

impl WithAttributes for Enum

source§

fn attributes(&self) -> &[Attribute]

The attributes.
source§

impl WithDocumentation for Enum

source§

fn documentation(&self) -> Option<&str>

The documentation string, if defined.
source§

impl WithIdentifier for Enum

source§

fn identifier(&self) -> &Identifier

The identifier.
source§

impl WithSpan for Enum

source§

fn span(&self) -> Span

The span of the node.

Auto Trait Implementations§

§

impl RefUnwindSafe for Enum

§

impl Send for Enum

§

impl Sync for Enum

§

impl Unpin for Enum

§

impl UnwindSafe for Enum

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithName for Twhere T: WithIdentifier,

source§

fn name(&self) -> &str

The name token of the node.