Consts

Struct Consts 

Source
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

Source

pub fn new(consts: Vec<Const>) -> Self

Source

pub fn find_sysno(&self, name: &str, arch: &Arch) -> Option<usize>

Try and resolve a system call number by name, like write

Source

pub fn find_sysno_for_any(&self, name: &str) -> Vec<Const>

Source

pub fn all_consts_matching(&self, value: u64, arch: &Arch) -> Vec<Const>

Source

pub fn consts(&self) -> Iter<'_, Const>

Iterate over all the consts

Source

pub fn push(&mut self, c: Const)

Push new value without checking if this element is new

Source

pub fn find_name_arch(&self, name: &str, arch: &Arch) -> Option<&Const>

Find value based on name and architecture

Source

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.

Source

pub fn create_from_file(&mut self, p: &Path) -> Result<(), Error>

Parse constants from file

Source

pub fn create_from_str(s: &str, arch: Option<Arch>) -> Result<Vec<Const>, Error>

Create constants from string

Source

pub fn add_if_new(&mut self, c: Const) -> bool

Same as Self::push, but only add if the element is unique

Source

pub fn add_vec(&mut self, consts: Vec<Const>) -> usize

Add from a vector, uses Self::add_if_new on each element

Source

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 Clone for Consts

Source§

fn clone(&self) -> Consts

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Consts

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Consts

Source§

fn default() -> Consts

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Consts

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Consts

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,