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 :
7 : use crate::dwarf::Type;
8 :
9 : /// This class represents a `DW_TAG_array_type`
10 : pub struct Array<'a> {
11 : ptr: cxx::UniquePtr<ffi::DWARF_types_Array>,
12 : _owner: PhantomData<&'a ()>,
13 : }
14 :
15 : impl FromFFI<ffi::DWARF_types_Array> for Array<'_> {
16 0 : fn from_ffi(cmd: cxx::UniquePtr<ffi::DWARF_types_Array>) -> Self {
17 0 : Self {
18 0 : ptr: cmd,
19 0 : _owner: PhantomData,
20 0 : }
21 0 : }
22 : }
23 :
24 : impl Array<'_> {
25 : /// The underlying type of this array
26 0 : pub fn underlying_type(&self) -> Option<Type> {
27 0 : into_optional(self.ptr.underlying_type())
28 0 : }
29 : }
30 :
31 : impl DwarfType for Array<'_> {
32 0 : fn get_base(&self) -> &ffi::DWARF_Type {
33 0 : self.ptr.as_ref().unwrap().as_ref()
34 0 : }
35 : }
|