Struct auxtools::Proc

source ·
pub struct Proc {
    pub id: ProcId,
    pub entry: *mut ProcEntry,
    pub path: String,
}
Expand description

Used to hook and call procs.

Fields§

§id: ProcId§entry: *mut ProcEntry§path: String

Implementations§

source§

impl Proc

source

pub fn hook( &self, func: fn(_: &Value, _: &Value, _: Vec<Value>) -> DMResult ) -> Result<(), HookFailure>

source§

impl Proc

source

pub fn find<S: Into<String>>(path: S) -> Option<Self>

Finds the first proc with the given path

source

pub fn find_override<S: Into<String>>(path: S, override_id: u32) -> Option<Self>

Finds the n’th re-defined proc with the given path

source

pub fn from_id(id: ProcId) -> Option<Self>

source

pub unsafe fn file_name(&self) -> Option<StringRef>

source

pub fn parameter_names(&self) -> Vec<StringRef>

source

pub fn local_names(&self) -> Vec<StringRef>

source

pub fn set_bytecode(&self, bytecode: Vec<u32>)

source

pub unsafe fn bytecode_mut_ptr(&self) -> (*mut u32, u16)

source

pub unsafe fn bytecode(&self) -> &[u32]

source

pub fn call(&self, args: &[&Value]) -> DMResult

Calls a global proc with the given arguments.

Examples

This function is equivalent to return do_explode(3) in DM.

#[hook("/proc/my_proc")]
fn my_proc_hook() -> DMResult {
    let proc = Proc::find("/proc/do_explode").unwrap();
    proc.call(&[&Value::from(3.0)])
}
source

pub fn override_id(&self) -> u32

Trait Implementations§

source§

impl Clone for Proc

source§

fn clone(&self) -> Proc

Returns a copy 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 Proc

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Proc

§

impl !Send for Proc

§

impl !Sync for Proc

§

impl Unpin for Proc

§

impl UnwindSafe for Proc

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.