[−][src]Struct actix_lua::dev::rlua::prelude::LuaAnyUserData
Handle to an internal Lua userdata for any type that implements UserData.
Similar to std::any::Any, this provides an interface for dynamic type checking via the is
and borrow methods.
Internally, instances are stored in a RefCell, to best match the mutable semantics of the Lua
language.
Note
This API should only be used when necessary. Implementing UserData already allows defining
methods which check the type and acquire a borrow behind the scenes.
Methods
impl<'lua> AnyUserData<'lua>[src]
impl<'lua> AnyUserData<'lua>pub fn is<T>(&self) -> bool where | [src] |
Checks whether the type of this userdata is T.
pub fn borrow<T>(&self) -> Result<Ref<T>, Error> where | [src] |
Borrow this userdata immutably if it is of type T.
Errors
Returns a UserDataBorrowError if the userdata is already mutably borrowed. Returns a
UserDataTypeMismatch if the userdata is not of type T.
pub fn borrow_mut<T>(&self) -> Result<RefMut<T>, Error> where | [src] |
Borrow this userdata mutably if it is of type T.
Errors
Returns a UserDataBorrowMutError if the userdata is already borrowed. Returns a
UserDataTypeMismatch if the userdata is not of type T.
pub fn set_user_value<V>(&self, v: V) -> Result<(), Error> where | [src] |
Sets an associated value to this AnyUserData.
The value may be any Lua value whatsoever, and can be retrieved with get_user_value.
pub fn get_user_value<V>(&self) -> Result<V, Error> where | [src] |
Returns an associated value set by set_user_value.
Trait Implementations
impl<'lua> Debug for AnyUserData<'lua>[src]
impl<'lua> Debug for AnyUserData<'lua>impl<'lua> Clone for AnyUserData<'lua>[src]
impl<'lua> Clone for AnyUserData<'lua>fn clone(&self) -> AnyUserData<'lua> | [src] |
fn clone_from(&mut self, source: &Self) | 1.0.0 [src] |
Performs copy-assignment from source. Read more
impl<'lua> FromLua<'lua> for AnyUserData<'lua>[src]
impl<'lua> FromLua<'lua> for AnyUserData<'lua>impl<'lua> ToLua<'lua> for AnyUserData<'lua>[src]
impl<'lua> ToLua<'lua> for AnyUserData<'lua>Auto Trait Implementations
impl<'lua> !Send for AnyUserData<'lua>
impl<'lua> !Send for AnyUserData<'lua>impl<'lua> !Sync for AnyUserData<'lua>
impl<'lua> !Sync for AnyUserData<'lua>Blanket Implementations
impl<T> From for T[src]
impl<T> From for Timpl<T, U> Into for T where
U: From<T>, [src]
impl<T, U> Into for T where
U: From<T>, impl<T> ToOwned for T where
T: Clone, [src]
impl<T> ToOwned for T where
T: Clone, impl<T, U> TryFrom for T where
T: From<U>, [src]
impl<T, U> TryFrom for T where
T: From<U>, type Error = !
try_from)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> | [src] |
impl<T> Borrow for T where
T: ?Sized, [src]
impl<T> Borrow for T where
T: ?Sized, impl<T> BorrowMut for T where
T: ?Sized, [src]
impl<T> BorrowMut for T where
T: ?Sized, fn borrow_mut(&mut self) -> &mut T | [src] |
impl<T, U> TryInto for T where
U: TryFrom<T>, [src]
impl<T, U> TryInto for T where
U: TryFrom<T>, type Error = <U as TryFrom<T>>::Error
try_from)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error> | [src] |
impl<T> Any for T where
T: 'static + ?Sized, [src]
impl<T> Any for T where
T: 'static + ?Sized, fn get_type_id(&self) -> TypeId | [src] |
impl<T> Erased for T
impl<T> Erased for Timpl<'lua, T> FromLua for T where
T: 'static + UserData + Clone, [src]
impl<'lua, T> FromLua for T where
T: 'static + UserData + Clone, impl<'lua, T> ToLua for T where
T: 'static + UserData + Send, [src]
impl<'lua, T> ToLua for T where
T: 'static + UserData + Send, impl<'lua, T> ToLuaMulti for T where
T: ToLua<'lua>, [src]
impl<'lua, T> ToLuaMulti for T where
T: ToLua<'lua>, fn to_lua_multi(self, lua: &'lua Lua) -> Result<MultiValue<'lua>, Error> | [src] |
impl<'lua, T> FromLuaMulti for T where
T: FromLua<'lua>, [src]
impl<'lua, T> FromLuaMulti for T where
T: FromLua<'lua>, fn from_lua_multi(values: MultiValue<'lua>, lua: &'lua Lua) -> Result<T, Error> | [src] |