#[non_exhaustive]pub enum MetaMethod {
Show 26 variants
Add,
Sub,
Mul,
Div,
Mod,
Pow,
IDiv,
BAnd,
BOr,
BXor,
Shl,
Shr,
BNot,
Unm,
Concat,
Len,
Eq,
Lt,
Le,
Index,
NewIndex,
Call,
ToString,
Pairs,
Close,
Gc,
}Expand description
Public metamethod kinds for UserdataMethods::add_meta_method.
Maps 1:1 onto the dispatcher’s internal Mm enum. Listed
explicitly so the public surface doesn’t leak Mm’s discriminant
layout — Mm stays pub(crate) in exec.rs.
Not all Mm variants are exposed: Mm::Metatable (the __metatable
guard) and Mm::Name are set indirectly via LuaUserdata::type_name
and getmetatable; surfacing them as add_meta_method targets
would be confusing.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Add
__add — binary +.
Sub
__sub — binary -.
Mul
__mul — binary *.
Div
__div — binary /.
Mod
__mod — binary %.
Pow
__pow — binary ^.
IDiv
__idiv — binary //.
BAnd
__band — binary &.
BOr
__bor — binary |.
BXor
__bxor — binary ~ (bitwise xor).
Shl
__shl — <<.
Shr
__shr — >>.
BNot
__bnot — unary ~.
Unm
__unm — unary -.
Concat
__concat — binary ...
Len
__len — unary #.
Eq
__eq — ==.
Lt
__lt — <.
Le
__le — <=.
Index
__index — non-existent key lookup. Setting this directly
overrides the per-method dispatch table installed by
UserdataMethods::add_method etc., so only use it when you
want full control of the lookup; the trait’s default __index
is a table of add_method entries.
NewIndex
__newindex — non-existent key assignment.
Call
__call — obj(args).
ToString
__tostring — tostring(obj).
Pairs
__pairs — pairs(obj) (5.2+).
Close
__close — to-be-closed handler (5.4+).
Gc
__gc — finalizer. The metatable’s __gc fires before
Rust’s Drop on the host payload.
Implementations§
Trait Implementations§
Source§impl Clone for MetaMethod
impl Clone for MetaMethod
Source§fn clone(&self) -> MetaMethod
fn clone(&self) -> MetaMethod
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for MetaMethod
Source§impl Debug for MetaMethod
impl Debug for MetaMethod
impl Eq for MetaMethod
Source§impl PartialEq for MetaMethod
impl PartialEq for MetaMethod
Source§fn eq(&self, other: &MetaMethod) -> bool
fn eq(&self, other: &MetaMethod) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for MetaMethod
Auto Trait Implementations§
impl Freeze for MetaMethod
impl RefUnwindSafe for MetaMethod
impl Send for MetaMethod
impl Sync for MetaMethod
impl Unpin for MetaMethod
impl UnsafeUnpin for MetaMethod
impl UnwindSafe for MetaMethod
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.