Skip to main content

MaaStringListBuffer

Struct MaaStringListBuffer 

Source
pub struct MaaStringListBuffer { /* private fields */ }
Expand description

A list buffer for storing multiple strings.

Provides indexed access and iteration over a collection of UTF-8 strings.

Implementations§

Source§

impl MaaStringListBuffer

Source

pub fn new() -> MaaResult<Self>

Create a new buffer.

Source

pub unsafe fn from_raw(handle: *mut MaaStringListBuffer) -> Self

Create from an existing handle.

§Safety

This function assumes the handle is valid. The returned buffer will NOT take ownership of the handle (it won’t be destroyed on drop). Use this when you are borrowing a handle from the C API.

Source

pub fn from_handle(handle: *mut MaaStringListBuffer) -> Option<Self>

Create from an existing handle safely (checks for null). Returns None if handle is null.

Source

pub fn as_ptr(&self) -> *mut MaaStringListBuffer

Get the underlying raw handle.

Source

pub fn raw(&self) -> *mut MaaStringListBuffer

Get the underlying raw handle (alias for as_ptr).

Source§

impl MaaStringListBuffer

Source

pub fn len(&self) -> usize

Returns the number of strings in the list.

Source

pub fn is_empty(&self) -> bool

Returns true if the list contains no strings.

Source

pub fn append(&self, s: &str) -> MaaResult<()>

Appends a string to the end of the list.

Source

pub fn set<S: AsRef<str>>(&self, data: &[S]) -> MaaResult<()>

Set the content of this list, replacing existing content.

Source

pub fn remove(&self, index: usize) -> MaaResult<()>

Removes the string at the specified index.

Source

pub fn clear(&self) -> MaaResult<()>

Removes all strings from the list.

Source

pub fn iter(&self) -> impl Iterator<Item = &str> + '_

Get an iterator over the strings in the list.

The iterator yields &str slices borrowing from the buffer. This is zero-cost and safe.

Source

pub fn to_vec(&self) -> Vec<String>

Collects all strings into a Vec<String>.

Trait Implementations§

Source§

impl Debug for MaaStringListBuffer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MaaStringListBuffer

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Drop for MaaStringListBuffer

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for MaaStringListBuffer

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.