add clone to macro
This commit is contained in:
parent
88f7696dbd
commit
fda2b9419d
|
@ -28,11 +28,6 @@ impl Bitmap {
|
|||
).unwrap())
|
||||
}
|
||||
|
||||
#[uniffi::constructor]
|
||||
pub fn clone(other: &Arc<Self>) -> Arc<Self> {
|
||||
Self::internal_new(other.actual.read().unwrap().clone())
|
||||
}
|
||||
|
||||
pub fn set(&self, x: u64, y: u64, value: bool) {
|
||||
self.actual
|
||||
.write()
|
||||
|
|
|
@ -14,11 +14,6 @@ impl BitVec {
|
|||
Self::internal_new(servicepoint::DisplayBitVec::from_slice(&data))
|
||||
}
|
||||
|
||||
#[uniffi::constructor]
|
||||
pub fn clone(other: &Arc<Self>) -> Arc<Self> {
|
||||
Self::internal_new(other.actual.read().unwrap().clone())
|
||||
}
|
||||
|
||||
pub fn set(&self, index: u64, value: bool) {
|
||||
self.actual.write().unwrap().set(index as usize, value)
|
||||
}
|
||||
|
|
|
@ -23,11 +23,6 @@ impl BrightnessGrid {
|
|||
).unwrap())
|
||||
}
|
||||
|
||||
#[uniffi::constructor]
|
||||
pub fn clone(other: &Arc<Self>) -> Arc<Self> {
|
||||
Self::internal_new(other.actual.read().unwrap().clone())
|
||||
}
|
||||
|
||||
pub fn set(&self, x: u64, y: u64, value: u8) {
|
||||
self.actual.write().unwrap().set(
|
||||
x as usize,
|
||||
|
|
|
@ -31,11 +31,6 @@ impl CharGrid {
|
|||
Self::internal_new(servicepoint::CharGrid::from(&*data))
|
||||
}
|
||||
|
||||
#[uniffi::constructor]
|
||||
pub fn clone(other: &Arc<Self>) -> Arc<Self> {
|
||||
Self::internal_new(other.actual.read().unwrap().clone())
|
||||
}
|
||||
|
||||
pub fn set(
|
||||
&self,
|
||||
x: u64,
|
||||
|
|
|
@ -116,11 +116,6 @@ impl Command {
|
|||
Self::internal_new(actual.into())
|
||||
}
|
||||
|
||||
#[uniffi::constructor]
|
||||
pub fn clone(other: &Arc<Self>) -> Arc<Self> {
|
||||
Self::internal_new(other.actual.read().unwrap().clone())
|
||||
}
|
||||
|
||||
pub fn equals(&self, other: &Command) -> bool {
|
||||
*self.actual.read().unwrap() == *other.actual.read().unwrap()
|
||||
}
|
||||
|
|
|
@ -24,11 +24,6 @@ impl Cp437Grid {
|
|||
).unwrap())
|
||||
}
|
||||
|
||||
#[uniffi::constructor]
|
||||
pub fn clone(other: &Arc<Self>) -> Arc<Self> {
|
||||
Self::internal_new(other.actual.read().unwrap().clone())
|
||||
}
|
||||
|
||||
pub fn set(&self, x: u64, y: u64, value: u8) {
|
||||
self.actual
|
||||
.write()
|
||||
|
|
|
@ -13,6 +13,14 @@ macro_rules! wrap_uniffi_object {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[uniffi::export]
|
||||
impl $new_t {
|
||||
#[uniffi::constructor]
|
||||
pub fn clone(other: &Arc<Self>) -> Arc<Self> {
|
||||
Self::internal_new(other.actual.read().unwrap().clone())
|
||||
}
|
||||
}
|
||||
};
|
||||
($t:ident) => {
|
||||
wrap_uniffi_object!($t, $t);
|
||||
|
|
Loading…
Reference in a new issue