mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-10-02 23:35:20 +00:00
Merge pull request #216 from Ace4896/must-use-types
Mark several types as #[must_use]
This commit is contained in:
commit
283f0ef6d8
@ -39,6 +39,7 @@ use crate::row::HasRow;
|
|||||||
///
|
///
|
||||||
/// [`Executor::fetch`]: crate::executor::Executor::fetch
|
/// [`Executor::fetch`]: crate::executor::Executor::fetch
|
||||||
/// [`Query::fetch`]: crate::query::Query::fetch
|
/// [`Query::fetch`]: crate::query::Query::fetch
|
||||||
|
#[must_use = "cursor must have `.next()` called to execute query"]
|
||||||
pub trait Cursor<'c, 'q>
|
pub trait Cursor<'c, 'q>
|
||||||
where
|
where
|
||||||
Self: Send + Unpin + private::Sealed,
|
Self: Send + Unpin + private::Sealed,
|
||||||
|
@ -14,6 +14,7 @@ use crate::row::HasRow;
|
|||||||
use crate::types::Type;
|
use crate::types::Type;
|
||||||
|
|
||||||
/// Raw SQL query with bind parameters. Returned by [`query`][crate::query::query].
|
/// Raw SQL query with bind parameters. Returned by [`query`][crate::query::query].
|
||||||
|
#[must_use = "query must be executed to affect database"]
|
||||||
pub struct Query<'q, DB>
|
pub struct Query<'q, DB>
|
||||||
where
|
where
|
||||||
DB: Database,
|
DB: Database,
|
||||||
@ -31,6 +32,7 @@ where
|
|||||||
///
|
///
|
||||||
/// [Query::bind] is also omitted; stylistically we recommend placing your `.bind()` calls
|
/// [Query::bind] is also omitted; stylistically we recommend placing your `.bind()` calls
|
||||||
/// before `.try_map()` anyway.
|
/// before `.try_map()` anyway.
|
||||||
|
#[must_use = "query must be executed to affect database"]
|
||||||
pub struct Map<'q, DB, F>
|
pub struct Map<'q, DB, F>
|
||||||
where
|
where
|
||||||
DB: Database,
|
DB: Database,
|
||||||
|
@ -9,6 +9,7 @@ use crate::types::Type;
|
|||||||
/// Raw SQL query with bind parameters, mapped to a concrete type
|
/// Raw SQL query with bind parameters, mapped to a concrete type
|
||||||
/// using [`FromRow`](trait.FromRow.html). Returned
|
/// using [`FromRow`](trait.FromRow.html). Returned
|
||||||
/// by [`query_as`](fn.query_as.html).
|
/// by [`query_as`](fn.query_as.html).
|
||||||
|
#[must_use = "query must be executed to affect database"]
|
||||||
pub struct QueryAs<'q, DB, O>
|
pub struct QueryAs<'q, DB, O>
|
||||||
where
|
where
|
||||||
DB: Database,
|
DB: Database,
|
||||||
|
@ -33,6 +33,7 @@ use crate::runtime::spawn;
|
|||||||
/// [`rollback`]: #method.rollback
|
/// [`rollback`]: #method.rollback
|
||||||
// Transaction<PoolConnection<PgConnection>>
|
// Transaction<PoolConnection<PgConnection>>
|
||||||
// Transaction<PgConnection>
|
// Transaction<PgConnection>
|
||||||
|
#[must_use = "transaction rolls back if not explicitly `.commit()`ed"]
|
||||||
pub struct Transaction<C>
|
pub struct Transaction<C>
|
||||||
where
|
where
|
||||||
C: Connection,
|
C: Connection,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user