mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-06 01:34:21 +01:00
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:
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user