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: 2025-06-24:00:00:00 Functions: 100.0 % 6 6

            Line data    Source code
       1              : use super::Command;
       2              : use lief_ffi as ffi;
       3              : use crate::common::FromFFI;
       4              : use crate::to_slice;
       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              : 
      15              : impl SegmentSplitInfo<'_> {
      16           96 :     pub fn data_offset(&self) -> u32 {
      17           96 :         self.ptr.data_offset()
      18           96 :     }
      19           96 :     pub fn data_size(&self) -> u32 {
      20           96 :         self.ptr.data_size()
      21           96 :     }
      22           48 :     pub fn content(&self) -> &[u8] {
      23           48 :         to_slice!(self.ptr.content());
      24           48 :     }
      25              : }
      26              : 
      27              : impl std::fmt::Debug for SegmentSplitInfo<'_> {
      28           96 :     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
      29           96 :         let base = self as &dyn Command;
      30           96 :         f.debug_struct("SegmentSplitInfo")
      31           96 :             .field("base", &base)
      32           96 :             .field("data_offset", &self.data_offset())
      33           96 :             .field("data_size", &self.data_size())
      34           96 :             .finish()
      35           96 :     }
      36              : }
      37              : 
      38              : impl<'a> FromFFI<ffi::MachO_SegmentSplitInfo> for SegmentSplitInfo<'a> {
      39           96 :     fn from_ffi(cmd: cxx::UniquePtr<ffi::MachO_SegmentSplitInfo>) -> Self {
      40           96 :         Self {
      41           96 :             ptr: cmd,
      42           96 :             _owner: PhantomData
      43           96 :         }
      44           96 :     }
      45              : }
      46              : 
      47              : impl Command for SegmentSplitInfo<'_> {
      48          384 :     fn get_base(&self) -> &ffi::MachO_Command {
      49          384 :         self.ptr.as_ref().unwrap().as_ref()
      50          384 :     }
      51              : }
      52              : 
        

Generated by: LCOV version 2.1-1