Skip to content

Commit fe53d08

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 1dcb753 commit fe53d08

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
@@ -74,6 +74,14 @@ impl<'p> BoundStatement<'p> {
7474
Ok(Some((partition_key, token)))
7575
}
7676

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

0 commit comments

Comments
 (0)