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

Generated by: LCOV version 2.1-1