pub struct ModelName(/* private fields */);Expand description
A validated embedding-model name, and therefore a safe SQL identifier.
Per-model tables (D-005) mean the model name reaches SQL as part of a table
name — embeddings_nomic_v1 — and SQLite cannot bind an identifier as a
parameter, so the name is necessarily spliced into the statement text. That
splice is only safe if the name cannot contain anything but identifier
characters, which is what this type establishes once, at the boundary,
instead of at each of the several call sites that build a statement.
Before this existed, search_vector built its table name with
format!("embeddings_{model}") from an unvalidated &str argument.
The rule is deliberately narrower than SQLite’s: lowercase ASCII, digits and
underscore, first character a letter, 48 characters at most. Rejecting
nomic-v1 rather than quietly rewriting it to nomic_v1 is the same
principle §4.1 applies to timestamps — a silent repair here becomes two
models sharing one table later, which is precisely the outcome per-model
tables exist to prevent.
Implementations§
Trait Implementations§
impl Eq for ModelName
Source§impl Ord for ModelName
impl Ord for ModelName
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for ModelName
impl PartialOrd for ModelName
impl StructuralPartialEq for ModelName
Auto Trait Implementations§
impl Freeze for ModelName
impl RefUnwindSafe for ModelName
impl Send for ModelName
impl Sync for ModelName
impl Unpin for ModelName
impl UnsafeUnpin for ModelName
impl UnwindSafe for ModelName
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request