Skip to content

Commit 2e5086a

Browse files
committed
add BoundStatement::into_owned
allows users to transform an existing bound statement into one that doesn't borrow the prepared statement (by cloning it)
1 parent c50545b commit 2e5086a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

scylla/src/statement/bound.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,14 @@ impl<'p> BoundStatement<'p> {
7676
Ok(Some((partition_key, token)))
7777
}
7878

79+
/// Consumes this bound statement to return one with no borrowed data
80+
pub fn into_owned(self) -> BoundStatement<'static> {
81+
BoundStatement {
82+
prepared: Cow::Owned(self.prepared.into_owned()),
83+
values: self.values,
84+
}
85+
}
86+
7987
/// Calculates the token for the prepared statement and its bound values
8088
///
8189
/// Returns the token that would be computed for executing the provided prepared statement with

0 commit comments

Comments
 (0)