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 i8
pub fn scratch_txt(&mut self, txt: impl AsRef<str>) -> *const i8
Internal method to push a single text to our scratch buffer.
Sourcepub fn scratch_txt_opt(&mut self, txt: Option<impl AsRef<str>>) -> *const i8
pub fn scratch_txt_opt(&mut self, txt: Option<impl AsRef<str>>) -> *const i8
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 i8, *const i8)
pub fn scratch_txt_two( &mut self, txt_0: impl AsRef<str>, txt_1: impl AsRef<str>, ) -> (*const i8, *const i8)
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 i8, *const i8)
pub fn scratch_txt_with_opt( &mut self, txt_0: impl AsRef<str>, txt_1: Option<impl AsRef<str>>, ) -> (*const i8, *const i8)
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more