move containers to module

This commit is contained in:
Vinzenz Schroeter 2025-06-13 11:45:11 +02:00
parent 27d71cefe6
commit cee4937270
8 changed files with 35 additions and 37 deletions

View file

@ -1,13 +1,18 @@
use crate::bitvec::BitVec; use crate::{
use crate::brightness_grid::BrightnessGrid; compression_code::CompressionCode,
use crate::char_grid::CharGrid; containers::{
use crate::compression_code::CompressionCode; bitmap::Bitmap, bitvec::BitVec, brightness_grid::BrightnessGrid,
use crate::cp437_grid::Cp437Grid; char_grid::CharGrid, cp437_grid::Cp437Grid,
use crate::errors::ServicePointError; },
use servicepoint::{BitVecCommand, BrightnessGridCommand, CharGridCommand, ClearCommand, Cp437GridCommand, FadeOutCommand, GlobalBrightnessCommand, HardResetCommand, Origin}; errors::ServicePointError,
macros::wrap_uniffi_object,
};
use servicepoint::{
BitVecCommand, BrightnessGridCommand, CharGridCommand, ClearCommand,
Cp437GridCommand, FadeOutCommand, GlobalBrightnessCommand,
HardResetCommand, Origin,
};
use std::sync::Arc; use std::sync::Arc;
use crate::bitmap::Bitmap;
use crate::macros::wrap_uniffi_object;
wrap_uniffi_object!(TypedCommand, Command); wrap_uniffi_object!(TypedCommand, Command);

View file

@ -1,7 +1,5 @@
use crate::macros::{ use crate::macros::*;
wrap_get_set_fill_2d, wrap_uniffi_object, wrap_width_height, use servicepoint::Grid;
};
use servicepoint::{DataRef, Grid};
use std::{ops::Deref, sync::Arc}; use std::{ops::Deref, sync::Arc};
wrap_uniffi_object!(Bitmap); wrap_uniffi_object!(Bitmap);

View file

@ -1,5 +1,5 @@
use std::sync::{Arc};
use crate::macros::wrap_uniffi_object; use crate::macros::wrap_uniffi_object;
use std::sync::Arc;
wrap_uniffi_object!(DisplayBitVec, BitVec); wrap_uniffi_object!(DisplayBitVec, BitVec);
@ -7,7 +7,10 @@ wrap_uniffi_object!(DisplayBitVec, BitVec);
impl BitVec { impl BitVec {
#[uniffi::constructor] #[uniffi::constructor]
pub fn new(size: u64) -> Arc<Self> { pub fn new(size: u64) -> Arc<Self> {
Self::internal_new(servicepoint::DisplayBitVec::repeat(false, size as usize)) Self::internal_new(servicepoint::DisplayBitVec::repeat(
false,
size as usize,
))
} }
#[uniffi::constructor] #[uniffi::constructor]
pub fn load(data: Vec<u8>) -> Arc<Self> { pub fn load(data: Vec<u8>) -> Arc<Self> {

View file

@ -1,11 +1,6 @@
use crate::macros::{ use crate::macros::*;
wrap_get_set_fill_2d, wrap_uniffi_object, wrap_width_height, use servicepoint::{Brightness, Grid};
}; use std::{ops::Deref, sync::Arc};
use servicepoint::{Brightness, DataRef, Grid};
use std::{
ops::Deref,
sync::{Arc, RwLockReadGuard},
};
wrap_uniffi_object!(BrightnessGrid); wrap_uniffi_object!(BrightnessGrid);
wrap_width_height!(BrightnessGrid); wrap_width_height!(BrightnessGrid);

View file

@ -1,8 +1,6 @@
use crate::cp437_grid::Cp437Grid; use crate::{containers::cp437_grid::Cp437Grid, macros::*};
use servicepoint::{Grid, SetValueSeriesError}; use servicepoint::{Grid, SetValueSeriesError};
use std::convert::Into; use std::{convert::Into, sync::Arc};
use std::sync::{Arc};
use crate::macros::{wrap_width_height, wrap_uniffi_object};
wrap_uniffi_object!(CharGrid); wrap_uniffi_object!(CharGrid);
wrap_width_height!(CharGrid); wrap_width_height!(CharGrid);

View file

@ -1,8 +1,5 @@
use crate::char_grid::CharGrid; use crate::{containers::char_grid::CharGrid, macros::*};
use crate::macros::{ use servicepoint::Grid;
wrap_get_set_fill_2d, wrap_uniffi_object, wrap_width_height,
};
use servicepoint::{DataRef, Grid};
use std::{ops::Deref, sync::Arc}; use std::{ops::Deref, sync::Arc};
wrap_uniffi_object!(Cp437Grid); wrap_uniffi_object!(Cp437Grid);

5
src/containers/mod.rs Normal file
View file

@ -0,0 +1,5 @@
pub mod bitmap;
pub mod bitvec;
pub mod brightness_grid;
pub mod char_grid;
pub mod cp437_grid;

View file

@ -1,14 +1,11 @@
uniffi::setup_scaffolding!(); uniffi::setup_scaffolding!();
mod bitmap;
mod bitvec;
mod brightness; mod brightness;
mod brightness_grid;
mod char_grid;
mod command; mod command;
mod commands;
mod compression_code; mod compression_code;
mod connection; mod connection;
mod constants; mod constants;
mod cp437_grid; mod containers;
mod errors; mod errors;
mod macros; mod macros;