update servicepoint, simplify copy_raw
This commit is contained in:
parent
8d5e408653
commit
4cbf3784fc
5 changed files with 18 additions and 19 deletions
|
@ -2,7 +2,7 @@ use crate::macros::{
|
|||
wrap_get_set_fill_2d, wrap_uniffi_object, wrap_width_height,
|
||||
};
|
||||
use servicepoint::{DataRef, Grid};
|
||||
use std::sync::Arc;
|
||||
use std::{ops::Deref, sync::Arc};
|
||||
|
||||
wrap_uniffi_object!(Bitmap);
|
||||
wrap_width_height!(Bitmap);
|
||||
|
@ -37,6 +37,6 @@ impl Bitmap {
|
|||
}
|
||||
|
||||
pub fn copy_raw(&self) -> Vec<u8> {
|
||||
self.actual.read().unwrap().data_ref().to_vec()
|
||||
self.actual.read().unwrap().deref().into()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,10 @@ use crate::macros::{
|
|||
wrap_get_set_fill_2d, wrap_uniffi_object, wrap_width_height,
|
||||
};
|
||||
use servicepoint::{Brightness, DataRef, Grid};
|
||||
use std::sync::Arc;
|
||||
use std::{
|
||||
ops::Deref,
|
||||
sync::{Arc, RwLockReadGuard},
|
||||
};
|
||||
|
||||
wrap_uniffi_object!(BrightnessGrid);
|
||||
wrap_width_height!(BrightnessGrid);
|
||||
|
@ -37,12 +40,6 @@ impl BrightnessGrid {
|
|||
}
|
||||
|
||||
pub fn copy_raw(&self) -> Vec<u8> {
|
||||
self.actual
|
||||
.read()
|
||||
.unwrap()
|
||||
.data_ref()
|
||||
.iter()
|
||||
.map(u8::from)
|
||||
.collect()
|
||||
self.actual.read().unwrap().deref().into()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
use crate::char_grid::CharGrid;
|
||||
use crate::macros::{wrap_get_set_fill_2d, wrap_uniffi_object, wrap_width_height};
|
||||
use crate::macros::{
|
||||
wrap_get_set_fill_2d, wrap_uniffi_object, wrap_width_height,
|
||||
};
|
||||
use servicepoint::{DataRef, Grid};
|
||||
use std::sync::Arc;
|
||||
use std::{ops::Deref, sync::Arc};
|
||||
|
||||
wrap_uniffi_object!(Cp437Grid);
|
||||
wrap_width_height!(Cp437Grid);
|
||||
|
@ -36,7 +38,7 @@ impl Cp437Grid {
|
|||
}
|
||||
|
||||
pub fn copy_raw(&self) -> Vec<u8> {
|
||||
self.actual.read().unwrap().data_ref().to_vec()
|
||||
self.actual.read().unwrap().deref().into()
|
||||
}
|
||||
|
||||
pub fn to_utf8(&self) -> Arc<CharGrid> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue