pub struct UiBuffer {
pub buffer: Vec<u8>,
pub max_len: usize,
}
Expand description
this is the unsafe cell upon which we build our abstraction.
Fields§
§buffer: Vec<u8>
§max_len: usize
Implementations§
source§impl UiBuffer
impl UiBuffer
sourcepub fn scratch_txt(&mut self, txt: impl AsRef<str>) -> *const c_char
pub fn scratch_txt(&mut self, txt: impl AsRef<str>) -> *const c_char
Internal method to push a single text to our scratch buffer.
sourcepub fn scratch_txt_opt(&mut self, txt: Option<impl AsRef<str>>) -> *const c_char
pub fn scratch_txt_opt(&mut self, txt: Option<impl AsRef<str>>) -> *const c_char
Internal method to push an option text to our scratch buffer.
sourcepub fn scratch_txt_two(
&mut self,
txt_0: impl AsRef<str>,
txt_1: impl AsRef<str>
) -> (*const c_char, *const c_char)
pub fn scratch_txt_two( &mut self, txt_0: impl AsRef<str>, txt_1: impl AsRef<str> ) -> (*const c_char, *const c_char)
Helper method, same as Self::scratch_txt
but for two strings
sourcepub fn scratch_txt_with_opt(
&mut self,
txt_0: impl AsRef<str>,
txt_1: Option<impl AsRef<str>>
) -> (*const c_char, *const c_char)
pub fn scratch_txt_with_opt( &mut self, txt_0: impl AsRef<str>, txt_1: Option<impl AsRef<str>> ) -> (*const c_char, *const c_char)
Helper method, same as Self::scratch_txt
but with one optional value
sourcepub fn refresh_buffer(&mut self)
pub fn refresh_buffer(&mut self)
Attempts to clear the buffer if it’s over the maximum length allowed. This is to prevent us from making a giant vec over time.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for UiBuffer
impl RefUnwindSafe for UiBuffer
impl Send for UiBuffer
impl Sync for UiBuffer
impl Unpin for UiBuffer
impl UnwindSafe for UiBuffer
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