pub struct ProcessArgs { /* private fields */ }
Expand description
A struct that can be easily shared, stored in Lua app data, and that also guarantees the values are valid OS strings that can be used for process arguments.
Usable directly from Lua, implementing both FromLua
and LuaUserData
.
Also provides convenience methods for working with the arguments
as either OsString
or Vec<u8>
, where using the latter implicitly
converts to an OsString
and fails if the conversion is not possible.
Implementations§
Source§impl ProcessArgs
impl ProcessArgs
pub fn empty() -> Self
pub fn current() -> Self
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn all(&self) -> Vec<OsString>
pub fn get(&self, index: usize) -> Option<OsString>
pub fn set(&self, index: usize, val: impl Into<OsString>)
pub fn push(&self, val: impl Into<OsString>)
pub fn pop(&self) -> Option<OsString>
pub fn insert(&self, index: usize, val: impl Into<OsString>)
pub fn remove(&self, index: usize) -> Option<OsString>
pub fn all_bytes(&self) -> Vec<Vec<u8>>
pub fn get_bytes(&self, index: usize) -> Option<Vec<u8>>
pub fn set_bytes(&self, index: usize, val: impl Into<Vec<u8>>)
pub fn push_bytes(&self, val: impl Into<Vec<u8>>)
pub fn pop_bytes(&self) -> Option<Vec<u8>>
pub fn insert_bytes(&self, index: usize, val: impl Into<Vec<u8>>)
pub fn remove_bytes(&self, index: usize) -> Option<Vec<u8>>
Trait Implementations§
Source§impl Clone for ProcessArgs
impl Clone for ProcessArgs
Source§fn clone(&self) -> ProcessArgs
fn clone(&self) -> ProcessArgs
Returns a duplicate 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 ProcessArgs
impl Debug for ProcessArgs
Source§impl<S: Into<OsString>> Extend<S> for ProcessArgs
impl<S: Into<OsString>> Extend<S> for ProcessArgs
Source§fn extend<T: IntoIterator<Item = S>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = S>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl<S: Into<OsString>> FromIterator<S> for ProcessArgs
impl<S: Into<OsString>> FromIterator<S> for ProcessArgs
Source§fn from_iter<T: IntoIterator<Item = S>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = S>>(iter: T) -> Self
Creates a value from an iterator. Read more
Source§impl FromLua for ProcessArgs
impl FromLua for ProcessArgs
Source§impl IntoIterator for ProcessArgs
impl IntoIterator for ProcessArgs
Source§impl UserData for ProcessArgs
impl UserData for ProcessArgs
Source§fn add_methods<M: LuaUserDataMethods<Self>>(methods: &mut M)
fn add_methods<M: LuaUserDataMethods<Self>>(methods: &mut M)
Adds custom methods and operators specific to this userdata.
Source§fn add_fields<F>(fields: &mut F)where
F: UserDataFields<Self>,
fn add_fields<F>(fields: &mut F)where
F: UserDataFields<Self>,
Adds custom fields specific to this userdata.
Source§fn register(registry: &mut UserDataRegistry<Self>)
fn register(registry: &mut UserDataRegistry<Self>)
Registers this type for use in Lua. Read more
Auto Trait Implementations§
impl Freeze for ProcessArgs
impl RefUnwindSafe for ProcessArgs
impl Send for ProcessArgs
impl Sync for ProcessArgs
impl Unpin for ProcessArgs
impl UnwindSafe for ProcessArgs
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FromLuaMulti for Twhere
T: FromLua,
impl<T> FromLuaMulti for Twhere
T: FromLua,
Source§fn from_lua_multi(values: MultiValue, lua: &Lua) -> Result<T, Error>
fn from_lua_multi(values: MultiValue, lua: &Lua) -> Result<T, Error>
Performs the conversion. Read more
fn from_lua_args( args: MultiValue, i: usize, to: Option<&str>, lua: &Lua, ) -> Result<T, Error>
unsafe fn from_stack_multi(nvals: i32, lua: &RawLua) -> Result<T, Error>
unsafe fn from_stack_args( nargs: i32, i: usize, to: Option<&str>, lua: &RawLua, ) -> Result<T, Error>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoLuaMulti for Twhere
T: IntoLua,
impl<T> IntoLuaMulti for Twhere
T: IntoLua,
Source§fn into_lua_multi(self, lua: &Lua) -> Result<MultiValue, Error>
fn into_lua_multi(self, lua: &Lua) -> Result<MultiValue, Error>
Performs the conversion.