pub struct HookMask { /* private fields */ }Expand description
Structure representing a Lua event mask.
This is used in Lua debug hooks.
Implementations§
Source§impl HookMask
impl HookMask
pub const INT_CALL: c_int = 1i32
pub const INT_RETURN: c_int = 2i32
pub const INT_LINE: c_int = 4i32
pub const INT_COUNT: c_int = 8i32
Sourcepub const unsafe fn from_c_int_unchecked(mask: c_int) -> Self
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());
}Sourcepub const fn from_c_int(mask: c_int) -> Self
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.
Sourcepub const fn into_c_int(self) -> c_int
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);Sourcepub const fn with_calls(self) -> Self
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
);Sourcepub const fn with_returns(self) -> Self
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
);Sourcepub const fn with_lines(self) -> Self
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
);Sourcepub const fn with_instructions(self) -> Self
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 Ord for HookMask
impl Ord for HookMask
Source§impl PartialOrd for HookMask
impl PartialOrd for HookMask
impl Copy for HookMask
impl Eq for HookMask
impl StructuralPartialEq for HookMask
Auto Trait Implementations§
impl Freeze for HookMask
impl RefUnwindSafe for HookMask
impl Send for HookMask
impl Sync for HookMask
impl Unpin for HookMask
impl UnwindSafe for HookMask
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