LCOV - code coverage report
Current view: top level - src/macho/commands - atom_info.rs (source / functions) Coverage Total Hit
Test: lief.lcov Lines: 0.0 % 26 0
Test Date: 2025-01-11:00:00:00 Functions: 0.0 % 6 0

            Line data    Source code
       1              : use super::Command;
       2              : use crate::common::FromFFI;
       3              : use crate::to_slice;
       4              : use lief_ffi as ffi;
       5              : use std::marker::PhantomData;
       6              : 
       7              : /// Structure which represents the `LC_ATOM_INFO` command
       8              : pub struct AtomInfo<'a> {
       9              :     ptr: cxx::UniquePtr<ffi::MachO_AtomInfo>,
      10              :     _owner: PhantomData<&'a ffi::MachO_Binary>,
      11              : }
      12              : 
      13              : impl AtomInfo<'_> {
      14              :     /// Offset in the `__LINKEDIT` segment where the payload is located
      15            0 :     pub fn data_offset(&self) -> u32 {
      16            0 :         self.ptr.data_offset()
      17            0 :     }
      18              : 
      19              :     /// Size of the payload
      20            0 :     pub fn data_size(&self) -> u32 {
      21            0 :         self.ptr.data_size()
      22            0 :     }
      23              : 
      24              :     /// Raw payload as a slice of bytes
      25            0 :     pub fn content(&self) -> &[u8] {
      26            0 :         to_slice!(self.ptr.content());
      27            0 :     }
      28              : }
      29              : 
      30              : impl std::fmt::Debug for AtomInfo<'_> {
      31            0 :     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
      32            0 :         let base = self as &dyn Command;
      33            0 :         f.debug_struct("AtomInfo")
      34            0 :             .field("base", &base)
      35            0 :             .field("data_offset", &self.data_offset())
      36            0 :             .field("data_size", &self.data_size())
      37            0 :             .finish()
      38            0 :     }
      39              : }
      40              : 
      41              : impl FromFFI<ffi::MachO_AtomInfo> for AtomInfo<'_> {
      42            0 :     fn from_ffi(cmd: cxx::UniquePtr<ffi::MachO_AtomInfo>) -> Self {
      43            0 :         Self {
      44            0 :             ptr: cmd,
      45            0 :             _owner: PhantomData,
      46            0 :         }
      47            0 :     }
      48              : }
      49              : 
      50              : impl Command for AtomInfo<'_> {
      51            0 :     fn get_base(&self) -> &ffi::MachO_Command {
      52            0 :         self.ptr.as_ref().unwrap().as_ref()
      53            0 :     }
      54              : }
        

Generated by: LCOV version 2.1-1