[][src]Struct libuv::buf::Buf

pub struct Buf { /* fields omitted */ }

Buffer data type.

Implementations

impl Buf[src]

pub fn new(s: &str) -> Result<Buf, Box<dyn Error>>[src]

Create a new Buf with the given string

pub fn new_from_bytes(bytes: &[u8]) -> Result<Buf, Box<dyn Error>>[src]

Create a new Buf from the given byte slice

pub fn with_capacity(size: usize) -> Result<Buf>[src]

Create a Buf with the given capacity - the memory is not initialized

pub fn new_from(other: &impl BufTrait, size: Option<usize>) -> Result<Self>[src]

Create a duplicate of this Buf - if the optional size parameter is None, the new Buf will have the same size as the existing Buf. Otherwise, the new Buf will have the specified size and data up to that size, or the size of the original buf, whichever is lower, will be copied.

pub fn is_allocated(&self) -> bool[src]

Returns true if the internal buffer is initialized

pub fn resize(&mut self, size: usize) -> Result<()>[src]

Resizes the internal buffer

pub fn copy_from(&mut self, other: &impl BufTrait) -> Result<()>[src]

Copies the data from a Buf to this one.

pub fn dealloc(&mut self)[src]

Deallocate the internal buffer, but leave the Buf intact.

pub fn destroy(&mut self)[src]

Deallocates the internal buffer and the Buf

Trait Implementations

impl BufTrait for Buf[src]

impl Clone for Buf[src]

impl Copy for Buf[src]

impl From<Buf> for ReadonlyBuf[src]

impl<'_> TryFrom<&'_ str> for Buf[src]

type Error = Box<dyn Error>

The type returned in the event of a conversion error.

Auto Trait Implementations

impl RefUnwindSafe for Buf

impl !Send for Buf

impl !Sync for Buf

impl Unpin for Buf

impl UnwindSafe for Buf

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Owned = T

The resulting type after obtaining ownership.

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.