From 0a4ae8d859a150eab29007c8579edea73521076b Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Fri, 26 Jan 2018 19:44:35 +0100 Subject: [PATCH] Additional `MetaMethod` docs --- src/userdata.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/userdata.rs b/src/userdata.rs index 98ec717..aac80df 100644 --- a/src/userdata.rs +++ b/src/userdata.rs @@ -11,6 +11,11 @@ use value::{FromLua, FromLuaMulti, ToLuaMulti}; use lua::Lua; /// Kinds of metamethods that can be overridden. +/// +/// For safety reasons, this mechanism does not allow overriding the `__gc` metamethod. [`UserData`] +/// implementors can instead just use `Drop`. +/// +/// [`UserData`]: trait.UserData.html #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] pub enum MetaMethod { /// The `+` operator. @@ -57,7 +62,9 @@ pub enum MetaMethod { NewIndex, /// The call "operator" `obj(arg1, args2, ...)`. Call, - /// tostring(ud) will call this if it exists + /// The `__tostring` metamethod. + /// + /// This is not an operator, but will be called by methods such as `tostring` and `print`. ToString, }