Struct Buffer
struct Buffer(_)
Write colored text to memory.
Buffer is a platform independent abstraction for printing colored text to
an in memory buffer. When the buffer is printed using a BufferWriter, the
color information will be applied to the output device (a tty on Unix and a
console on Windows).
A Buffer is typically created by calling the BufferWriter.buffer
method, which will take color preferences and the environment into
account. However, buffers can also be manually created using no_color,
ansi or console (on Windows).
Implementations
impl Buffer
fn no_color() -> BufferCreate a buffer that drops all color information.
fn ansi() -> BufferCreate a buffer that uses ANSI escape sequences.
fn is_empty(self: &Self) -> boolReturns true if and only if this buffer is empty.
fn len(self: &Self) -> usizeReturns the length of this buffer in bytes.
fn clear(self: &mut Self)Clears this buffer.
fn into_inner(self: Self) -> Vec<u8>Consume this buffer and return the underlying raw data.
On Windows, this unrecoverably drops all color information associated with the buffer.
fn as_slice(self: &Self) -> &[u8]Return the underlying data of the buffer.
fn as_mut_slice(self: &mut Self) -> &mut [u8]Return the underlying data of the buffer as a mutable slice.
impl Clone for Buffer
fn clone(self: &Self) -> Buffer
impl Debug for Buffer
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Result
impl Freeze for Buffer
impl RefUnwindSafe for Buffer
impl Send for Buffer
impl Sync for Buffer
impl Unpin for Buffer
impl UnwindSafe for Buffer
impl Write for Buffer
fn write(self: &mut Self, buf: &[u8]) -> io::Result<usize>fn flush(self: &mut Self) -> io::Result<()>
impl WriteColor for Buffer
fn supports_color(self: &Self) -> boolfn supports_hyperlinks(self: &Self) -> boolfn set_color(self: &mut Self, spec: &ColorSpec) -> io::Result<()>fn set_hyperlink(self: &mut Self, link: &HyperlinkSpec<'_>) -> io::Result<()>fn reset(self: &mut Self) -> io::Result<()>fn is_synchronous(self: &Self) -> bool
impl<T> Any for Buffer
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Buffer
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Buffer
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for Buffer
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for Buffer
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for Buffer
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T, U> Into for Buffer
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for Buffer
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Buffer
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>