pub trait Bind {
const COLUMNS: usize;
// Required method
fn bind(&self, binder: &mut Binder<'_, '_>) -> SqlResult<()>;
// Provided method
fn bind_to(&self, stmt: &mut Statement<'_>) -> SqlResult<()> { ... }
}Required Associated Constants§
Required Methods§
Provided Methods§
Sourcefn bind_to(&self, stmt: &mut Statement<'_>) -> SqlResult<()>
fn bind_to(&self, stmt: &mut Statement<'_>) -> SqlResult<()>
Bind to the Statement’s parameters starting from the beginning
This method will always bind to the parameters starting from the first parameter, even if those parameters were already bound to by previous call of bind_to!
So, unless you want to overwrite previously bound parameters, do not call this function multiple times on the same Statement.
For instance, if you want to bind "Hello" and 123 to a statement, don’t do:
"Hello".bind_to(stmt)?;
123.bind_to(stmt)?; // Wrong: this overwrites the "Hello"Instead, call it once with a tuple like so:
("Hello", 123).bind_to(stmt)?; // Correct: binds both "Hello" and 123Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".