pub struct TableSource { /* private fields */ }Expand description
A built-in PickerSource over a single table: candidates are rows whose
label_col matches (case-insensitive substring), and a stored id resolves by
id_col. hint_col, when set, supplies each node’s disambiguating hint. A
hierarchy or a computed label implements PickerSource directly instead.
Implementations§
Source§impl TableSource
impl TableSource
pub fn new( table: impl Into<String>, id_col: impl Into<String>, label_col: impl Into<String>, ) -> Self
Sourcepub fn with_hint(self, hint_col: impl Into<String>) -> Self
pub fn with_hint(self, hint_col: impl Into<String>) -> Self
Sets the column supplying each node’s disambiguating hint.
Sourcepub fn with_search(self, search: SearchProfile) -> Self
pub fn with_search(self, search: SearchProfile) -> Self
Sets how a query folds and widens before it is matched.
A profile that folds more than case (diacritics, punctuation) only helps
where label_col holds values folded the same way, since the fold runs on
the query. Against a raw column, keep the default.
Trait Implementations§
Source§impl PickerSource for TableSource
impl PickerSource for TableSource
Source§fn search<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
db: &'life1 Db,
q: &'life2 str,
limit: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<PickerNode>, PickerError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn search<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
db: &'life1 Db,
q: &'life2 str,
limit: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<PickerNode>, PickerError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Candidates matching
q, capped at limit (the caller clamps it).Source§fn resolve<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
db: &'life1 Db,
id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<PickerNode>, PickerError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn resolve<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
db: &'life1 Db,
id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<PickerNode>, PickerError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
The node a stored
id refers to, or None if it no longer exists.Auto Trait Implementations§
impl !RefUnwindSafe for TableSource
impl !UnwindSafe for TableSource
impl Freeze for TableSource
impl Send for TableSource
impl Sync for TableSource
impl Unpin for TableSource
impl UnsafeUnpin for TableSource
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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