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