pub struct MaaStringBuffer { /* private fields */ }Expand description
A string buffer for UTF-8 text data.
Used for passing strings between Rust and the C API. Automatically freed when dropped.
Implementations§
Source§impl MaaStringBuffer
impl MaaStringBuffer
Sourcepub unsafe fn from_raw(handle: *mut MaaStringBuffer) -> Self
pub unsafe fn from_raw(handle: *mut MaaStringBuffer) -> 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.
Sourcepub fn from_handle(handle: *mut MaaStringBuffer) -> Option<Self>
pub fn from_handle(handle: *mut MaaStringBuffer) -> Option<Self>
Create from an existing handle safely (checks for null).
Returns None if handle is null.
Sourcepub fn as_ptr(&self) -> *mut MaaStringBuffer
pub fn as_ptr(&self) -> *mut MaaStringBuffer
Get the underlying raw handle.
Sourcepub fn raw(&self) -> *mut MaaStringBuffer
pub fn raw(&self) -> *mut MaaStringBuffer
Get the underlying raw handle (alias for as_ptr).
Source§impl MaaStringBuffer
impl MaaStringBuffer
Sourcepub fn set<S: AsRef<str>>(&mut self, content: S) -> MaaResult<()>
pub fn set<S: AsRef<str>>(&mut self, content: S) -> MaaResult<()>
Set the buffer content from a string.
Trait Implementations§
Source§impl AsRef<str> for MaaStringBuffer
impl AsRef<str> for MaaStringBuffer
Source§impl Debug for MaaStringBuffer
impl Debug for MaaStringBuffer
Source§impl Default for MaaStringBuffer
impl Default for MaaStringBuffer
Source§impl Display for MaaStringBuffer
impl Display for MaaStringBuffer
Source§impl Drop for MaaStringBuffer
impl Drop for MaaStringBuffer
Source§impl From<&str> for MaaStringBuffer
impl From<&str> for MaaStringBuffer
impl Send for MaaStringBuffer
Auto Trait Implementations§
impl Freeze for MaaStringBuffer
impl RefUnwindSafe for MaaStringBuffer
impl !Sync for MaaStringBuffer
impl Unpin for MaaStringBuffer
impl UnwindSafe for MaaStringBuffer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more