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
sourceimpl<'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>ⓘNotable traits for ArgsIterator<'a>impl<'a> Iterator for ArgsIterator<'a> type Item = &'a str;
pub fn iter(&self) -> ArgsIterator<'a>ⓘNotable traits for ArgsIterator<'a>impl<'a> Iterator for ArgsIterator<'a> type Item = &'a str;
Returns an iterator over the arguments.
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for Args<'a>
impl<'a> !Send for Args<'a>
impl<'a> !Sync for Args<'a>
impl<'a> Unpin for Args<'a>
impl<'a> UnwindSafe for Args<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more