Skip to main content

HybridType

Enum HybridType 

Source
pub enum HybridType {
Show 24 variants Void, Bool, U8, U16, Usize, I32, U32, I64, U64, F32, F64, String, Bytes, Optional(Box<HybridType>), Vec(Box<HybridType>), Result { ok: Box<HybridType>, err: Box<HybridType>, }, Struct(String), Enum(String), Value, ModStatus, ConstPtr(Box<HybridType>), MutPtr(Box<HybridType>), FixedArray { elem: Box<HybridType>, len: usize, }, Handle(String),
}
Expand description

Rich typed system shared across Hybrid modules, views, structs, enums, and events.

Variants§

§

Void

§

Bool

§

U8

§

U16

§

Usize

§

I32

§

U32

§

I64

§

U64

§

F32

§

F64

§

String

§

Bytes

§

Optional(Box<HybridType>)

§

Vec(Box<HybridType>)

§

Result

§

Struct(String)

§

Enum(String)

§

Value

§

ModStatus

§

ConstPtr(Box<HybridType>)

§

MutPtr(Box<HybridType>)

§

FixedArray

Fields

§len: usize
§

Handle(String)

Implementations§

Source§

impl HybridType

Source

pub fn canonical_signature(&self) -> String

Canonical deterministic type signature used for XXH64 schema hashing.

Source

pub fn is_pod(&self, file: &HybridFileSpec) -> bool

True if this type is a fixed-size C-ABI scalar or POD struct that can be passed directly by value across C11/C++20/Rust/Swift/Dart FFI without serialization.

Source

pub fn supports_eq_and_hash(&self, file: &HybridFileSpec) -> bool

True if the generated Rust type supports deriving Eq and Hash transitively.

Source

pub fn supports_default(&self, file: &HybridFileSpec) -> bool

True if the generated Rust type supports deriving or synthesizing Default transitively.

Source

pub fn fixed_array_dims(&self) -> (Vec<usize>, &HybridType)

The dimensions of a (nested) [T; N], outermost first, and its innermost element: [[u32; 2]; 3] is ([3, 2], u32); any other type is ([], self).

Source

pub fn is_result(&self) -> bool

True if this type is a Result<_, _>.

Source

pub fn collect_refs( &self, structs: &mut BTreeSet<String>, enums: &mut BTreeSet<String>, )

Collects all referenced user struct and enum names into structs and enums.

Source

pub fn pod_opt_suffix(&self) -> Option<Cow<'static, str>>

Deterministic C-ABI option wrapper suffix for POD optional types (Optional<T>). Returns Some("I64"), Some("Vec2"), etc. when self is a POD inner type.

Source

pub fn pod_opt_suffix_for( &self, file: &HybridFileSpec, ) -> Option<Cow<'static, str>>

Returns the deterministic C-ABI option wrapper suffix if and only if self is a valid POD type in file with a direct NvHybridOpt<Suffix> representation.

Source

pub fn optional_pod_suffix( &self, file: &HybridFileSpec, ) -> Option<Cow<'static, str>>

Returns the deterministic C-ABI option wrapper suffix if and only if self is HybridType::Optional(inner) where inner is a valid POD type in file.

Trait Implementations§

Source§

impl Clone for HybridType

Source§

fn clone(&self) -> HybridType

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for HybridType

Source§

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

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

impl Eq for HybridType

Source§

impl Hash for HybridType

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for HybridType

Source§

fn eq(&self, other: &HybridType) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for HybridType

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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 T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.