Merge 'implement Clone for Arc<Mutex> types' from Pete Hayman

`Statement` and `Rows` both have a private Arc, implementing clone
avoids users needing to Arc<Mutex> it again.

Reviewed-by: Preston Thorpe (@PThorpe92)

Closes #1412
This commit is contained in:
Jussi Saurio
2025-05-03 18:30:00 +03:00

View File

@@ -129,6 +129,14 @@ pub struct Statement {
inner: Arc<Mutex<limbo_core::Statement>>,
}
impl Clone for Statement {
fn clone(&self) -> Self {
Self {
inner: Arc::clone(&self.inner),
}
}
}
unsafe impl Send for Statement {}
unsafe impl Sync for Statement {}
@@ -241,6 +249,14 @@ pub struct Rows {
inner: Arc<Mutex<limbo_core::Statement>>,
}
impl Clone for Rows {
fn clone(&self) -> Self {
Self {
inner: Arc::clone(&self.inner),
}
}
}
unsafe impl Send for Rows {}
unsafe impl Sync for Rows {}
@@ -281,4 +297,8 @@ impl Row {
limbo_core::OwnedValue::Blob(items) => Ok(Value::Blob(items.to_vec())),
}
}
pub fn column_count(&self) -> usize {
self.values.len()
}
}