[][src]Struct samp::cell::string::AmxString

pub struct AmxString<'amx> { /* fields omitted */ }

Methods

impl<'amx> AmxString<'amx>[src]

pub unsafe fn new(buffer: Buffer<'amx>, bytes: &[u8]) -> AmxString<'amx>[src]

Create a new AmxString from an allocated buffer and fill it with a string

pub fn to_bytes(&self) -> Vec<u8>[src]

Convert an AMX string to a Vec<u8>.

pub fn to_string(&self) -> String[src]

Convert an AMX string to a String. Only ASCII chars by default. Pass cp1251 to crate features to enable Windows 1251 encoding (TODO).

Example

use samp_sdk::cell::AmxString;


fn log_error(&self, amx: &Amx, text: AmxString) -> AmxResult<bool> {
    if !self.logger_enabled {
        return Ok(false);
    }

    let string = text.to_string();
    println!("[{}] PluginName error: {}", current_date(), string);

    Ok(true)
}

pub fn len(&self) -> usize[src]

Return a length of a string.

pub fn is_empty(&self) -> bool[src]

pub fn bytes_len(&self) -> usize[src]

Return a length of a buffer of a string

Trait Implementations

impl<'_> Display for AmxString<'_>[src]

impl<'amx> AmxCell<'amx> for AmxString<'amx>[src]

Auto Trait Implementations

impl<'amx> !Send for AmxString<'amx>

impl<'amx> !Sync for AmxString<'amx>

Blanket Implementations

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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.