pub struct ResultSet { /* private fields */ }Implementations§
Source§impl ResultSet
impl ResultSet
pub fn num_rows(&self) -> usize
pub fn schema(&self) -> &Schema
Sourcepub fn raw_rows(&self) -> &[Vec<Option<String>>]
pub fn raw_rows(&self) -> &[Vec<Option<String>>]
Returns the unparsed JSON-format cells exactly as received from ScopeDB.
Sourcepub fn to_values(&self) -> Result<Vec<Vec<Value>>, Error>
pub fn to_values(&self) -> Result<Vec<Vec<Value>>, Error>
Converts all result cells to their typed Rust representation.
Sourcepub fn into_values(self) -> Result<Vec<Vec<Value>>, Error>
pub fn into_values(self) -> Result<Vec<Vec<Value>>, Error>
Consumes the result set and returns typed rows.
Sourcepub fn to_objects(&self) -> Result<Vec<ResultObject>, Error>
pub fn to_objects(&self) -> Result<Vec<ResultObject>, Error>
Converts all rows to maps keyed by unique output column names.
Duplicate output names are rejected instead of silently discarding a
value. Use ResultSet::to_values when a query intentionally returns
duplicate column names.
Sourcepub fn into_objects(self) -> Result<Vec<ResultObject>, Error>
pub fn into_objects(self) -> Result<Vec<ResultObject>, Error>
Consumes the result set and returns rows keyed by output column name.
Examples found in repository?
examples/statement.rs (line 22)
18async fn main() -> Result<(), Box<dyn std::error::Error>> {
19 let client = common::client()?;
20
21 let result = client.query("SELECT 1 AS ready").await?;
22 let rows = result.into_objects()?;
23 println!("rows: {rows:?}");
24
25 // Keep the handle when an application needs progress, cancellation, or a
26 // durable statement ID before waiting for the result.
27 let mut handle = client.statement("SELECT 2 AS value").submit().await?;
28 let statement_id = handle.statement_id();
29 println!(
30 "statement {statement_id} submitted: {:?}",
31 handle.snapshot()
32 );
33 let status = handle.refresh().await?;
34 println!("statement {statement_id}: {status:?}");
35 let result = handle.wait().await?;
36 println!("handle rows: {:?}", result.into_objects()?);
37 Ok(())
38}Trait Implementations§
Auto Trait Implementations§
impl Freeze for ResultSet
impl RefUnwindSafe for ResultSet
impl Send for ResultSet
impl Sync for ResultSet
impl Unpin for ResultSet
impl UnsafeUnpin for ResultSet
impl UnwindSafe for ResultSet
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