Struct odbc_api::Bit

source ·
pub struct Bit(pub u8);
Expand description

New type wrapping u8 and binding as SQL_BIT.

If rust would guarantee the representation of bool to be an u8, bool would be the obvious choice instead. Alas it is not and someday on some platform bool might be something else than a u8 so let’s use this new type instead.

Tuple Fields§

§0: u8

Implementations§

Maps true to 1 and false to 0.

use odbc_api::Bit;

assert_eq!(Bit(0), Bit::from_bool(false));
assert_eq!(Bit(1), Bit::from_bool(true));

Maps 1 to true, 0 to false. Panics if Bit should be invalid (not 0 or 1).

Trait Implementations§

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. Read more
Indicates the length of variable sized types. May be zero for fixed sized types. Used to determine the size or existence of input parameters. Read more
Pointer to a value corresponding to the one described by cdata_type.
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. Read more

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

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

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
The SQL data as which the parameter is bound to ODBC.
👎Deprecated: Use associated method buffer_desc instead.
E.g. BufferKind::I64 for i64. The kind can be used in a buffer description to instantiate a super::ColumnarBuffer. Read more
Can be used to instantiate a super::ColumnarBuffer.
Extract the array type from an AnySlice.
Extract the typed nullable buffer from an AnySlice.
Extract the array type from an AnySliceMut.
Extract the typed nullable buffer from an AnySliceMut.
This method returns an Ordering between self and other. Read more
Compares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
Restrict a value to a certain interval. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.