Skip to main content

HybridStructSpec

Struct HybridStructSpec 

Source
pub struct HybridStructSpec {
    pub name: String,
    pub fields: Vec<HybridFieldSpec>,
    pub doc: Option<String>,
    pub is_union: bool,
    pub align: Option<usize>,
    pub expected_size: Option<usize>,
    pub expected_size_64: Option<usize>,
    pub no_default: bool,
}
Expand description

Structured record declared with #[nv_hybrid_struct] or #[nv_hybrid_union].

Fields§

§name: String§fields: Vec<HybridFieldSpec>§doc: Option<String>§is_union: bool

True when declared as #[nv_hybrid_union] pub union ....

§align: Option<usize>

Optional explicit #[repr(C, align(N))] alignment descriptor.

§expected_size: Option<usize>

Optional exact target-independent byte size (#[nv_hybrid_struct(size = N)]).

§expected_size_64: Option<usize>

Optional exact 64-bit byte size (#[nv_hybrid_struct(size_64 = N)]).

§no_default: bool

When true (#[nv_hybrid_struct(default = false)]), omit Rust Default derive/impl so the owning crate can supply a domain-specific Default implementation.

Implementations§

Source§

impl HybridStructSpec

Source

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

Returns true if all fields (transitively) are fixed-size C-ABI scalars/enums/POD structs.

Source

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

Returns true if every field (transitively) implements Rust Eq and Hash (i.e. contains no f32, f64, dynamic Value, raw pointer, handle, or union).

Source

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

Returns true if this struct and every transitive field type support Rust Default generation (i.e. neither this struct nor any transitive nested struct sets default = false, and no field is a union, NvModStatus, Result, raw pointer, or handle).

Trait Implementations§

Source§

impl Clone for HybridStructSpec

Source§

fn clone(&self) -> HybridStructSpec

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 HybridStructSpec

Source§

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

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

impl Default for HybridStructSpec

Source§

fn default() -> HybridStructSpec

Returns the “default value” for a type. Read more
Source§

impl Eq for HybridStructSpec

Source§

impl PartialEq for HybridStructSpec

Source§

fn eq(&self, other: &HybridStructSpec) -> 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 HybridStructSpec

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.