RowField

Struct RowField 

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

The RowField struct represents a row within the RowDescription message.

Available fields:

  • name: The field name

  • table_oid: The table ID (OID) of the table the column is from, or 0 if not a column reference

  • column_attr_number: The attribute number of the column, or 0 if not a column reference

  • data_type_oid: The object ID of the field’s data type

  • data_type_size: The data type size (negative if variable size)

  • type_modifier: The type modifier

  • format_code: The format code being used for the field (0 for text, 1 for binary)

Implementations§

Source§

impl<'a> RowField<'a>

Source

pub const fn is_buffer(buf: &'a [u8]) -> bool

Checks the constant values for this struct to determine whether this message matches.

Source

pub fn new(buf: &'a [u8]) -> Result<Self, ParseError>

Creates a new instance of this struct from a given buffer.

Source

pub fn name(&self) -> ZTString<'a>

The field name

Source

pub fn table_oid(&self) -> i32

The table ID (OID) of the table the column is from, or 0 if not a column reference

Source

pub fn column_attr_number(&self) -> i16

The attribute number of the column, or 0 if not a column reference

Source

pub fn data_type_oid(&self) -> i32

The object ID of the field’s data type

Source

pub fn data_type_size(&self) -> i16

The data type size (negative if variable size)

Source

pub fn type_modifier(&self) -> i32

The type modifier

Source

pub fn format_code(&self) -> FormatCode

The format code being used for the field (0 for text, 1 for binary)

Source

pub fn to_vec(self) -> Vec<u8>

Trait Implementations§

Source§

impl AsRef<[u8]> for RowField<'_>

Source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<'a> Clone for RowField<'a>

Source§

fn clone(&self) -> RowField<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a> DataType for RowField<'a>

Source§

impl Debug for RowField<'_>

Source§

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

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

impl<'a> DecoderFor<'a, RowField<'a>> for RowField<'a>

Source§

fn decode_for(buf: &mut &'a [u8]) -> Result<Self, ParseError>

Source§

impl<'a> Default for RowField<'a>

Source§

fn default() -> RowField<'a>

Returns the “default value” for a type. Read more
Source§

impl<NAME, TABLE_OID, COLUMN_ATTR_NUMBER, DATA_TYPE_OID, DATA_TYPE_SIZE, TYPE_MODIFIER, FORMAT_CODE> EncoderFor<RowField<'static>> for &RowFieldBuilder<NAME, TABLE_OID, COLUMN_ATTR_NUMBER, DATA_TYPE_OID, DATA_TYPE_SIZE, TYPE_MODIFIER, FORMAT_CODE>
where NAME: EncoderFor<ZTString<'static>>, TABLE_OID: EncoderFor<i32>, COLUMN_ATTR_NUMBER: EncoderFor<i16>, DATA_TYPE_OID: EncoderFor<i32>, DATA_TYPE_SIZE: EncoderFor<i16>, TYPE_MODIFIER: EncoderFor<i32>, FORMAT_CODE: EncoderFor<FormatCode>,

Source§

fn encode_for(&self, buf: &mut BufWriter<'_>)

Source§

impl<'a> EncoderFor<RowField<'static>> for RowField<'a>

Source§

fn encode_for(&self, buf: &mut BufWriter<'_>)

Source§

impl<NAME, TABLE_OID, COLUMN_ATTR_NUMBER, DATA_TYPE_OID, DATA_TYPE_SIZE, TYPE_MODIFIER, FORMAT_CODE> EncoderFor<RowField<'static>> for RowFieldBuilder<NAME, TABLE_OID, COLUMN_ATTR_NUMBER, DATA_TYPE_OID, DATA_TYPE_SIZE, TYPE_MODIFIER, FORMAT_CODE>
where NAME: EncoderFor<ZTString<'static>>, TABLE_OID: EncoderFor<i32>, COLUMN_ATTR_NUMBER: EncoderFor<i16>, DATA_TYPE_OID: EncoderFor<i32>, DATA_TYPE_SIZE: EncoderFor<i16>, TYPE_MODIFIER: EncoderFor<i32>, FORMAT_CODE: EncoderFor<FormatCode>,

Source§

fn encode_for(&self, buf: &mut BufWriter<'_>)

Source§

impl PartialEq for RowField<'_>

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> StructMeta for RowField<'a>

Implements a trait containing the fields of the struct, allowing us to compute some useful things.

Source§

const FIELDS: StructFields

Source§

type Struct<'__struct> = RowField<'__struct>

Source§

fn new<'__next_lifetime>( buf: &'__next_lifetime [u8], ) -> Result<Self::Struct<'__next_lifetime>, ParseError>

Source§

fn to_vec(&self) -> Vec<u8>

Source§

const FIELD_COUNT: usize = _

Source§

const IS_FIXED_SIZE: bool = _

Source§

const FIXED_SIZE: Option<usize> = _

Source§

const LENGTH_FIELD_INDEX: Option<usize> = _

Source§

const HAS_LENGTH_FIELD: bool = _

Source§

impl<'a> Copy for RowField<'a>

Source§

impl Eq for RowField<'_>

Source§

impl StructAttributeFieldCount<{<$name<'_> as $crate::prelude::StructMeta>::FIELD_COUNT}> for RowField<'_>

Implements a trait indicating that the struct has a field count.

Source§

impl StructAttributeFixedSize<{<$name<'_> as $crate::prelude::StructMeta>::IS_FIXED_SIZE}> for RowField<'_>

Implements a trait indicating that the struct has a fixed size. This needs to be a trait-generic rather than and associated constant for us to use elsewhere.

Source§

impl StructAttributeHasLengthField<{<$name<'_> as $crate::prelude::StructMeta>::HAS_LENGTH_FIELD}> for RowField<'_>

Implements a trait indicating that the struct has a length field.

Auto Trait Implementations§

§

impl<'a> Freeze for RowField<'a>

§

impl<'a> RefUnwindSafe for RowField<'a>

§

impl<'a> Send for RowField<'a>

§

impl<'a> Sync for RowField<'a>

§

impl<'a> Unpin for RowField<'a>

§

impl<'a> UnwindSafe for RowField<'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> EncoderFor<Rest<'static>> for T
where T: AsRef<[u8]>,

Source§

fn encode_for(&self, buf: &mut BufWriter<'_>)

Source§

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

Source§

fn to_vec<F>(&self) -> Vec<u8>
where F: 'static, Self: EncoderFor<F>,

Convert this builder into a vector of bytes. This is generally not the most efficient way to perform serialization.
Source§

fn encode_buffer<F>(&self, buf: &mut [u8]) -> Result<usize, usize>
where F: 'static, Self: EncoderFor<F>,

Encode this builder into a given buffer. If the buffer is too small, the function will return the number of bytes required to encode the builder.
Source§

fn encode_buffer_uninit<'a, F>( &self, buf: &'a mut [MaybeUninit<u8>], ) -> Result<&'a mut [u8], usize>
where F: 'static, Self: EncoderFor<F>,

Encode this builder into a given buffer. If the buffer is too small, the function will return the number of bytes required to encode the builder.
Source§

fn measure<F>(&self) -> usize
where F: 'static, Self: EncoderFor<F>,

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 = 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.