pub struct Args<'a>(&'a [*mut c_char]);
riot_module_shell
only.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.
Tuple Fields§
§0: &'a [*mut c_char]
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.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Args<'a>
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§
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
Source§impl<T> IntoSwitch for T
impl<T> IntoSwitch for T
Source§fn into_switch<ActiveLevel>(self) -> Switch<T, ActiveLevel>
fn into_switch<ActiveLevel>(self) -> Switch<T, ActiveLevel>
Source§fn into_active_high_switch(self) -> Switch<Self, ActiveHigh>where
Self: Sized,
fn into_active_high_switch(self) -> Switch<Self, ActiveHigh>where
Self: Sized,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 8 bytes