Skip to main content

PgDataRow

Struct PgDataRow 

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

A temporary view of a single PostgreSQL DataRow message.

Reads columns directly from the wire buffer – no arena copy. Column offsets are pre-computed on construction using a SmallVec that is stack-allocated for up to 16 columns (zero heap allocation for the common case).

Lifetime 'a borrows from Connection::read_buf.

Implementations§

Source§

impl<'a> PgDataRow<'a>

Source

pub fn new(data: &'a [u8]) -> Result<PgDataRow<'a>, DriverError>

Parse column boundaries from a raw DataRow payload.

data is the DataRow message payload (after the ‘D’ type byte and 4-byte length prefix have been stripped by the framing layer).

Source

pub fn get_raw(&self, idx: usize) -> Option<&'a [u8]>

Get the raw bytes for a column, or None if NULL.

Source

pub fn is_null(&self, idx: usize) -> bool

Whether a column is NULL.

Source

pub fn column_count(&self) -> usize

Number of columns.

Source

pub fn get_bool(&self, idx: usize) -> Option<bool>

Get a boolean column value. Returns None on NULL or decode error.

Source

pub fn get_i16(&self, idx: usize) -> Option<i16>

Get an i16 column value.

Source

pub fn get_i32(&self, idx: usize) -> Option<i32>

Get an i32 column value.

Source

pub fn get_i64(&self, idx: usize) -> Option<i64>

Get an i64 column value.

Source

pub fn get_f32(&self, idx: usize) -> Option<f32>

Get an f32 column value.

Source

pub fn get_f64(&self, idx: usize) -> Option<f64>

Get an f64 column value.

Source

pub fn get_str(&self, idx: usize) -> Option<&'a str>

Get a string column value (zero-copy borrow from the wire buffer).

Source

pub fn get_bytes(&self, idx: usize) -> Option<&'a [u8]>

Get a byte slice column value (zero-copy borrow from the wire buffer).

Auto Trait Implementations§

§

impl<'a> Freeze for PgDataRow<'a>

§

impl<'a> RefUnwindSafe for PgDataRow<'a>

§

impl<'a> Send for PgDataRow<'a>

§

impl<'a> Sync for PgDataRow<'a>

§

impl<'a> Unpin for PgDataRow<'a>

§

impl<'a> UnsafeUnpin for PgDataRow<'a>

§

impl<'a> UnwindSafe for PgDataRow<'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> 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.