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

Returns slice of raw C strings

Retrieves string by index.

No checks, 100% unsafe.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.