pub struct Args { /* private fields */ }Expand description
Wrapper over C-style arguments
Implementations§
source§impl Args
impl Args
sourcepub unsafe fn new(
argc: isize,
argv: *const *const u8
) -> Result<Self, (usize, Utf8Error)>
pub unsafe fn new( argc: isize, argv: *const *const u8 ) -> Result<Self, (usize, Utf8Error)>
Creates new instance, but verifies that each string inside are UTF-8.
On error returns pair: (string index, Utf8Error)
The function is safe as long as you pass C style main function arguments.
sourcepub unsafe fn new_unchecked(argc: isize, argv: *const *const u8) -> Self
pub unsafe fn new_unchecked(argc: isize, argv: *const *const u8) -> Self
Unchecked version of Args::new
Do it on your own risk
sourcepub unsafe fn get_str_by_index(&self, index: usize) -> &str
pub unsafe fn get_str_by_index(&self, index: usize) -> &str
Retrieves string by index.
No checks, 100% unsafe.