Skip to main content

Hook

Struct Hook 

Source
pub struct Hook<'a>(/* private fields */);
Expand description

An injection point reached, as a handler sees it.

Implementations§

Source§

impl<'a> Hook<'a>

Source

pub fn new(e: &'a mut Injected) -> Self

The point reached, to be changed.

Source

pub fn this<T: Nanite>(&self) -> Option<T>

The object the method runs on (none in a static one).

Source

pub fn arg<T: Java>(&self, i: usize) -> Option<T>

Argument i.

Source

pub fn args(&self) -> usize

How many arguments there are.

Source

pub fn value<T: Java>(&self) -> Option<T>

The value returned, at a RETURN.

Source

pub fn cancel(&mut self)

Stops the method (a cancellable injection’s).

Source

pub fn set_return<T: Java>(&mut self, value: T)

Stops the method returning value.

Source

pub fn set_value<T: Java>(&mut self, value: T)

Makes value the answer: a modified value, a redirected call’s result.

Source

pub fn call_original(&self, args: Vec<Value>) -> Option<Value>

Runs a redirected call as it was, with args (the receiver first): its result.

Source

pub fn local<T: Java>(&self, i: usize) -> Option<T>

Local i of those the inject asked for.

Source

pub fn set_local<T: Java>(&mut self, i: usize, value: T)

Sets local i (one the inject asked to write: & in locals).

Source

pub fn cancelled(&self) -> bool

Whether a handler before this one stopped it.

Auto Trait Implementations§

§

impl<'a> !UnwindSafe for Hook<'a>

§

impl<'a> Freeze for Hook<'a>

§

impl<'a> RefUnwindSafe for Hook<'a>

§

impl<'a> Send for Hook<'a>

§

impl<'a> Sync for Hook<'a>

§

impl<'a> Unpin for Hook<'a>

§

impl<'a> UnsafeUnpin for Hook<'a>

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> Arg<T> for T

Source§

fn arg(self) -> T

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.