Struct c_ffi::args::Args [−][src]
pub struct Args { /* fields omitted */ }
Expand description
Wrapper over C-style arguments
Example:
On most targets you can supply own C-style main function.
One of the benefits is that it is no longer necessary to rely on allocating std::env::Args
#![no_main] #[no_mangle] pub unsafe extern fn main(argc: std::os::raw::c_int, argv: *const *const u8) -> std::os::raw::c_int { let args = c_ffi::Args::new(argc as isize, argv).expect("To get function arguments"); 0 }
Implementations
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.
Unchecked version of Args::new
Do it on your own risk
Retrieves string by index.
No checks, 100% unsafe.