Skip to content

Commit

Permalink
Make it clear that the libary is intended to be private
Browse files Browse the repository at this point in the history
  • Loading branch information
zkxs committed Jul 3, 2024
1 parent c7d9aa0 commit 469f12a
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 29 deletions.
2 changes: 1 addition & 1 deletion benches/color_picker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use std::hint::black_box;
use criterion::{BatchSize, Criterion};

use simple_crosshair_overlay::util::image;
use simple_crosshair_overlay::private::util::image;

pub fn bench_color_picker(c: &mut Criterion) {
let mut group = c.benchmark_group("Color Picker Implementations");
Expand Down
6 changes: 3 additions & 3 deletions benches/hotkey.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ use std::time::{Duration, Instant};

use criterion::Criterion;

use simple_crosshair_overlay::hotkey::KeyBindings;
use simple_crosshair_overlay::platform;
use simple_crosshair_overlay::platform::KeyboardState;
use simple_crosshair_overlay::private::hotkey::KeyBindings;
use simple_crosshair_overlay::private::platform;
use simple_crosshair_overlay::private::platform::KeyboardState;

pub fn bench_key_poll(c: &mut Criterion) {
let mut group = c.benchmark_group("Key poll");
Expand Down
12 changes: 8 additions & 4 deletions src-lib/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
// See LICENSE file for full text.
// Copyright © 2023 Michael Ripley

pub mod hotkey;
pub mod platform;
pub mod settings;
pub mod util;
//! This library is used by the simple-crosshair-overlay application and is not intended for public
//! use. Due to limitations of criterion, I can only benchmark functions in the public library. Due
//! to limitations of crates.io, all used libraries must be published. The result is I'm forced to
//! publish my internal API publicly.
//!
//! **This library will not be following semantic-versioning** as again, it is not intended to be
//! public API.
pub mod private;
2 changes: 1 addition & 1 deletion src-lib/private/hotkey/hotkey_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use std::marker::PhantomData;

use serde::{Deserialize, Serialize};

use crate::platform::{KeyboardState, KeycodeType};
use crate::private::platform::{KeyboardState, KeycodeType};

use super::Keycode;

Expand Down
4 changes: 4 additions & 0 deletions src-lib/private/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pub mod hotkey;
pub mod platform;
pub mod settings;
pub mod util;
6 changes: 3 additions & 3 deletions src-lib/private/platform/generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
use device_query::{DeviceQuery, DeviceState, Keycode as DeviceQueryKeycode};

use crate::hotkey;
use crate::hotkey::{KeyBindings, Keycode};
use crate::platform::{KeyboardState, KeycodeType};
use crate::private::hotkey;
use crate::private::hotkey::{KeyBindings, Keycode};
use crate::private::platform::{KeyboardState, KeycodeType};

/// platform-independent window handle (it's nothing)
#[derive(Copy, Clone, Debug)]
Expand Down
2 changes: 1 addition & 1 deletion src-lib/private/platform/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub use generic::HotkeyManager;
#[cfg(target_os = "windows")]
pub use windows::{get_foreground_window, set_foreground_window, WindowHandle};

use crate::hotkey::Keycode;
use crate::private::hotkey::Keycode;

pub mod generic; // pub so benchmarking can access

Expand Down
10 changes: 5 additions & 5 deletions src-lib/private/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ use serde::{Deserialize, Serialize};
use winit::dpi::{PhysicalPosition, PhysicalSize};
use winit::window::Window;

use crate::hotkey::KeyBindings;
use crate::util::dialog::show_warning;
use crate::util::image::{self, Image};
use crate::util::numeric::fps_to_tick_interval;
use crate::private::hotkey::KeyBindings;
use crate::private::util::dialog::show_warning;
use crate::private::util::image::{self, Image};
use crate::private::util::numeric::fps_to_tick_interval;

const DEFAULT_OFFSET_X: i32 = 0;
const DEFAULT_OFFSET_Y: i32 = 0;
Expand Down Expand Up @@ -47,7 +47,7 @@ pub struct PersistedSettings {
pub window_dy: i32,
pub window_width: u32,
pub window_height: u32,
#[serde(with = "crate::util::custom_serializer::argb_color")]
#[serde(with = "crate::private::util::custom_serializer::argb_color")]
color: u32,
#[serde(default = "default_fps")]
fps: u32,
Expand Down
2 changes: 1 addition & 1 deletion src-lib/private/util/image/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::path::Path;

use png::ColorType;

use crate::util::numeric::{DivCeil, DivFloor};
use crate::private::util::numeric::{DivCeil, DivFloor};

#[cfg(any(test, feature = "benchmark"))]
pub mod precise;
Expand Down
2 changes: 1 addition & 1 deletion src-lib/private/util/image/naive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//! 1. benchmarking comparisons
//! 2. unit testing known good output
use crate::util::image::hue_value_to_argb;
use crate::private::util::image::hue_value_to_argb;

#[inline(always)]
pub fn draw_color_picker(buffer: &mut [u32]) {
Expand Down
8 changes: 4 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ use debug_print::debug_println;
use winit::event_loop::{DeviceEvents, EventLoop};
use winit::window::{CursorGrabMode, Window};

use simple_crosshair_overlay::platform;
use simple_crosshair_overlay::settings::CONFIG_PATH;
use simple_crosshair_overlay::settings::Settings;
use simple_crosshair_overlay::util::dialog;
use simple_crosshair_overlay::private::platform;
use simple_crosshair_overlay::private::settings::CONFIG_PATH;
use simple_crosshair_overlay::private::settings::Settings;
use simple_crosshair_overlay::private::util::dialog;

mod window;
mod tray;
Expand Down
10 changes: 5 additions & 5 deletions src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ use winit::event::{DeviceEvent, DeviceId, ElementState, MouseButton, StartCause,
use winit::event_loop::{ActiveEventLoop, EventLoop};
use winit::window::{CursorIcon, Window, WindowId, WindowLevel};

use simple_crosshair_overlay::platform;
use simple_crosshair_overlay::platform::HotkeyManager;
use simple_crosshair_overlay::settings::{CONFIG_PATH, RenderMode, Settings};
use simple_crosshair_overlay::util::{dialog, image};
use simple_crosshair_overlay::util::dialog::DialogWorker;
use simple_crosshair_overlay::private::platform;
use simple_crosshair_overlay::private::platform::HotkeyManager;
use simple_crosshair_overlay::private::settings::{CONFIG_PATH, RenderMode, Settings};
use simple_crosshair_overlay::private::util::{dialog, image};
use simple_crosshair_overlay::private::util::dialog::DialogWorker;

use crate::{build_constants, handle_color_pick, tray};
use crate::tray::MenuItems;
Expand Down

0 comments on commit 469f12a

Please sign in to comment.