[][src]Struct blob::Blob

pub struct Blob<C: Config = Standard> { /* fields omitted */ }

Blob structure containing binary data

Interally, the blob is stored as a plain Vec<u8>, and some methods are exposed from that. If you need full access to the underlying Vec, use borrow() or borrow_mut()

Methods

impl<C: Config> Blob<C>
[src]

Important traits for Blob<C>
pub fn new() -> Blob<C>
[src]

Create a new empty Blob

Important traits for Blob<C>
pub fn from_vec(vec: Vec<u8>) -> Blob<C>
[src]

Create a Blob from an underlying Vec

Important traits for Blob<C>
pub fn with_capacity(capacity: usize) -> Blob<C>
[src]

Create a new Blob with the given capacity

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

Returns the number of bytes the Blob can hold without reallocating.

pub fn reserve(&mut self, additional: usize)
[src]

Reserves capacity for at least additional more bytes to be inserted in the given Blob

Important traits for Blob<C>
pub fn with_config<E: Config>(self) -> Blob<E>
[src]

Use a different encoding configuration for the Blob

pub fn encode_base64(&self) -> String
[src]

Encode the Blob to a base-64 string

pub fn encode_to<W: Write>(&self, writer: W) -> Result<()>
[src]

Encodes the Blob as base-64 to an io::Writer, avoiding intermediate allocations

pub fn decode_base64<T>(encoded: T) -> Result<Blob<C>, DecodeError> where
    T: AsRef<[u8]>, 
[src]

Decode base-64 encoded data into a Blob

pub fn append_base64<T>(&mut self, encoded: T) -> Result<(), DecodeError> where
    T: AsRef<[u8]>, 
[src]

Decodes some base-64 data and appends it to the Blob

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

Consume self and return the inner Vec<u8>

Trait Implementations

impl<T, C: Config> From<T> for Blob<C> where
    T: Into<Vec<u8>>, 
[src]

impl<C: Config> IntoIterator for Blob<C>
[src]

type Item = u8

The type of the elements being iterated over.

type IntoIter = IntoIter<u8>

Which kind of iterator are we turning this into?

impl<'a, C: Config> IntoIterator for &'a Blob<C>
[src]

type Item = &'a u8

The type of the elements being iterated over.

type IntoIter = Iter<'a, u8>

Which kind of iterator are we turning this into?

impl<'a, C: Config> IntoIterator for &'a mut Blob<C>
[src]

type Item = &'a mut u8

The type of the elements being iterated over.

type IntoIter = IterMut<'a, u8>

Which kind of iterator are we turning this into?

impl<C: Config> Eq for Blob<C>
[src]

impl<C: Config> Extend<u8> for Blob<C>
[src]

impl<'a, C: Config> Extend<&'a u8> for Blob<C>
[src]

impl<C: Config> AsMut<[u8]> for Blob<C>
[src]

impl<C: Config> AsMut<Vec<u8>> for Blob<C>
[src]

impl<C: Config> Default for Blob<C>
[src]

