Struct Blob

Source
pub struct Blob<'a> { /* private fields */ }
Expand description

An SQL blob.

An eXtremeDB SQL blob is a large binary object that can contain arbitrary data.

This type contains public methods that allow the applications to read the data. A blob keeps an internal read pointer; each read operation advances it by the number of bytes read. To revert the pointer to the beginning of the blob’s data, use the reset() method.

A Value can only be converted into a Blob if it has the Blob type. The opposite conversion is always possible.

Implementations§

Source§

impl<'a> Blob<'a>

Source

pub fn available(&self) -> Result<usize>

Returns the number of bytes available to be extracted with a single get() operation.

This is not the total size of the blob. If the blob is split into segments, this can be equal to the size of one segment.

Source

pub fn get_into(&self, buf: &mut Vec<u8>) -> Result<()>

Reads the blob data into the buffer.

This method will fill the buffer up to its capacity. If the number of bytes available for reading is smaller than the buffer’s capacity, this method will perform multiple reads.

Source

pub fn get(&self, size: usize) -> Result<Vec<u8>>

Reads the given number of bytes from the blob.

If the number of bytes available for reading is smaller than the requested size, this method will perform multiple reads.

Source

pub fn reset(&self) -> Result<()>

Resets the blob’s read pointer.

Trait Implementations§

Source§

impl<'a> From<Blob<'a>> for Value<'a>

Source§

fn from(blob: Blob<'a>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'a> Freeze for Blob<'a>

§

impl<'a> RefUnwindSafe for Blob<'a>

§

impl<'a> !Send for Blob<'a>

§

impl<'a> !Sync for Blob<'a>

§

impl<'a> Unpin for Blob<'a>

§

impl<'a> UnwindSafe for Blob<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.