pub struct Args<'a> { /* private fields */ }Expand description
Typed list of arguments for a native function.
Generally the #[native] proc macro builds and consumes an Args automatically
— call manually only in raw natives that receive (amx, args) directly.
Implementations§
Source§impl<'a> Args<'a>
impl<'a> Args<'a>
Sourcepub fn new(amx: &'a Amx, params: *const i32) -> Args<'a>
pub fn new(amx: &'a Amx, params: *const i32) -> Args<'a>
Builds from the Amx and the args pointer received by the native.
§Example
use samp_sdk::args::Args;
use samp_sdk::amx::Amx;
use samp_sdk::cell::AmxString;
// native RawNative(const say_that[]);
extern "C" fn raw_native(amx: *mut AMX, args: *mut i32) -> i32 {
let amx = Amx::new(amx, amx_exports);
let mut args = Args::new(&amx, args);
let Some(text) = args.next_arg::<AmxString>() else { return 0 };
println!("RawNative: {}", &*text);
1
}Sourcepub fn next_arg<T>(&mut self) -> Option<T>where
T: AmxCell<'a> + 'a,
pub fn next_arg<T>(&mut self) -> Option<T>where
T: AmxCell<'a> + 'a,
Next argument in signature order. None at the end of the list.
Auto Trait Implementations§
impl<'a> !Send for Args<'a>
impl<'a> !Sync for Args<'a>
impl<'a> Freeze for Args<'a>
impl<'a> RefUnwindSafe for Args<'a>
impl<'a> Unpin for Args<'a>
impl<'a> UnsafeUnpin 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
Mutably borrows from an owned value. Read more