Skip to main content

MaaImageListBuffer

Struct MaaImageListBuffer 

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

A list buffer for storing multiple images.

Provides indexed access and iteration over a collection of MaaImageBuffers.

Implementations§

Source§

impl MaaImageListBuffer

Source

pub fn new() -> MaaResult<Self>

Create a new buffer.

Source

pub unsafe fn from_raw(handle: *mut MaaImageListBuffer) -> 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 MaaImageListBuffer) -> Option<Self>

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

Source

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

Get the underlying raw handle.

Source

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

Get the underlying raw handle (alias for as_ptr).

Source§

impl MaaImageListBuffer

Source

pub fn len(&self) -> usize

Returns the number of images in the list.

Source

pub fn is_empty(&self) -> bool

Returns true if the list contains no images.

Source

pub fn at(&self, index: usize) -> Option<MaaImageBuffer>

Get image at index. Returns None if index out of bounds. Note: The returned buffer is a view into this list (non-owning).

Source

pub fn append(&self, image: &MaaImageBuffer) -> MaaResult<()>

Appends an image to the end of the list.

Source

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

Set the content of this list, replacing existing content.

Source

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

Removes the image at the specified index.

Source

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

Removes all images from the list.

Source

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

Get all images as a vector of MaaImageBuffer handles.

Source

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

Get an iterator over the images in the list.

Source

pub fn to_vec_of_vec(&self) -> Vec<Vec<u8>>

Get all images as a vector of encoded byte vectors.

Source

pub fn to_raw_vecs(&self) -> Vec<(Vec<u8>, i32, i32, i32, i32)>

Get all images as raw BGR data vectors + metadata.

Trait Implementations§

Source§

impl Debug for MaaImageListBuffer

Source§

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

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

impl Default for MaaImageListBuffer

Source§

fn default() -> Self

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

impl Drop for MaaImageListBuffer

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for MaaImageListBuffer

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.