add uniffi CP437Grid, equals

add equals method

add uniffi copy_raw method
This commit is contained in:
Vinzenz Schroeter 2024-11-05 22:39:10 +01:00
parent 03aa432655
commit 9553d9fe42
7 changed files with 586 additions and 2 deletions

View file

@ -1,4 +1,4 @@
use servicepoint::{Brightness, Grid};
use servicepoint::{Brightness, DataRef, Grid};
use std::sync::{Arc, RwLock};
#[derive(uniffi::Object)]
@ -67,4 +67,14 @@ impl BrightnessGrid {
pub fn height(&self) -> u64 {
self.actual.read().unwrap().height() as u64
}
pub fn equals(&self, other: &BrightnessGrid) -> bool {
let a = self.actual.read().unwrap();
let b = other.actual.read().unwrap();
*a == *b
}
pub fn copy_raw(&self) -> Vec<u8> {
self.actual.read().unwrap().data_ref().iter().map(u8::from).collect()
}
}