Skip to main content

CEnum

Trait CEnum 

Source
pub trait CEnum: Sized {
    // Required methods
    fn from_i32(value: i32) -> Option<Self>;
    fn to_i32(&self) -> i32;
}
Expand description

A C-style enum: an i32 discriminant at the C ABI and inside value buffers. The #[weaveffi::module] expansion implements it for every #[repr(i32)] #[weaveffi::enumeration].

Required Methods§

Source

fn from_i32(value: i32) -> Option<Self>

The variant whose discriminant is value, or None when no variant has it.

Source

fn to_i32(&self) -> i32

This variant’s discriminant.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§