mirror of
https://github.com/Noratrieb/elven-forest.git
synced 2026-01-16 03:25:02 +01:00
readelf
This commit is contained in:
parent
478a3c15e1
commit
98eaa92612
6 changed files with 263 additions and 3 deletions
|
|
@ -27,6 +27,18 @@ macro_rules! const_group_with_fmt {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for $struct_name {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self.0 {
|
||||
$(
|
||||
$value => f.write_str(stringify!($name)),
|
||||
)*
|
||||
a => write!(f, "{}({a})", $group_name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
impl PartialEq<$ty> for $struct_name {
|
||||
fn eq(&self, other: &$ty) -> bool {
|
||||
self.0 == *other
|
||||
|
|
|
|||
|
|
@ -9,15 +9,27 @@ use crate::{
|
|||
};
|
||||
use bstr::BStr;
|
||||
|
||||
use std::{fmt::Debug, mem, string};
|
||||
use std::{fmt::{Debug, Display}, mem, string};
|
||||
|
||||
use bytemuck::{Pod, PodCastError, Zeroable};
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Zeroable, Pod)]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Zeroable, Pod)]
|
||||
#[repr(transparent)]
|
||||
|
||||
pub struct Addr(pub u64);
|
||||
|
||||
impl Debug for Addr {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{:x}", self.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for Addr {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{:x}", self.0)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Zeroable, Pod)]
|
||||
#[repr(transparent)]
|
||||
pub struct Offset(pub u64);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue