LCOV - code coverage report
Current view: top level - src/pdb/types - attribute.rs (source / functions) Coverage Total Hit
Test: lief.lcov Lines: 0.0 % 22 0
Test Date: 2024-10-27:00:00:00 Functions: 0.0 % 5 0

            Line data    Source code
       1              : use lief_ffi as ffi;
       2              : 
       3              : use crate::common::FromFFI;
       4              : use std::marker::PhantomData;
       5              : 
       6              : use crate::pdb::Type;
       7              : use crate::common::into_optional;
       8              : use crate::declare_fwd_iterator;
       9              : 
      10              : /// This class represents an attribute (`LF_MEMBER`) in an aggregate (class,
      11              : /// struct, union, ...)
      12              : pub struct Attribute<'a> {
      13              :     ptr: cxx::UniquePtr<ffi::PDB_types_Attribute>,
      14              :     _owner: PhantomData<&'a ()>,
      15              : }
      16              : 
      17              : impl FromFFI<ffi::PDB_types_Attribute> for Attribute<'_> {
      18            0 :     fn from_ffi(cmd: cxx::UniquePtr<ffi::PDB_types_Attribute>) -> Self {
      19            0 :         Self {
      20            0 :             ptr: cmd,
      21            0 :             _owner: PhantomData,
      22            0 :         }
      23            0 :     }
      24              : }
      25              : 
      26              : impl Attribute<'_> {
      27              :     /// Name of the attribute
      28            0 :     pub fn name(&self) -> String {
      29            0 :         self.ptr.name().to_string()
      30            0 :     }
      31              : 
      32              :     /// Offset of this attribute in the aggregate
      33            0 :     pub fn field_offset(&self) -> u64 {
      34            0 :         self.ptr.field_offset()
      35            0 :     }
      36              : 
      37              :     /// Type of this attribute
      38            0 :     pub fn get_type(&self) -> Option<Type> {
      39            0 :         into_optional(self.ptr.get_type())
      40            0 :     }
      41              : }
      42              : 
      43            0 : declare_fwd_iterator!(
      44            0 :     Attributes,
      45            0 :     Attribute<'a>,
      46            0 :     ffi::PDB_types_Attribute,
      47            0 :     ffi::PDB_types_ClassLike,
      48            0 :     ffi::PDB_types_ClassLike_it_attributes
      49            0 : );
      50              : 
      51              : 
        

Generated by: LCOV version 2.1-1