Skip to main content

BlobWriter

Struct BlobWriter 

Source
pub struct BlobWriter { /* private fields */ }
Expand description

Um BLOB aberto para escrita no servidor.

Criado por Connection::create_blob. Escreva dados com Self::write e feche com Self::close para obter o id do blob. Em caso de erro, use Self::cancel para liberar o handle no servidor.

Implementations§

Source§

impl BlobWriter

Source

pub fn blob_id(&self) -> u64

Id do blob no servidor. Use como Value::Blob num parâmetro de INSERT/UPDATE após fechar o blob.

Source

pub fn write(&self, conn: &mut Connection, data: &[u8]) -> Result<()>

Envia data para o servidor em segmentos de no máximo MAX_SEGMENT bytes, usando op_put_segment. Pode ser chamado várias vezes.

Source

pub fn cancel(self, conn: &mut Connection) -> Result<()>

Cancela o blob (op_cancel_blob), descartando o conteúdo já enviado. Use quando ocorrer um erro após Connection::create_blob.

Source

pub fn close(self, conn: &mut Connection) -> Result<u64>

Fecha o blob (op_close_blob) e devolve o seu id para usar como parâmetro de coluna BLOB em INSERT/UPDATE.

Trait Implementations§

Source§

impl Debug for BlobWriter

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for BlobWriter

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V