pub struct IndexSpec<T> {
pub column: &'static str,
pub extractor: fn(&T) -> Option<String>,
pub unique: bool,
}Expand description
Specification for a single secondary column peeled out of T at write
time. All peeled columns are typed TEXT in SQLite; None from the
extractor becomes SQL NULL.
Fields§
§column: &'static strColumn name. Must be a valid SQL identifier (a-z, A-Z, 0-9, _) and
is splat directly into the generated DDL, so this MUST be a
compile-time string literal.
extractor: fn(&T) -> Option<String>Extractor pulling the column value out of T. None is written as
SQL NULL.
unique: boolIf true, column is included in a table-level UNIQUE(...)
constraint. SQLite treats NULLs as distinct in UNIQUE, so
nullable unique columns only enforce uniqueness among non-NULL
values. Callers needing “unique including NULL” must enforce it in
application code (see environments.rs for the pattern).
Auto Trait Implementations§
impl<T> Freeze for IndexSpec<T>
impl<T> RefUnwindSafe for IndexSpec<T>
impl<T> Send for IndexSpec<T>
impl<T> Sync for IndexSpec<T>
impl<T> Unpin for IndexSpec<T>
impl<T> UnsafeUnpin for IndexSpec<T>
impl<T> UnwindSafe for IndexSpec<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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