use crate::format::constants::{SegmentFlags, VmProtection};
use crate::model::addr::{ThinFileOffset, Va};
use crate::model::names::SegmentName;
use crate::model::section::Section;
#[derive(Debug, Clone)]
pub struct Segment {
pub(crate) name: SegmentName,
pub(crate) vm_addr: Va,
pub(crate) vm_size: u64,
pub(crate) file_offset: ThinFileOffset,
pub(crate) file_size: u64,
pub(crate) max_prot: VmProtection,
pub(crate) init_prot: VmProtection,
pub(crate) flags: SegmentFlags,
pub(crate) sections: Vec<Section>,
}
impl Segment {
pub const fn name(&self) -> &SegmentName {
&self.name
}
pub const fn vm_addr(&self) -> Va {
self.vm_addr
}
pub const fn vm_size(&self) -> u64 {
self.vm_size
}
pub const fn file_offset(&self) -> ThinFileOffset {
self.file_offset
}
pub const fn file_size(&self) -> u64 {
self.file_size
}
pub const fn max_prot(&self) -> VmProtection {
self.max_prot
}
pub const fn init_prot(&self) -> VmProtection {
self.init_prot
}
pub const fn flags(&self) -> SegmentFlags {
self.flags
}
pub fn sections(&self) -> &[Section] {
&self.sections
}
}