[−][src]Struct sailfish::runtime::Buffer
Buffer for rendered contents
This struct is quite simular to String
, but some methods are
re-implemented for faster buffering.
Implementations
impl Buffer
[src]
pub const fn new() -> Buffer
[src]
Create an empty buffer
pub fn with_capacity(n: usize) -> Buffer
[src]
Create a empty buffer with a particular capacity
pub fn as_str(&self) -> &str
[src]
Extracts a string slice containing the entire buffer
pub fn as_mut_ptr(&self) -> *mut u8
[src]
Returns an unsafe mutable pointer to the inner data
pub fn len(&self) -> usize
[src]
Returns the length of this buffer in bytes
pub fn capacity(&self) -> usize
[src]
Returns this buffer's capacity in bytes
pub unsafe fn advance(&mut self, additional: usize)
[src]
Increase the length of buffer by additional
bytes
Safety
additional
must be less than or equal tocapacity() - len()
- The elements at
old_len..old_len + additional
must be initialized
pub fn is_empty(&self) -> bool
[src]
Returns true
if this buffer has a length of zero, and false
otherwise
pub fn reserve(&mut self, size: usize)
[src]
pub fn into_string(self) -> String
[src]
Converts a Buffer
into a String
without copy/realloc operation.
pub fn push_str(&mut self, data: &str)
[src]
Appends a given string slice onto the end of this buffer
pub fn push(&mut self, data: char)
[src]
Appends the given char
to the end of this buffer
Trait Implementations
impl Add<&'_ str> for Buffer
[src]
type Output = Buffer
The resulting type after applying the +
operator.
pub fn add(mut self: Self, other: &str) -> Buffer
[src]
impl AddAssign<&'_ str> for Buffer
[src]
pub fn add_assign(&mut self, other: &str)
[src]
impl Clone for Buffer
[src]
pub fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for Buffer
[src]
impl Default for Buffer
[src]
impl Drop for Buffer
[src]
impl From<&'_ str> for Buffer
[src]
impl From<String> for Buffer
[src]
pub fn from(other: String) -> Buffer
[src]
Shrink the data and pass raw pointer directory to buffer
This operation is O(1)
impl Send for Buffer
[src]
impl Sync for Buffer
[src]
impl Write for Buffer
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,