pub struct QueryResult {
    pub rows: Option<Vec<Row>>,
    pub warnings: Vec<String>,
    pub tracing_id: Option<Uuid>,
    pub paging_state: Option<Bytes>,
    pub col_specs: Vec<ColumnSpec>,
}
Expand description

Result of a single query
Contains all rows returned by the database and some more information

Fields

rows: Option<Vec<Row>>

Rows returned by the database.
Queries like SELECT will have Some(Vec), while queries like INSERT will have None.
Can contain an empty Vec.

warnings: Vec<String>

Warnings returned by the database

tracing_id: Option<Uuid>

CQL Tracing uuid - can only be Some if tracing is enabled for this query

paging_state: Option<Bytes>

Paging state returned from the server

col_specs: Vec<ColumnSpec>

Column specification returned from the server

Implementations

Returns the number of received rows.
Fails when the query isn’t of a type that could return rows, same as rows().

Returns the received rows when present.
If QueryResult.rows is None, which means that this query is not supposed to return rows (e.g INSERT), returns an error.
Can return an empty Vec.

Returns the received rows parsed as the given type.
Equal to rows()?.into_typed().
Fails when the query isn’t of a type that could return rows, same as rows().

Returns Ok for a result of a query that shouldn’t contain any rows.
Will return Ok for INSERT result, but a SELECT result, even an empty one, will cause an error.
Opposite of rows().

Returns rows when QueryResult.rows is Some, otherwise an empty Vec.
Equal to rows().unwrap_or_default().

Returns rows parsed as the given type.
When QueryResult.rows is None, returns 0 rows.
Equal to rows_or_empty().into_typed::<RowT>().

Returns first row from the received rows.
When the first row is not available, returns an error.

Returns first row from the received rows parsed as the given type.
When the first row is not available, returns an error.

Returns Option<RowT> containing the first of a result.
Fails when the query isn’t of a type that could return rows, same as rows().

Returns Option<RowT> containing the first of a result.
Fails when the query isn’t of a type that could return rows, same as rows().

Returns the only received row.
Fails if the result is anything else than a single row.\

Returns the only received row parsed as the given type.
Fails if the result is anything else than a single row.\

Returns a column specification for a column with given name, or None if not found

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more