update servicepoint, simplify copy_raw

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

8
Cargo.lock generated
View file

@ -1,6 +1,6 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
version = 4
[[package]]
name = "adler2"
@ -425,9 +425,9 @@ dependencies = [
[[package]]
name = "servicepoint"
version = "0.14.1"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6bd5cfa49c73aeecb344680ffbf697abf73e0563a441b93b9723ae43867500f"
checksum = "91a33bff7f9db5008748b23ca0c906c276fe00694390b681f004a55968a42cfe"
dependencies = [
"bitvec",
"bzip2",
@ -441,7 +441,7 @@ dependencies = [
[[package]]
name = "servicepoint_binding_uniffi"
version = "0.13.1"
version = "0.15.0"
dependencies = [
"servicepoint",
"thiserror 2.0.11",

View file

@ -1,6 +1,6 @@
[package]
name = "servicepoint_binding_uniffi"
version = "0.13.1"
version = "0.15.0"
publish = false
edition = "2021"
license = "GPL-3.0-or-later"
@ -21,7 +21,7 @@ uniffi = { version = "0.28.3" }
thiserror = "2.0"
[dependencies.servicepoint]
version = "0.14.1"
version = "0.15.0"
features = ["all_compressions"]
[package.metadata.docs.rs]

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