pub struct Consts {
pub consts: Vec<Const>,
}
Expand description
Wrapper around a vector of Const with some helper functions.
Fields§
§consts: Vec<Const>
Implementations§
Source§impl Consts
impl Consts
pub fn new(consts: Vec<Const>) -> Self
Sourcepub fn find_sysno(&self, name: &str, arch: &Arch) -> Option<usize>
pub fn find_sysno(&self, name: &str, arch: &Arch) -> Option<usize>
Try and resolve a system call number by name, like write
pub fn find_sysno_for_any(&self, name: &str) -> Vec<Const>
pub fn all_consts_matching(&self, value: u64, arch: &Arch) -> Vec<Const>
Sourcepub fn find_name_arch(&self, name: &str, arch: &Arch) -> Option<&Const>
pub fn find_name_arch(&self, name: &str, arch: &Arch) -> Option<&Const>
Find value based on name and architecture
Sourcepub fn get_arch_from_path(file: &Path) -> Result<Option<Arch>, Error>
pub fn get_arch_from_path(file: &Path) -> Result<Option<Arch>, Error>
Architecture can be specified on the filename, like:
<name>_amd64.const
. This function tries to extract it.
Sourcepub fn create_from_str(s: &str, arch: Option<Arch>) -> Result<Vec<Const>, Error>
pub fn create_from_str(s: &str, arch: Option<Arch>) -> Result<Vec<Const>, Error>
Create constants from string
Sourcepub fn add_if_new(&mut self, c: Const) -> bool
pub fn add_if_new(&mut self, c: Const) -> bool
Same as Self::push, but only add if the element is unique
Sourcepub fn add_vec(&mut self, consts: Vec<Const>) -> usize
pub fn add_vec(&mut self, consts: Vec<Const>) -> usize
Add from a vector, uses Self::add_if_new on each element
Sourcepub fn filter_arch(&mut self, arch: &Arch)
pub fn filter_arch(&mut self, arch: &Arch)
Remove all consts not relevant for the specified architecture.
Not necessary, but can be used to save memory.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Consts
impl<'de> Deserialize<'de> for Consts
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Consts
impl RefUnwindSafe for Consts
impl Send for Consts
impl Sync for Consts
impl Unpin for Consts
impl UnwindSafe for Consts
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more