update servicepoint, simplify copy_raw

This commit is contained in:
Vinzenz Schroeter 2025-06-13 10:17:59 +02:00
parent 8d5e408653
commit 4cbf3784fc
5 changed files with 18 additions and 19 deletions

View file

@ -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()
}
}

View file

@ -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()
}
}

View file

@ -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> {