Struct riot_wrappers::shell::Args
source · pub struct Args<'a>(_);
Expand description
Newtype around an (argc, argv) C style string array that presents itself as much as an &'a [&'a str]
as possible. (Slicing is not implemented for reasons of laziness).
As this is used with the command line parser, it presents the individual strings as &str infallibly. If non-UTF8 input is received, a variation of from_utf8_lossy is applied: The complete string (rather than just the bad characters) is reported as “�”, but should have the same effect: Be visible as an encoding error without needlessly complicated error handling for niche cases.
Implementations§
source§impl<'a> Args<'a>
impl<'a> Args<'a>
sourcepub unsafe fn new(
argc: c_int,
argv: *const *const c_char,
_lifetime_marker: &'a ()
) -> Self
pub unsafe fn new( argc: c_int, argv: *const *const c_char, _lifetime_marker: &'a () ) -> Self
Create the slice from its parts.
Unsafe
argv must be a valid pointer, and its first argc items must be valid pointers. The underlying char strings do not need to be valid UTF-8, but must be null terminated.
sourcepub fn iter(&self) -> ArgsIterator<'a> ⓘ
pub fn iter(&self) -> ArgsIterator<'a> ⓘ
Returns an iterator over the arguments.