pub struct UnsizedBuffer<'amx> { /* private fields */ }Expand description
Array with unknown size — received as a native argument when the
Pawn signature is array[] without a fixed dimension.
The actual size usually comes as another parameter (sizeof(array)). Use
into_sized_buffer to convert into Buffer before iterating.
Implementations§
Source§impl<'amx> UnsizedBuffer<'amx>
impl<'amx> UnsizedBuffer<'amx>
Sourcepub fn into_sized_buffer(self, len: usize) -> Buffer<'amx>
pub fn into_sized_buffer(self, len: usize) -> Buffer<'amx>
Converts into Buffer by declaring the size.
len must be <= the actual number of allocated cells — larger values
cause UB when accessing cells outside the Pawn array. The SDK caps it
at 1 MiB as a defense against a corrupted len from the script.
Sourcepub fn as_mut_ptr(&mut self) -> *mut i32
pub fn as_mut_ptr(&mut self) -> *mut i32
Mutable pointer to the first cell.
Sourcepub fn write_str(self, max_len: usize, s: &str) -> AmxResult<()>
pub fn write_str(self, max_len: usize, s: &str) -> AmxResult<()>
Sizes the buffer to max_len and writes s in one call.
Equivalent to into_sized_buffer(max_len).write_str(s). This is the
recommended way to fill an output string in natives.
§Errors
AmxError::General if the encoded s is >= max_len (no room for
the 0 terminator).