diff options
author | Alex Orlenko <zxteam@protonmail.com> | 2021-02-20 22:42:09 +0000 |
---|---|---|
committer | Alex Orlenko <zxteam@protonmail.com> | 2021-04-27 00:29:37 +0100 |
commit | decb5b9e37549288ce09b28f3534b96eabb23116 (patch) | |
tree | 0765f8e869e5fb25e13a6d4e6723169964609452 /src | |
parent | 1635903d3f3d3a5adc12a7ff93986844b26784b0 (diff) | |
download | mlua-decb5b9e37549288ce09b28f3534b96eabb23116.zip |
Make MetaMethod::name() public
Tests for UserDataMetatable::pairs()
Diffstat (limited to 'src')
-rw-r--r-- | src/userdata.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/userdata.rs b/src/userdata.rs index d28a374..ef8cbf4 100644 --- a/src/userdata.rs +++ b/src/userdata.rs @@ -135,7 +135,8 @@ impl fmt::Display for MetaMethod { } impl MetaMethod { - pub(crate) fn name(&self) -> &str { + /// Returns Lua metamethod name, usually prefixed by two underscores. + pub fn name(&self) -> &str { match self { MetaMethod::Add => "__add", MetaMethod::Sub => "__sub", @@ -871,7 +872,7 @@ impl<'lua> UserDataMetatable<'lua> { /// The pairs are wrapped in a [`Result`], since they are lazily converted to `V` type. /// /// [`Result`]: type.Result.html - pub fn pairs<K: FromLua<'lua>, V: FromLua<'lua>>(self) -> UserDataMetatablePairs<'lua, V> { + pub fn pairs<V: FromLua<'lua>>(self) -> UserDataMetatablePairs<'lua, V> { UserDataMetatablePairs(self.0.pairs()) } } |