Skip to content

Commit 7e29e3a

Browse files
committed
libsql: Make Statement::run() immutable
1 parent bba2cfc commit 7e29e3a

6 files changed

Lines changed: 8 additions & 8 deletions

File tree

libsql/src/hrana/hyper.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ impl crate::statement::Stmt for crate::hrana::Statement<HttpSender> {
245245
self.query(params).await
246246
}
247247

248-
async fn run(&mut self, params: &Params) -> crate::Result<()> {
248+
async fn run(&self, params: &Params) -> crate::Result<()> {
249249
self.run(params).await
250250
}
251251

libsql/src/hrana/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ where
170170
Ok(result.affected_row_count as usize)
171171
}
172172

173-
pub async fn run(&mut self, params: &Params) -> crate::Result<()> {
173+
pub async fn run(&self, params: &Params) -> crate::Result<()> {
174174
let mut stmt = self.inner.clone();
175175
bind_params(params.clone(), &mut stmt);
176176

libsql/src/local/impls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ impl Stmt for LibsqlStmt {
122122
stmt.query(&params).map(LibsqlRows).map(Rows::new)
123123
}
124124

125-
async fn run(&mut self, params: &Params) -> Result<()> {
125+
async fn run(&self, params: &Params) -> Result<()> {
126126
let params = params.clone();
127127
let stmt = self.0.clone();
128128

libsql/src/replication/connection.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -722,8 +722,8 @@ impl Stmt for RemoteStatement {
722722
Ok(Rows::new(RemoteRows(rows, 0)))
723723
}
724724

725-
async fn run(&mut self, params: &Params) -> Result<()> {
726-
if let Some(stmt) = &mut self.local_statement {
725+
async fn run(&self, params: &Params) -> Result<()> {
726+
if let Some(stmt) = &self.local_statement {
727727
return stmt.run(params.clone()).await;
728728
}
729729

libsql/src/statement.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub(crate) trait Stmt {
1212

1313
async fn query(&self, params: &Params) -> Result<Rows>;
1414

15-
async fn run(&mut self, params: &Params) -> Result<()>;
15+
async fn run(&self, params: &Params) -> Result<()>;
1616

1717
fn interrupt(&self) -> Result<()>;
1818

@@ -58,7 +58,7 @@ impl Statement {
5858
/// provided to execute any type of SQL statement.
5959
///
6060
/// Note: This is an extension to the Rusqlite API.
61-
pub async fn run(&mut self, params: impl IntoParams) -> Result<()> {
61+
pub async fn run(&self, params: impl IntoParams) -> Result<()> {
6262
tracing::trace!("run for prepared statement");
6363
self.inner.run(&params.into_params()?).await?;
6464
Ok(())

libsql/src/sync/statement.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ impl Stmt for SyncedStatement {
3838
self.inner.query(params).await
3939
}
4040

41-
async fn run(&mut self, params: &Params) -> Result<()> {
41+
async fn run(&self, params: &Params) -> Result<()> {
4242
if self.needs_pull.load(Ordering::Relaxed) {
4343
let mut context = self.context.lock().await;
4444
crate::sync::try_pull(&mut context, &self.conn).await?;

0 commit comments

Comments
 (0)