mod calculate_tile_distances;
mod formatted;
mod glyph_cache;
mod glyph_store;
mod glyph_store_bitmaps;
use std::path::PathBuf;
use mln_util::logging::{Event, EventSeverity, Log, Observer};
#[must_use]
pub(crate) fn cpp_path(relative: &str) -> PathBuf {
std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("testdata").join(relative)
}
#[must_use]
pub(crate) fn read_file(relative: &str) -> Vec<u8> {
let path = cpp_path(relative);
std::fs::read(&path).unwrap_or_else(|e| panic!("{}: {e}", path.display()))
}
struct NullObserver;
impl Observer for NullObserver {
fn on_record(&self, _: EventSeverity, _: Event, _: i64, _: &str) -> bool {
true
}
}
pub(crate) struct SquelchLog;
impl SquelchLog {
#[must_use]
pub(crate) fn new() -> Self {
let _ = Log::set_thread_observer(Some(Box::new(NullObserver)));
SquelchLog
}
}
impl Default for SquelchLog {
fn default() -> Self {
Self::new()
}
}
impl Drop for SquelchLog {
fn drop(&mut self) {
let _ = Log::set_thread_observer(None);
}
}