[][src]Struct samp::prelude::Ref

pub struct Ref<'amx, T> where
    T: AmxPrimitive
{ /* fields omitted */ }

A reference to a cell in the Amx.

Notes

This type implements Deref trait that allows you read or write to inner value (like smart pointers Box<T>, Rc<T>).

Methods

impl<'amx, T> Ref<'amx, T> where
    T: AmxPrimitive
[src]

pub unsafe fn new(amx_addr: i32, phys_addr: *mut T) -> Ref<'amx, T>[src]

Create a new wrapper over an AMX cell.

Safety

Ref<T> should be alive as long as phys_addr or it will dangling pointer.

It's not recomended to use directly, instead get a reference from Args or Amx::get_ref.

pub fn address(&self) -> i32[src]

Get an inner AMX address to cell (not physical).

Example

use samp_sdk::cell::Ref;
fn native_fn(amx: &Amx, arg: Ref<usize>) {
    let cell_addr = arg.address();
    println!("The argument stored in the {} cell.", cell_addr);
}

pub fn as_ptr(&self) -> *const T[src]

Get a pointer to a memory cell.

pub fn as_mut_ptr(&mut self) -> *mut T[src]

Get a mutable pointer to a memory cell.

Trait Implementations

impl<'_, T> DerefMut for Ref<'_, T> where
    T: AmxPrimitive
[src]

impl<'amx, T> AmxCell<'amx> for Ref<'amx, T> where
    T: AmxPrimitive
[src]

impl<'_, T> Deref for Ref<'_, T> where
    T: AmxPrimitive
[src]

type Target = T

The resulting type after dereferencing.

Auto Trait Implementations

impl<'amx, T> !Send for Ref<'amx, T>

impl<'amx, T> !Sync for Ref<'amx, T>

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.