scylla::transport::legacy_query_result

Struct LegacyQueryResult

Source
#[non_exhaustive]
pub struct LegacyQueryResult { pub rows: Option<Vec<Row>>, pub warnings: Vec<String>, pub tracing_id: Option<Uuid>, pub serialized_size: usize, /* private fields */ }
๐Ÿ‘ŽDeprecated since 0.15.0: Legacy deserialization API is inefficient and is going to be removed soon
Expand description

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

Fields (Non-exhaustive)ยง

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
ยงrows: Option<Vec<Row>>
๐Ÿ‘ŽDeprecated since 0.15.0: Legacy deserialization API is inefficient and is going to be removed soon

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>
๐Ÿ‘ŽDeprecated since 0.15.0: Legacy deserialization API is inefficient and is going to be removed soon

Warnings returned by the database

ยงtracing_id: Option<Uuid>
๐Ÿ‘ŽDeprecated since 0.15.0: Legacy deserialization API is inefficient and is going to be removed soon

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

ยงserialized_size: usize
๐Ÿ‘ŽDeprecated since 0.15.0: Legacy deserialization API is inefficient and is going to be removed soon

The original size of the serialized rows in request

Implementationsยง

Sourceยง

impl LegacyQueryResult

Source

pub fn rows_num(&self) -> Result<usize, RowsExpectedError>

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

Source

pub fn rows(self) -> Result<Vec<Row>, RowsExpectedError>

Returns the received rows when present.
If LegacyQueryResult.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.

Source

pub fn rows_typed<RowT: FromRow>( self, ) -> Result<TypedRowIter<RowT>, RowsExpectedError>

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().

Source

pub fn result_not_rows(&self) -> Result<(), RowsNotExpectedError>

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().

Source

pub fn rows_or_empty(self) -> Vec<Row>

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

Source

pub fn rows_typed_or_empty<RowT: FromRow>(self) -> TypedRowIter<RowT> โ“˜

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

Source

pub fn first_row(self) -> Result<Row, FirstRowError>

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

Source

pub fn first_row_typed<RowT: FromRow>(self) -> Result<RowT, FirstRowTypedError>

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

Source

pub fn maybe_first_row(self) -> Result<Option<Row>, RowsExpectedError>

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().

Source

pub fn maybe_first_row_typed<RowT: FromRow>( self, ) -> Result<Option<RowT>, MaybeFirstRowTypedError>

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().

Source

pub fn single_row(self) -> Result<Row, SingleRowError>

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

Source

pub fn single_row_typed<RowT: FromRow>( self, ) -> Result<RowT, SingleRowTypedError>

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

Source

pub fn col_specs(&self) -> &[ColumnSpec<'_>]

Returns column specifications.

Source

pub fn get_column_spec<'a>( &'a self, name: &str, ) -> Option<(usize, &'a ColumnSpec<'a>)>

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

Trait Implementationsยง

Sourceยง

impl Debug for LegacyQueryResult

Sourceยง

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Sourceยง

impl Default for LegacyQueryResult

Sourceยง

fn default() -> LegacyQueryResult

Returns the โ€œdefault valueโ€ for a type. Read more

Auto Trait Implementationsยง

Blanket Implementationsยง

Sourceยง

impl<T> Any for T
where T: 'static + ?Sized,

Sourceยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Sourceยง

impl<T> Borrow<T> for T
where T: ?Sized,

Sourceยง

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Sourceยง

impl<T> BorrowMut<T> for T
where T: ?Sized,

Sourceยง

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Sourceยง

impl<T> From<T> for T

Sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

Sourceยง

impl<T> Instrument for T

Sourceยง

fn instrument(self, span: Span) -> Instrumented<Self>

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

fn in_current_span(self) -> Instrumented<Self>

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

impl<T, U> Into<U> for T
where U: From<T>,

Sourceยง

fn into(self) -> U

Calls U::from(self).

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

Sourceยง

impl<T> IntoEither for T

Sourceยง

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 more
Sourceยง

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Sourceยง

impl<T> Same for T

Sourceยง

type Output = T

Should always be Self
Sourceยง

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Sourceยง

type Error = Infallible

The type returned in the event of a conversion error.
Sourceยง

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Sourceยง

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Sourceยง

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Sourceยง

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Sourceยง

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Sourceยง

fn vzip(self) -> V

Sourceยง

impl<T> WithSubscriber for T

Sourceยง

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<T> ErasedDestructor for T
where T: 'static,