struct BaseDtype {
scalar: Option<TypeSpecifier>,
size_modifiers: Vec<TypeSpecifier>,
signed_option: Option<TypeSpecifier>,
typedef_name: Option<String>,
struct_type: Option<StructType>,
is_const: bool,
is_typedef: bool,
}
Fields§
§scalar: Option<TypeSpecifier>
§size_modifiers: Vec<TypeSpecifier>
§signed_option: Option<TypeSpecifier>
§typedef_name: Option<String>
§struct_type: Option<StructType>
§is_const: bool
§is_typedef: bool
Implementations§
Source§impl BaseDtype
impl BaseDtype
Sourcefn apply_storage_class(
&mut self,
storage_class: &StorageClassSpecifier,
) -> Result<(), DtypeError>
fn apply_storage_class( &mut self, storage_class: &StorageClassSpecifier, ) -> Result<(), DtypeError>
Apply StorageClassSpecifier
to BaseDtype
.
Let’s say declaration is typedef int i32_t;
, if self
represents int
and
type_qualifier
represents typedef
, self
is transformed to representing typedef int
.
§Arguments
self
- Part that has been converted to ‘BaseDtype’ on the declaration.storage_class
- storage class requiring to apply to ‘self’ immediately.
Sourcefn apply_type_specifier(
&mut self,
type_specifier: &TypeSpecifier,
) -> Result<(), DtypeError>
fn apply_type_specifier( &mut self, type_specifier: &TypeSpecifier, ) -> Result<(), DtypeError>
Apply TypeSpecifier
to BaseDtype
.
Let’s say the declaration is const int a;
, if self
represents int
and
type_specifier
represents const
, self
is transformed to representing const int
.
§Arguments
self
- Part that has been converted to ‘BaseDtype’ on the declaration.type_qualifier
- type qualifiers requiring to apply to ‘self’ immediately.
Sourcefn apply_type_qualifier(
&mut self,
type_qualifier: &TypeQualifier,
) -> Result<(), DtypeError>
fn apply_type_qualifier( &mut self, type_qualifier: &TypeQualifier, ) -> Result<(), DtypeError>
Apply Typequalifier
to BaseDtype
.
Let’s say the declaration is const int a;
, if self
represents int
and type_qualifier
represents const
, self
is transformed to representing const int
.
§Arguments
self
- Part that has been converted to ‘BaseDtype’ on the declaration.type_qualifier
- type qualifiers requiring to apply to ‘self’ immediately.
pub(crate) fn apply_specifier_qualifier( &mut self, typename_specifier: &SpecifierQualifier, ) -> Result<(), DtypeError>
pub(crate) fn apply_declaration_specifier( &mut self, declaration_specifier: &DeclarationSpecifier, ) -> Result<(), DtypeError>
Sourcepub(crate) fn apply_pointer_qualifier(
&mut self,
pointer_qualifier: &PointerQualifier,
) -> Result<(), DtypeError>
pub(crate) fn apply_pointer_qualifier( &mut self, pointer_qualifier: &PointerQualifier, ) -> Result<(), DtypeError>
Apply PointerQualifier
to BaseDtype
.
let’s say pointer declarator is * const
of const int * const a;
. If self
represents
nothing, and pointer_qualifier
represents const
between the first and second asterisk,
self
is transformed to representing const
. This information is used later when
generating Dtype
.
§Arguments
self
- Part that has been converted to ‘BaseDtype’ on the pointer declarator.pointer_qualifier
- Pointer qualifiers required to apply to ‘BaseDtype’ immediately.
pub(crate) fn apply_specifier_qualifiers( &mut self, typename_specifiers: &[Node<SpecifierQualifier>], ) -> Result<(), DtypeError>
pub(crate) fn apply_declaration_specifiers( &mut self, declaration_specifiers: &[Node<DeclarationSpecifier>], ) -> Result<(), DtypeError>
Trait Implementations§
Source§impl TryFrom<BaseDtype> for Dtype
impl TryFrom<BaseDtype> for Dtype
Source§fn try_from(spec: BaseDtype) -> Result<Self, DtypeError>
fn try_from(spec: BaseDtype) -> Result<Self, DtypeError>
Derive a data type containing scalar type from specifiers.
§Example
For declaration is const unsigned int * p
, specifiers
is const unsigned int
, and the
result is Dtype::Int { width: 4, is_signed: false, is_const: true }
.
Source§type Error = DtypeError
type Error = DtypeError
Auto Trait Implementations§
impl Freeze for BaseDtype
impl RefUnwindSafe for BaseDtype
impl Send for BaseDtype
impl Sync for BaseDtype
impl Unpin for BaseDtype
impl UnwindSafe for BaseDtype
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more