Skip to main content

LuaStringLib

Struct LuaStringLib 

Source
pub struct LuaStringLib;
Expand description

Lua string library (includes Factorio’s pack / packsize / unpack).

Implementations§

Source§

impl LuaStringLib

Source

pub const fn new() -> Self

Source

pub fn byte( &self, s: &'static str, i: Option<i64>, j: Option<i64>, ) -> Option<u8>

Source

pub fn char(&self, bytes: impl Into<LuaAny>) -> &'static str

Source

pub fn find( &self, s: &'static str, pattern: &'static str, init: Option<i64>, plain: Option<bool>, ) -> Option<(i64, i64)>

Source

pub fn format(&self, fmt: &'static str) -> &'static str

string.format(fmt) with no values.

Source

pub fn format_1(&self, fmt: &'static str, a: impl Into<LuaAny>) -> &'static str

string.format(fmt, a). Lowers as string.format.

Source

pub fn format_2( &self, fmt: &'static str, a: impl Into<LuaAny>, b: impl Into<LuaAny>, ) -> &'static str

string.format(fmt, a, b). Lowers as string.format.

Source

pub fn format_3( &self, fmt: &'static str, a: impl Into<LuaAny>, b: impl Into<LuaAny>, c: impl Into<LuaAny>, ) -> &'static str

string.format(fmt, a, b, c). Lowers as string.format.

Source

pub fn format_4( &self, fmt: &'static str, a: impl Into<LuaAny>, b: impl Into<LuaAny>, c: impl Into<LuaAny>, d: impl Into<LuaAny>, ) -> &'static str

string.format(fmt, a, b, c, d). Lowers as string.format.

Source

pub fn gmatch(&self, s: &'static str, pattern: &'static str) -> LuaAny

Source

pub fn gsub( &self, s: &'static str, pattern: &'static str, repl: impl Into<LuaAny>, n: Option<i64>, ) -> (&'static str, i64)

Source

pub fn len(&self, s: &'static str) -> i64

Source

pub fn lower(&self, s: &'static str) -> &'static str

Source

pub fn match( &self, s: &'static str, pattern: &'static str, init: Option<i64>, ) -> Option<&'static str>

Source

pub fn pack(&self, fmt: &'static str, values: impl Into<LuaAny>) -> &'static str

Binary pack (Lua 5.4 backport in Factorio).

Source

pub fn packsize(&self, fmt: &'static str) -> i64

Source

pub fn rep( &self, s: &'static str, n: i64, sep: Option<&'static str>, ) -> &'static str

Source

pub fn reverse(&self, s: &'static str) -> &'static str

Source

pub fn sub(&self, s: &'static str, i: i64, j: Option<i64>) -> &'static str

Source

pub fn unpack( &self, fmt: &'static str, s: &'static str, pos: Option<i64>, ) -> LuaAny

Binary unpack (Lua 5.4 backport in Factorio).

Source

pub fn upper(&self, s: &'static str) -> &'static str

Trait Implementations§

Source§

impl Clone for LuaStringLib

Source§

fn clone(&self) -> LuaStringLib

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for LuaStringLib

Source§

impl Debug for LuaStringLib

Source§

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

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

impl Default for LuaStringLib

Source§

fn default() -> LuaStringLib

Returns the “default value” for a type. Read more
Source§

impl Eq for LuaStringLib

Source§

impl PartialEq for LuaStringLib

Source§

fn eq(&self, other: &LuaStringLib) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for LuaStringLib

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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> ToOwned for T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.