LCOV - code coverage report
Current view: top level - src/macho/commands - segment_split_info.rs (source / functions) Coverage Total Hit
Test: lief.lcov Lines: 100.0 % 26 26
Test Date: 2026-04-12:00:00:00 Functions: 100.0 % 6 6

            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              : 
       6              : use std::marker::PhantomData;
       7              : 
       8              : /// Structure that represents the `LC_SEGMENT_SPLIT_INFO` command
       9              : pub struct SegmentSplitInfo<'a> {
      10              :     ptr: cxx::UniquePtr<ffi::MachO_SegmentSplitInfo>,
      11              :     _owner: PhantomData<&'a ffi::MachO_Binary>,
      12              : }
      13              : 
      14              : impl SegmentSplitInfo<'_> {
      15          104 :     pub fn data_offset(&self) -> u32 {
      16          104 :         self.ptr.data_offset()
      17          104 :     }
      18          104 :     pub fn data_size(&self) -> u32 {
      19          104 :         self.ptr.data_size()
      20          104 :     }
      21           52 :     pub fn content(&self) -> &[u8] {
      22           52 :         to_slice!(self.ptr.content());
      23           52 :     }
      24              : }
      25              : 
      26              : impl std::fmt::Debug for SegmentSplitInfo<'_> {
      27          104 :     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
      28          104 :         let base = self as &dyn Command;
      29          104 :         f.debug_struct("SegmentSplitInfo")
      30          104 :             .field("base", &base)
      31          104 :             .field("data_offset", &self.data_offset())
      32          104 :             .field("data_size", &self.data_size())
      33          104 :             .finish()
      34          104 :     }
      35              : }
      36              : 
      37              : impl<'a> FromFFI<ffi::MachO_SegmentSplitInfo> for SegmentSplitInfo<'a> {
      38          104 :     fn from_ffi(cmd: cxx::UniquePtr<ffi::MachO_SegmentSplitInfo>) -> Self {
      39          104 :         Self {
      40          104 :             ptr: cmd,
      41          104 :             _owner: PhantomData,
      42          104 :         }
      43          104 :     }
      44              : }
      45              : 
      46              : impl Command for SegmentSplitInfo<'_> {
      47          416 :     fn get_base(&self) -> &ffi::MachO_Command {
      48          416 :         self.ptr.as_ref().unwrap().as_ref()
      49          416 :     }
      50              : }
        

Generated by: LCOV version 2.1-1