Skip to main content

MaaRectBuffer

Struct MaaRectBuffer 

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

Rect buffer for passing rectangle coordinates between Rust and C API.

Stores x, y position and width, height dimensions.

Implementations§

Source§

impl MaaRectBuffer

Source

pub fn new() -> MaaResult<Self>

Create a new buffer.

Source

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

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

Source

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

Get the underlying raw handle.

Source

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

Get the underlying raw handle (alias for as_ptr).

Source§

impl MaaRectBuffer

Source

pub fn get(&self) -> Rect

Get the rect values.

Source

pub fn set(&mut self, rect: &Rect) -> MaaResult<()>

Set the rect values.

Trait Implementations§

Source§

impl Debug for MaaRectBuffer

Source§

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

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

impl Default for MaaRectBuffer

Source§

fn default() -> Self

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

impl Drop for MaaRectBuffer

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl From<&MaaRectBuffer> for Rect

Source§

fn from(buf: &MaaRectBuffer) -> Self

Converts to this type from the input type.
Source§

impl From<MaaRectBuffer> for Rect

Source§

fn from(buf: MaaRectBuffer) -> Self

Converts to this type from the input type.
Source§

impl From<Rect> for MaaRectBuffer

Source§

fn from(rect: Rect) -> Self

Converts to this type from the input type.
Source§

impl Send for MaaRectBuffer

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.