Struct odbc_api::Nullable

source ·
pub struct Nullable<T> { /* private fields */ }
Expand description

Wraps a type T together with an additional indicator. This way the type gains a Null representation, those memory layout is compatible with ODBC.

Implementations§

source§

impl<T> Nullable<T>

source

pub fn new(value: T) -> Self

source

pub fn null() -> Selfwhere T: Default,

source

pub fn as_opt(&self) -> Option<&T>

source

pub fn into_opt(self) -> Option<T>

Trait Implementations§

source§

impl<T> CData for Nullable<T>where T: Pod,

source§

fn cdata_type(&self) -> CDataType

The identifier of the C data type of the value buffer. When it is retrieving data from the data source with fetch, the driver converts the data to this type. When it sends data to the source, the driver converts the data from this type.
source§

fn indicator_ptr(&self) -> *const isize

Indicates the length of variable sized types. May be zero for fixed sized types. Used to determine the size or existence of input parameters.
source§

fn value_ptr(&self) -> *const c_void

Pointer to a value corresponding to the one described by cdata_type.
source§

fn buffer_length(&self) -> isize

Maximum length of the type in bytes (not characters). It is required to index values in bound buffers, if more than one parameter is bound. Can be set to zero for types not bound as parameter arrays, i.e. CStr.
source§

impl<T> CDataMut for Nullable<T>where T: Pod,

source§

fn mut_indicator_ptr(&mut self) -> *mut isize

Indicates the length of variable sized types. May be zero for fixed sized types.
source§

fn mut_value_ptr(&mut self) -> *mut c_void

Pointer to a value corresponding to the one described by cdata_type.
source§

impl<T: Clone> Clone for Nullable<T>

source§

fn clone(&self) -> Nullable<T>

Returns a copy 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<T> HasDataType for Nullable<T>where T: Pod + HasDataType,

source§

fn data_type(&self) -> DataType

The SQL data as which the parameter is bound to ODBC.
source§

impl<T> CElement for Nullable<T>where T: Pod,

source§

impl<T: Copy> Copy for Nullable<T>

source§

impl<T> OutputParameter for Nullable<T>where T: Pod + HasDataType,

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for Nullable<T>where T: RefUnwindSafe,

§

impl<T> Send for Nullable<T>where T: Send,

§

impl<T> Sync for Nullable<T>where T: Sync,

§

impl<T> Unpin for Nullable<T>where T: Unpin,

§

impl<T> UnwindSafe for Nullable<T>where T: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<T> InputParameter for Twhere T: CElement + HasDataType,