Line data Source code
1 : use lief_ffi as ffi;
2 :
3 : use crate::common::{into_optional, FromFFI};
4 : use std::marker::PhantomData;
5 : use crate::dwarf::types::DwarfType;
6 : use crate::dwarf::Type;
7 :
8 : /// This structure represents a `DW_TAG_restrict_type`
9 : pub struct Restrict<'a> {
10 : ptr: cxx::UniquePtr<ffi::DWARF_types_Restrict>,
11 : _owner: PhantomData<&'a ()>,
12 : }
13 :
14 : impl FromFFI<ffi::DWARF_types_Restrict> for Restrict<'_> {
15 0 : fn from_ffi(ptr: cxx::UniquePtr<ffi::DWARF_types_Restrict>) -> Self {
16 0 : Self {
17 0 : ptr,
18 0 : _owner: PhantomData,
19 0 : }
20 0 : }
21 : }
22 :
23 : impl DwarfType for Restrict<'_> {
24 0 : fn get_base(&self) -> &ffi::DWARF_Type {
25 0 : self.ptr.as_ref().unwrap().as_ref()
26 0 : }
27 : }
28 :
29 : impl Restrict<'_> {
30 : /// The underlying type referenced by this restrict-type.
31 0 : pub fn underlying_type(&self) -> Option<Type> {
32 0 : into_optional(self.ptr.underlying_type())
33 0 : }
34 : }
35 :
36 :
|