pub unsafe trait VTab<'vtab>: Sized {
type Aux: Send + Sync + 'static;
type Cursor: VTabCursor;
// Required methods
fn connect(
db: &mut VTabConnection,
aux: Option<&Self::Aux>,
module_name: &[u8],
database_name: &[u8],
table_name: &[u8],
args: &[&[u8]],
) -> Result<(Cow<'static, CStr>, Self)>;
fn best_index(&self, info: &mut IndexInfo) -> Result<bool>;
fn open(&'vtab mut self) -> Result<Self::Cursor>;
}Expand description
Eponymous-only virtual table instance trait.
§Safety
The first item in a struct implementing VTab must be
rusqlite::sqlite3_vtab, and the struct must be #[repr(C)].
ⓘ
#[repr(C)]
struct MyTab {
/// Base class. Must be first
base: rusqlite::vtab::sqlite3_vtab,
/* Virtual table implementations will typically add additional fields */
}(See SQLite doc)
Required Associated Types§
Sourcetype Aux: Send + Sync + 'static
type Aux: Send + Sync + 'static
Client data passed to Connection::create_module.
Sourcetype Cursor: VTabCursor
type Cursor: VTabCursor
Specific cursor implementation
Required Methods§
Sourcefn connect(
db: &mut VTabConnection,
aux: Option<&Self::Aux>,
module_name: &[u8],
database_name: &[u8],
table_name: &[u8],
args: &[&[u8]],
) -> Result<(Cow<'static, CStr>, Self)>
fn connect( db: &mut VTabConnection, aux: Option<&Self::Aux>, module_name: &[u8], database_name: &[u8], table_name: &[u8], args: &[&[u8]], ) -> Result<(Cow<'static, CStr>, Self)>
Establish a new connection to an existing virtual table.
(See SQLite doc)
Sourcefn best_index(&self, info: &mut IndexInfo) -> Result<bool>
fn best_index(&self, info: &mut IndexInfo) -> Result<bool>
Determine the best way to access the virtual table.
(See SQLite doc)
Returning Ok(false) means unusable / SQLITE_CONSTRAINT.
Sourcefn open(&'vtab mut self) -> Result<Self::Cursor>
fn open(&'vtab mut self) -> Result<Self::Cursor>
Create a new cursor used for accessing a virtual table. (See SQLite doc)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".