Struct HookMask

Source
pub struct HookMask { /* private fields */ }
Expand description

Structure representing a Lua event mask.

This is used in Lua debug hooks.

Implementations§

Source§

impl HookMask

Source

pub const INT_CALL: c_int = 1i32

Source

pub const INT_RETURN: c_int = 2i32

Source

pub const INT_LINE: c_int = 4i32

Source

pub const INT_COUNT: c_int = 8i32

Source

pub const fn empty() -> Self

Construct a HookMask with no events that are listened for.

§Examples
use lunka::cdef::HookMask;
assert_eq!(HookMask::empty().into_c_int(), 0);
Source

pub const unsafe fn from_c_int_unchecked(mask: c_int) -> Self

Create an instance of this structure using an already-known integer mask.

§Safety

The mask must be valid for lua_sethook.

§Examples
use lunka::cdef::HookMask;
unsafe {
	assert_eq!(HookMask::from_c_int_unchecked(0), HookMask::empty());
}
Source

pub const fn from_c_int(mask: c_int) -> Self

Create an instance of this structure using an already-known integer mask, and process the mask to only have bits that are valid.

Source

pub const fn into_c_int(self) -> c_int

Consume this structure and return its underlying mask integer.

§Examples
use lunka::cdef::HookMask;
assert_eq!(HookMask::empty().into_c_int(), 0);
Source

pub const fn with_calls(self) -> Self

Consume this structure, including in it a flag for function calls.

§Examples
use lunka::cdef::HookMask;
assert_eq!(
	HookMask::empty().with_calls().into_c_int(),
	HookMask::INT_CALL
);
Source

pub const fn with_returns(self) -> Self

Consume this structure, including in it a flag for function returns.

§Examples
use lunka::cdef::HookMask;
assert_eq!(
	HookMask::empty().with_returns().into_c_int(),
	HookMask::INT_RETURN
);
Source

pub const fn with_lines(self) -> Self

Consume this structure, including in it a flag for advancing lines.

§Examples
use lunka::cdef::HookMask;
assert_eq!(
	HookMask::empty().with_lines().into_c_int(),
	HookMask::INT_LINE
);
Source

pub const fn with_instructions(self) -> Self

Consume this structure, including in it a flag for advancing instructions.

§Examples
use lunka::cdef::HookMask;
assert_eq!(
	HookMask::empty().with_instructions().into_c_int(),
	HookMask::INT_COUNT
);

instructions.

Trait Implementations§

Source§

impl Clone for HookMask

Source§

fn clone(&self) -> HookMask

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 HookMask

Source§

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

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

impl Default for HookMask

Source§

fn default() -> HookMask

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

impl Ord for HookMask

Source§

fn cmp(&self, other: &HookMask) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for HookMask

Source§

fn eq(&self, other: &HookMask) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for HookMask

Source§

fn partial_cmp(&self, other: &HookMask) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Copy for HookMask

Source§

impl Eq for HookMask

Source§

impl StructuralPartialEq for HookMask

Auto Trait Implementations§

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.