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

Generated by: LCOV version 2.1-1