pub struct ValueList<'list> { /* private fields */ }Expand description
Represents a list of values from SQLite.
SQLite provides these when a virtual table is processing all values of an IN constraint simultaneously, see IndexInfoConstraint::set_value_list_wanted for more information.
This struct is not an Iterator by itself. There are two recommended ways to interact with
it. The first is a while let:
use sqlite3_ext::*;
fn filter_list(list: &mut ValueRef) -> Result<()> {
let mut list = ValueList::from_value_ref(list)?;
while let Some(x) = list.next()? {
println!("value is {:?}", x);
}
Ok(())
}Alternatively, the map method turns this struct into a FallibleIterator:
use sqlite3_ext::*;
fn filter_list(list: &mut ValueRef) -> Result<()> {
let list: Vec<String> = ValueList::from_value_ref(list)?
.map(|x| Ok(x.get_str()?.to_owned()))
.collect()?;
println!("values are {:?}", list);
Ok(())
}Implementations§
Source§impl<'list> ValueList<'list>
impl<'list> ValueList<'list>
Sourcepub fn from_value_ref(base: &'list mut ValueRef) -> Result<Self>
pub fn from_value_ref(base: &'list mut ValueRef) -> Result<Self>
Attempt to create a ValueList from a ValueRef.
§Safety
The SQLite documentation states that using this method outside of the VTabCursor::filter method is “undefined and probably harmful”. However, since the feature’s introduction, the underlying mechanism has always (as of SQLite 3.38.5) used the pointer passing interface and is therefore be safe to use with any ValueRef (although such a use will result in an Err).
Requires SQLite 3.38.0.