LogicalFieldId

Struct LogicalFieldId 

Source
pub struct LogicalFieldId { /* private fields */ }
Expand description

A namespaced logical identifier for a column.

This 64-bit struct is designed to prevent ID collisions by partitioning the key space into distinct namespaces, table IDs, and field IDs.

Implementations§

Source§

impl LogicalFieldId

Source

pub const fn new() -> Self

Returns an instance with zero initialized data.

Source§

impl LogicalFieldId

Source

pub const fn into_bytes(self) -> [u8; 8]

Returns the underlying bits.

§Layout

The returned byte array is layed out in the same way as described here.

Source

pub const fn from_bytes(bytes: [u8; 8]) -> Self

Converts the given bytes directly into the bitfield struct.

Source§

impl LogicalFieldId

Source

pub fn field_id(&self) -> <B32 as Specifier>::InOut

Returns the value of field_id. The specific field/column within a table (up to ~4.3 billion).

Source

pub fn field_id_or_err( &self, ) -> Result<<B32 as Specifier>::InOut, InvalidBitPattern<<B32 as Specifier>::Bytes>>

Returns the value of field_id.

§Errors

If the returned value contains an invalid bit pattern for field_id. The specific field/column within a table (up to ~4.3 billion).

Source

pub fn with_field_id(self, new_val: <B32 as Specifier>::InOut) -> Self

Returns a copy of the bitfield with the value of field_id set to the given value.

§Panics

If the given value is out of bounds for field_id. The specific field/column within a table (up to ~4.3 billion).

Source

pub fn with_field_id_checked( self, new_val: <B32 as Specifier>::InOut, ) -> Result<Self, OutOfBounds>

Returns a copy of the bitfield with the value of field_id set to the given value.

§Errors

If the given value is out of bounds for field_id. The specific field/column within a table (up to ~4.3 billion).

Source

pub fn set_field_id(&mut self, new_val: <B32 as Specifier>::InOut)

Sets the value of field_id to the given value.

§Panics

If the given value is out of bounds for field_id. The specific field/column within a table (up to ~4.3 billion).

Source

pub fn set_field_id_checked( &mut self, new_val: <B32 as Specifier>::InOut, ) -> Result<(), OutOfBounds>

Sets the value of field_id to the given value.

§Errors

If the given value is out of bounds for field_id. The specific field/column within a table (up to ~4.3 billion).

Source

pub fn table_id(&self) -> <B16 as Specifier>::InOut

Returns the value of table_id. The table this field belongs to (up to 65,535).

Source

pub fn table_id_or_err( &self, ) -> Result<<B16 as Specifier>::InOut, InvalidBitPattern<<B16 as Specifier>::Bytes>>

Returns the value of table_id.

§Errors

If the returned value contains an invalid bit pattern for table_id. The table this field belongs to (up to 65,535).

Source

pub fn with_table_id(self, new_val: <B16 as Specifier>::InOut) -> Self

Returns a copy of the bitfield with the value of table_id set to the given value.

§Panics

If the given value is out of bounds for table_id. The table this field belongs to (up to 65,535).

Source

pub fn with_table_id_checked( self, new_val: <B16 as Specifier>::InOut, ) -> Result<Self, OutOfBounds>

Returns a copy of the bitfield with the value of table_id set to the given value.

§Errors

If the given value is out of bounds for table_id. The table this field belongs to (up to 65,535).

Source

pub fn set_table_id(&mut self, new_val: <B16 as Specifier>::InOut)

Sets the value of table_id to the given value.

§Panics

If the given value is out of bounds for table_id. The table this field belongs to (up to 65,535).

Source

pub fn set_table_id_checked( &mut self, new_val: <B16 as Specifier>::InOut, ) -> Result<(), OutOfBounds>

Sets the value of table_id to the given value.

§Errors

If the given value is out of bounds for table_id. The table this field belongs to (up to 65,535).

Source

pub fn namespace(&self) -> <Namespace as Specifier>::InOut

Returns the value of namespace. The type of data this ID represents (up to 65,536 namespaces).

Source

pub fn namespace_or_err( &self, ) -> Result<<Namespace as Specifier>::InOut, InvalidBitPattern<<Namespace as Specifier>::Bytes>>

Returns the value of namespace.

§Errors

If the returned value contains an invalid bit pattern for namespace. The type of data this ID represents (up to 65,536 namespaces).

Source

pub fn with_namespace(self, new_val: <Namespace as Specifier>::InOut) -> Self

Returns a copy of the bitfield with the value of namespace set to the given value.

§Panics

If the given value is out of bounds for namespace. The type of data this ID represents (up to 65,536 namespaces).

Source

pub fn with_namespace_checked( self, new_val: <Namespace as Specifier>::InOut, ) -> Result<Self, OutOfBounds>

Returns a copy of the bitfield with the value of namespace set to the given value.

§Errors

If the given value is out of bounds for namespace. The type of data this ID represents (up to 65,536 namespaces).

Source

pub fn set_namespace(&mut self, new_val: <Namespace as Specifier>::InOut)

Sets the value of namespace to the given value.

§Panics

If the given value is out of bounds for namespace. The type of data this ID represents (up to 65,536 namespaces).

Source

pub fn set_namespace_checked( &mut self, new_val: <Namespace as Specifier>::InOut, ) -> Result<(), OutOfBounds>

Sets the value of namespace to the given value.

§Errors

If the given value is out of bounds for namespace. The type of data this ID represents (up to 65,536 namespaces).

Source§

impl LogicalFieldId

Source

pub fn from_parts( namespace: Namespace, table_id: TableId, field_id: FieldId, ) -> Self

Build a logical field identifier from its namespace, table, and field components.

Source

pub fn for_user(table_id: TableId, field_id: FieldId) -> Self

Convenience constructor for user data columns.

Source

pub fn for_user_table_0(field_id: FieldId) -> Self

Convenience constructor for user data columns in table 0.

Many tests use table 0 by default; this method avoids repeating the table ID literal.

Trait Implementations§

Source§

impl CheckTotalSizeMultipleOf8 for LogicalFieldId

Source§

type Size = TotalSize<[(); 0]>

Source§

impl Clone for LogicalFieldId

Source§

fn clone(&self) -> LogicalFieldId

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 Debug for LogicalFieldId

Source§

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

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

impl Default for LogicalFieldId

Source§

fn default() -> LogicalFieldId

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

impl From<LogicalFieldId> for Projection

Source§

fn from(logical_field_id: LogicalFieldId) -> Self

Converts to this type from the input type.
Source§

impl From<LogicalFieldId> for u64
where [(); 64]: IsU64Compatible,

Source§

fn from(__bf_bitfield: LogicalFieldId) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for LogicalFieldId
where [(); 64]: IsU64Compatible,

Source§

fn from(__bf_prim: u64) -> Self

Converts to this type from the input type.
Source§

impl Hash for LogicalFieldId

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for LogicalFieldId

Source§

fn eq(&self, other: &LogicalFieldId) -> 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 Copy for LogicalFieldId

Source§

impl Eq for LogicalFieldId

Source§

impl StructuralPartialEq for LogicalFieldId

Auto Trait Implementations§

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.
Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,