Struct mlua::OwnedString
source · pub struct OwnedString(/* private fields */);
Expand description
Owned handle to an internal Lua string.
The owned handle holds a strong reference to the current Lua instance.
Be warned, if you place it into a Lua type (eg. UserData
or a Rust callback), it is very easy
to accidentally cause reference cycles that would prevent destroying Lua instance.
Implementations§
source§impl OwnedString
impl OwnedString
source§impl OwnedString
impl OwnedString
sourcepub fn to_str(&self) -> Result<&str>
pub fn to_str(&self) -> Result<&str>
Get a &str
slice if the Lua string is valid UTF-8.
This is a shortcut for String::to_str()
.
sourcepub fn as_bytes(&self) -> &[u8] ⓘ
pub fn as_bytes(&self) -> &[u8] ⓘ
Get the bytes that make up this string.
This is a shortcut for String::as_bytes()
.
Trait Implementations§
source§impl Clone for OwnedString
impl Clone for OwnedString
source§fn clone(&self) -> OwnedString
fn clone(&self) -> OwnedString
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for OwnedString
impl Debug for OwnedString
source§impl<'lua> FromLua<'lua> for OwnedString
Available on crate feature unstable
and non-crate feature send
only.
impl<'lua> FromLua<'lua> for OwnedString
Available on crate feature
unstable
and non-crate feature send
only.source§impl<'lua> IntoLua<'lua> for &OwnedString
Available on crate feature unstable
and non-crate feature send
only.
impl<'lua> IntoLua<'lua> for &OwnedString
Available on crate feature
unstable
and non-crate feature send
only.Auto Trait Implementations§
impl Freeze for OwnedString
impl !RefUnwindSafe for OwnedString
impl !Send for OwnedString
impl !Sync for OwnedString
impl Unpin for OwnedString
impl !UnwindSafe for OwnedString
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
Mutably borrows from an owned value. Read more
source§impl<'lua, T> FromLuaMulti<'lua> for Twhere
T: FromLua<'lua>,
impl<'lua, T> FromLuaMulti<'lua> for Twhere
T: FromLua<'lua>,
source§fn from_lua_multi(values: MultiValue<'lua>, lua: &'lua Lua) -> Result<T, Error>
fn from_lua_multi(values: MultiValue<'lua>, lua: &'lua Lua) -> Result<T, Error>
Performs the conversion. Read more
fn from_lua_args( args: MultiValue<'lua>, i: usize, to: Option<&str>, lua: &'lua Lua ) -> Result<T, Error>
unsafe fn from_stack_multi(nvals: i32, lua: &'lua Lua) -> Result<T, Error>
unsafe fn from_stack_args( nargs: i32, i: usize, to: Option<&str>, lua: &'lua Lua ) -> Result<T, Error>
source§impl<'lua, T> IntoLuaMulti<'lua> for Twhere
T: IntoLua<'lua>,
impl<'lua, T> IntoLuaMulti<'lua> for Twhere
T: IntoLua<'lua>,
source§fn into_lua_multi(self, lua: &'lua Lua) -> Result<MultiValue<'lua>, Error>
fn into_lua_multi(self, lua: &'lua Lua) -> Result<MultiValue<'lua>, Error>
Performs the conversion.