Struct ezlua::value::LuaString

source ·
pub struct LuaString<'l>(_);
Expand description

Represents a lua string on the stack

Implementations§

source§

impl<'a> LuaString<'a>

source

pub fn to_string_lossy(&self) -> Cow<'_, str>

Methods from Deref<Target = ValRef<'l>>§

source

pub fn deserialize<T: Deserialize<'a>>(&'a self) -> Result<T, DesErr>

deserialize a lua value

source

pub fn transcode<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

transcode a lua value to another serialize format

source

pub fn state(&self) -> &'a State

source

pub fn type_of(&self) -> Type

source

pub fn is_nil(&self) -> bool

source

pub fn is_integer(&self) -> bool

source

pub fn is_table(&self) -> bool

source

pub fn is_function(&self) -> bool

source

pub fn to_safe_bytes(&self) -> Option<&'a [u8]>

source

pub fn to_safe_str(&self) -> Option<&'a str>

source

pub fn to_bytes(&self) -> Option<&[u8]>

source

pub fn to_str(&self) -> Option<&str>

source

pub fn to_string_lossy(&self) -> Option<Cow<'_, str>>

source

pub fn to_bool(&self) -> bool

source

pub fn to_integer(&self) -> lua_Integer

source

pub fn to_number(&self) -> lua_Number

source

pub fn index(&self) -> Index

source

pub fn check_type(&self, ty: Type) -> Result<()>

source

pub fn cast<'v, T: FromLua<'a> + 'v>(&'v self) -> Option<T>

source

pub fn check_cast<T: FromLua<'a>>(&self) -> Result<T>

source

pub fn geti(&self, i: impl Into<lua_Integer>) -> Result<ValRef<'a>>

source

pub fn seti<V: ToLua>(&self, i: impl Into<lua_Integer>, v: V) -> Result<()>

source

pub fn len(&self) -> Result<ValRef<'a>>

Get length of the value, like return #self in lua

source

pub fn set<K: ToLua, V: ToLua>(&self, k: K, v: V) -> Result<()>

Set value, equivalent to self[k] = v in lua

source

pub fn get<K: ToLua>(&self, k: K) -> Result<ValRef<'a>>

Get value associated, equivalent to return self[k] in lua

source

pub fn getopt<K: ToLua, V: FromLua<'a>>(&self, k: K) -> Result<Option<V>>

source

pub fn pcall<T: ToLuaMulti, R: FromLuaMulti<'a>>(&self, args: T) -> Result<R>

Call this value as a function

source

pub fn pcall_void<T: ToLuaMulti>(&self, args: T) -> Result<()>

Invoke pcall() without return value

source

pub fn has_metatable(&self) -> bool

source

pub fn metatable(&self) -> Result<Option<Table<'a>>>

Get metatable of lua table or userdata

source

pub fn set_metatable(&self, t: Table<'_>) -> Result<()>

Set metatable for lua table or userdata

source

pub fn remove_metatable(&self)

Remove metatable for lua table or userdata

source

pub fn call_metamethod<T: ToLuaMulti, R: FromLuaMulti<'a>>( &self, m: &str, args: T ) -> Result<R>

Call a metamethod

source

pub fn as_table(&self) -> Option<&Table<'a>>

source

pub fn as_function(&self) -> Option<&Function<'a>>

source

pub fn as_string(&self) -> Option<&LuaString<'a>>

source

pub fn as_thread(&self) -> Option<&LuaThread<'a>>

source

pub fn as_userdata(&self) -> Option<&LuaUserData<'a>>

Trait Implementations§

source§

impl<'l> Clone for LuaString<'l>

source§

fn clone(&self) -> LuaString<'l>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'l> Debug for LuaString<'l>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'l> Deref for LuaString<'l>

§

type Target = ValRef<'l>

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<'a> FromLua<'a> for LuaString<'a>

source§

fn from_index(s: &'a State, i: Index) -> Option<Self>

source§

const TYPE_NAME: &'static str = _

source§

fn from_lua(lua: &'a State, val: ValRef<'a>) -> Option<Self>

source§

fn check(lua: &'a State, i: Index) -> Result<Self>

source§

impl<'a> Into<ValRef<'a>> for LuaString<'a>

source§

fn into(self) -> ValRef<'a>

Converts this type into the (usually inferred) input type.
source§

impl<'a> ToLua for LuaString<'a>

source§

const __PUSH: Option<fn(_: Self, _: &State) -> Result<()>> = _

source§

fn to_lua<'a>(self, lua: &'a State) -> Result<ValRef<'a>>

source§

impl<'a> TryFrom<ValRef<'a>> for LuaString<'a>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(val: ValRef<'a>) -> Result<Self>

Performs the conversion.

Auto Trait Implementations§

§

impl<'l> !RefUnwindSafe for LuaString<'l>

§

impl<'l> !Send for LuaString<'l>

§

impl<'l> !Sync for LuaString<'l>

§

impl<'l> Unpin for LuaString<'l>

§

impl<'l> !UnwindSafe for LuaString<'l>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<'a, T> FromLuaMulti<'a> for Twhere T: FromLua<'a>,

source§

const COUNT: usize = 1usize

source§

fn from_lua_multi(s: &'a State, begin: i32) -> Result<T, Error>

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToLuaMulti for Twhere T: ToLua,

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> UserDataTrans<T> for T

§

type Read = &'a T

§

type Write = &'a mut T

source§

fn trans(udata: T) -> T

source§

const INIT_USERDATA: Option<fn(_: &State, _: &mut Self)> = None

source§

unsafe fn when_drop(&mut self)