Skip to content

Commit 4d66e90

Browse files
committed
Minor documentation improvements
1 parent 6470cdd commit 4d66e90

File tree

1 file changed

+4
-9
lines changed
  • diesel/src/sqlite/connection

1 file changed

+4
-9
lines changed

diesel/src/sqlite/connection/stmt.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use std::io::{stderr, Write};
1313
use std::mem::ManuallyDrop;
1414
use std::os::raw as libc;
1515
use std::ptr::{self, NonNull};
16+
1617
#[allow(missing_debug_implementations)]
1718
pub(in crate::sqlite) struct Statement {
1819
inner_statement: NonNull<ffi::sqlite3_stmt>,
@@ -59,12 +60,6 @@ impl Statement {
5960
value: &SqliteBindValue<'_>,
6061
bind_index: i32,
6162
) -> QueryResult<()> {
62-
// This unsafe block assumes the following invariants:
63-
//
64-
// - `stmt` points to valid memory
65-
// - If `self.ty` is anything other than `Binary` or `Text`, the appropriate
66-
// number of bytes were written to `value` for an integer of the
67-
// corresponding size.
6863
let result = match (tpe, value) {
6964
(_, SqliteBindValue::Null) => {
7065
ffi::sqlite3_bind_null(self.inner_statement.as_ptr(), bind_index)
@@ -214,7 +209,7 @@ impl<'stmt, 'query> BoundStatement<'stmt, 'query> {
214209
where
215210
T: QueryFragment<Sqlite> + QueryId + 'query,
216211
{
217-
// Don't use a trait object here to prevent using virtual function call
212+
// Don't use a trait object here to prevent using a virtual function call
218213
// For sqlite this can introduce a measurable overhead
219214
let mut query = ManuallyDrop::new(query);
220215

@@ -363,8 +358,8 @@ impl<'stmt, 'query> StatementUse<'stmt, 'query> {
363358
// https://sqlite.org/c3ref/column_name.html
364359
//
365360
// Note: This function is marked as unsafe, as calling it can invalidate
366-
// any existing column name pointer. It should maximally be called once
367-
// per column at all.
361+
// any existing column name pointer. To prevent that,
362+
// it should maximally be called once per column at all.
368363
pub(super) unsafe fn column_name(&self, idx: i32) -> *const str {
369364
let name = {
370365
let column_name =

0 commit comments

Comments
 (0)