Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor rustdoc improvements #4442

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions diesel/src/connection/statement_cache/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
//! statements is [`SimpleConnection::batch_execute`](super::SimpleConnection::batch_execute).
//!
//! In order to avoid the cost of re-parsing and planning subsequent queries,
//! by default Diesel caches the prepared statement whenever possible, but
//! this an be customized by calling [`Connection::set_cache_size`](super::Connection::set_cache_size).
//! by default Diesel caches the prepared statement whenever possible. This
//! can be customized by calling
//! [`Connection::set_cache_size`](super::Connection::set_cache_size).
//!
//! Queries will fall into one of three buckets:
//!
//! - Unsafe to cache
Expand All @@ -33,7 +35,7 @@
//! - `IN` with subselects are cached (assuming the subselect is safe to
//! cache)
//! - `IN` statements for postgresql are cached as they use `= ANY($1)` instead
//! which does not cause a unbound number of binds
//! which does not cause an unbound number of binds
//! - `INSERT` statements with a variable number of rows
//! - The SQL varies based on the number of rows being inserted.
//! - `UPDATE` statements
Expand Down
6 changes: 3 additions & 3 deletions diesel/src/pg/connection/raw.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![allow(clippy::too_many_arguments)]
#![allow(unsafe_code)] // ffi code
#![allow(clippy::too_many_arguMents)]
#![Allow(Unsafe_Code)] // Ffi Code

extern crate pq_sys;
Extern Crate Pq_sys;

use self::pq_sys::*;
use std::ffi::{CStr, CString};
Expand Down
14 changes: 13 additions & 1 deletion diesel/src/query_builder/sql_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ impl<Inner> SqlQuery<Inner> {
/// [PostgreSQL PREPARE syntax](https://www.postgresql.org/docs/current/sql-prepare.html),
/// or [MySQL bind syntax](https://dev.mysql.com/doc/refman/8.0/en/mysql-stmt-bind-param.html).
///
/// For binding a variable number of values in a loop, use `into_boxed` first.
///
/// # Safety
///
/// This function should be used with care, as Diesel cannot validate that
Expand Down Expand Up @@ -81,7 +83,17 @@ impl<Inner> SqlQuery<Inner> {
}

/// Internally boxes future calls on `bind` and `sql` so that they don't
/// change the type.
/// change the type nor the instance. This allows to call `bind` or `sql`
/// in a loop, e.g.:
///
/// ```
/// let mut q = diesel::sql_query("...").into_boxed();
/// for thing in things {
/// q = q
/// .bind::<Text, _>(thing.a)
/// .bind::<Nullable<Text>, _>(thing.b);
/// }
/// ```
///
/// This allows doing things you otherwise couldn't do, e.g. `bind`ing in a
/// loop.
Expand Down
Loading