Skip to main content

Recv

Struct Recv 

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

A binary parameter value and how much of it a receive function has read.

Implementations§

Source§

impl<'a> Recv<'a>

Source

pub fn new(data: &'a [u8]) -> Recv<'a>

Source

pub fn bytes(&mut self, len: usize) -> Result<&'a [u8], TypeError>

pq_copymsgbytes and pq_getmsgbytes.

Source

pub fn remaining(&self) -> usize

The number of bytes that are not read.

Source

pub fn byte(&mut self) -> Result<u8, TypeError>

pq_getmsgbyte, which has its own text for an empty value.

Source

pub fn rest(&mut self) -> &'a [u8] ⓘ

The rest of the value, as textrecv and bytearecv read it.

Source

pub fn text(&mut self) -> Result<&'a str, TypeError>

The rest of the value as a string in the server encoding, as pq_getmsgtext reads it for textrecv, varcharrecv, json_recv and the other string types. The client encoding is UTF-8, so the check is the check of pg_verify_mbstr: a zero byte or a byte sequence that is not UTF-8 is an error that shows the bytes of the bad character.

Source

pub fn cstring(&mut self) -> Result<&'a str, TypeError>

pq_getmsgstring: the bytes up to a zero byte, which the function reads too, as a string in the server encoding with the check of Recv::text.

Source

pub fn bool(&mut self) -> Result<bool, TypeError>

boolrecv: any byte other than 0 is true.

Source

pub fn i16(&mut self) -> Result<i16, TypeError>

Source

pub fn i32(&mut self) -> Result<i32, TypeError>

Source

pub fn i64(&mut self) -> Result<i64, TypeError>

Source

pub fn u32(&mut self) -> Result<u32, TypeError>

oidrecv.

Source

pub fn f32(&mut self) -> Result<f32, TypeError>

Source

pub fn f64(&mut self) -> Result<f64, TypeError>

Source

pub fn uuid(&mut self) -> Result<[u8; 16], TypeError>

Source

pub fn finish(self, number: usize) -> Result<(), TypeError>

The check after the receive function: parameter number, from 1, must have no bytes left. A field of COPY ... FROM has the number 0.

Trait Implementations§

Source§

impl<'a> Clone for Recv<'a>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for Recv<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Recv<'a>

§

impl<'a> RefUnwindSafe for Recv<'a>

§

impl<'a> Send for Recv<'a>

§

impl<'a> Sync for Recv<'a>

§

impl<'a> Unpin for Recv<'a>

§

impl<'a> UnsafeUnpin for Recv<'a>

§

impl<'a> UnwindSafe for Recv<'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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.