[][src]Struct char_circle::RawCircle

pub struct RawCircle { /* fields omitted */ }

A thread-safe version of CharCircle.

The API of this buffer is almost identical to CharCircle except that it uses external mutability, and it does not provide a means to consume its characters from an external iterator.

Methods

impl RawCircle[src]

Important traits for RawCircle
pub fn new(s: String) -> RawCircle[src]

Construct a new RawCircle using a string as the initial buffer.

Important traits for RawCircle
pub fn empty() -> RawCircle[src]

Construct a new, empty RawCircle.

pub fn len(&self) -> usize[src]

The number of UTF-8 bytes in the buffer.

pub fn n_chars(&self) -> usize[src]

The number of characters in the buffer.

pub fn capacity(&self) -> usize[src]

The number of bytes the buffer can hold before reallocating.

This refers to the length of the backing vector. That vector may have additional capacity allocated to it that is not reported by this method.

pub fn read_char(&mut self) -> Option<char>[src]

Read the next character in the buffer.

pub fn read(&mut self, buf: &mut [u8]) -> Result<usize>[src]

Read bytes from this circle into a buffer.

This method will only ever read complete UTF-8 characters. It returns the number of bytes read; it never returns an error.

This is the implementation of std::io::Read for RawCircle.

pub fn read_str<'a>(&mut self, buf: &'a mut [u8]) -> &'a str[src]

Read bytes from this circle into a buffer.

This method is equivalent to RawCircle::read except the return value is the buffer cast to a &str.

pub fn write_char(&mut self, ch: char)[src]

Write a character into the buffer.

pub fn write(&mut self, buf: &[u8]) -> Result<usize>[src]

Read bytes from a string into this buffer;

This method will only ever write complete UTF-8 characters. It returns the number of bytes written. This method returns an error if the input is not valid UTF-8.

This is the implementation of std::io::Write for RawCircle.

pub fn write_str(&mut self, buf: &str) -> usize[src]

Read bytes from a string into this buffer;

This method is equivalent to RawCircle::write except that it cannot return an error because the input is valid UTF-8.

pub fn into_vec(self) -> Vec<u8>[src]

Unpack this circular buffer into a byte vector.

pub fn into_string(self) -> String[src]

Unpack this circular buffer into a string.

Trait Implementations

impl Clone for RawCircle[src]

default fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Default for RawCircle[src]

impl From<String> for RawCircle[src]

impl From<RawCircle> for String[src]

impl From<RawCircle> for Vec<u8>[src]

impl Debug for RawCircle[src]

impl Read for RawCircle[src]

default fn read_vectored(
    &mut self,
    bufs: &mut [IoVecMut]
) -> Result<usize, Error>
[src]

🔬 This is a nightly-only experimental API. (iovec)

Like read, except that it reads into a slice of buffers. Read more

unsafe default fn initializer(&self) -> Initializer[src]

🔬 This is a nightly-only experimental API. (read_initializer)

Determines if this Reader can work with buffers of uninitialized memory. Read more

default fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
1.0.0
[src]

Read all bytes until EOF in this source, placing them into buf. Read more

default fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
1.0.0
[src]

Read all bytes until EOF in this source, appending them to buf. Read more

default fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
1.6.0
[src]

Read the exact number of bytes required to fill buf. Read more

default fn by_ref(&mut self) -> &mut Self
1.0.0
[src]

Creates a "by reference" adaptor for this instance of Read. Read more

default fn bytes(self) -> Bytes<Self>
1.0.0
[src]

Transforms this Read instance to an [Iterator] over its bytes. Read more

default fn chain<R>(self, next: R) -> Chain<Self, R> where
    R: Read
1.0.0
[src]

Creates an adaptor which will chain this stream with another. Read more

default fn take(self, limit: u64) -> Take<Self>
1.0.0
[src]

Creates an adaptor which will read at most limit bytes from it. Read more

impl Write for RawCircle[src]

default fn write_vectored(&mut self, bufs: &[IoVec]) -> Result<usize, Error>[src]

🔬 This is a nightly-only experimental API. (iovec)

Like write, except that it writes from a slice of buffers. Read more

default fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
1.0.0
[src]

Attempts to write an entire buffer into this writer. Read more

default fn write_fmt(&mut self, fmt: Arguments) -> Result<(), Error>
1.0.0
[src]

Writes a formatted string into this writer, returning any error encountered. Read more

default fn by_ref(&mut self) -> &mut Self
1.0.0
[src]

Creates a "by reference" adaptor for this instance of Write. Read more

Auto Trait Implementations

impl Send for RawCircle

impl Sync for RawCircle

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.