impl<C: Config> PartialEq<Blob<C>> for Blob<C>
[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl<T, C: Config> PartialEq<T> for Blob<C> where
    Vec<u8>: PartialEq<T>, 
[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl<C: Config> AsRef<[u8]> for Blob<C>
[src]

impl<C: Config> AsRef<Vec<u8>> for Blob<C>
[src]

impl<C: Config> Clone for Blob<C>
[src]

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

Performs copy-assignment from source. Read more

impl<C: Config> Debug for Blob<C>
[src]

impl<C: Config> Display for Blob<C>
[src]

impl<C: Config> DerefMut for Blob<C>
[src]

impl<C: Config> Deref for Blob<C>
[src]

type Target = [u8]

The resulting type after dereferencing.

impl<C: Config> Hash for Blob<C>
[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl<C: Config> FromIterator<u8> for Blob<C>
[src]

impl<C: Config> FromStr for Blob<C>
[src]

type Err = DecodeError

The associated error which can be returned from parsing.

impl<C: Config> Borrow<Vec<u8>> for Blob<C>
[src]

impl<C: Config> Write for Blob<C>
[src]

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

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

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

impl<C: Config> BorrowMut<Vec<u8>> for Blob<C>
[src]

impl<C: Config> Serialize for Blob<C>
[src]

impl<'de, C: Config> Deserialize<'de> for Blob<C>
[src]

Auto Trait Implementations

impl<C> Send for Blob<C>

impl<C> Sync for Blob<C>

Blanket Implementations

impl<T> From for T
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

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

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

type Owned = T

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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

type Error = !

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

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?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

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

The type returned in the event of a conversion error.

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

impl<W> WriteBytesExt for W where
    W: Write + ?Sized

fn write_u8(&mut self, n: u8) -> Result<(), Error>

Writes an unsigned 8 bit integer to the underlying writer. Read more

fn write_i8(&mut self, n: i8) -> Result<(), Error>

Writes a signed 8 bit integer to the underlying writer. Read more

fn write_u16<T>(&mut self, n: u16) -> Result<(), Error> where
    T: ByteOrder, 

Writes an unsigned 16 bit integer to the underlying writer. Read more

fn write_i16<T>(&mut self, n: i16) -> Result<(), Error> where
    T: ByteOrder, 

Writes a signed 16 bit integer to the underlying writer. Read more

fn write_u24<T>(&mut self, n: u32) -> Result<(), Error> where
    T: ByteOrder, 

Writes an unsigned 24 bit integer to the underlying writer. Read more

fn write_i24<T>(&mut self, n: i32) -> Result<(), Error> where
    T: ByteOrder, 

Writes a signed 24 bit integer to the underlying writer. Read more

fn write_u32<T>(&mut self, n: u32) -> Result<(), Error> where
    T: ByteOrder, 

Writes an unsigned 32 bit integer to the underlying writer. Read more

fn write_i32<T>(&mut self, n: i32) -> Result<(), Error> where
    T: ByteOrder, 

Writes a signed 32 bit integer to the underlying writer. Read more

fn write_u48<T>(&mut self, n: u64) -> Result<(), Error> where
    T: ByteOrder, 

Writes an unsigned 48 bit integer to the underlying writer. Read more

fn write_i48<T>(&mut self, n: i64) -> Result<(), Error> where
    T: ByteOrder, 

Writes a signed 48 bit integer to the underlying writer. Read more

fn write_u64<T>(&mut self, n: u64) -> Result<(), Error> where
    T: ByteOrder, 

Writes an unsigned 64 bit integer to the underlying writer. Read more

fn write_i64<T>(&mut self, n: i64) -> Result<(), Error> where
    T: ByteOrder, 

Writes a signed 64 bit integer to the underlying writer. Read more

fn write_u128<T>(&mut self, n: u128) -> Result<(), Error> where
    T: ByteOrder, 

Writes an unsigned 128 bit integer to the underlying writer.

fn write_i128<T>(&mut self, n: i128) -> Result<(), Error> where
    T: ByteOrder, 

Writes a signed 128 bit integer to the underlying writer.

fn write_uint<T>(&mut self, n: u64, nbytes: usize) -> Result<(), Error> where
    T: ByteOrder, 

Writes an unsigned n-bytes integer to the underlying writer. Read more

fn write_int<T>(&mut self, n: i64, nbytes: usize) -> Result<(), Error> where
    T: ByteOrder, 

Writes a signed n-bytes integer to the underlying writer. Read more

fn write_uint128<T>(&mut self, n: u128, nbytes: usize) -> Result<(), Error> where
    T: ByteOrder, 

Writes an unsigned n-bytes integer to the underlying writer. Read more

fn write_int128<T>(&mut self, n: i128, nbytes: usize) -> Result<(), Error> where
    T: ByteOrder, 

Writes a signed n-bytes integer to the underlying writer. Read more

fn write_f32<T>(&mut self, n: f32) -> Result<(), Error> where
    T: ByteOrder, 

Writes a IEEE754 single-precision (4 bytes) floating point number to the underlying writer. Read more

fn write_f64<T>(&mut self, n: f64) -> Result<(), Error> where
    T: ByteOrder, 

Writes a IEEE754 double-precision (8 bytes) floating point number to the underlying writer. Read more

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]