ck3-regions 0.1.2

Generates title-based region textures for use with the custom dynamic terrain shader system implemented in some CK3 mods.
Documentation
use grid::Grid;

//
// Constants
//

const EXPECT_COORD_INTO_USIZE: &str = "expected map coordinate to be convertible to usize";

//
// pub struct GenericMap<T>
//

pub struct GenericMap<T>(Grid<T>);

impl<T> GenericMap<T> {
    pub fn from_initial_value(width: impl TryInto<usize>, height: impl TryInto<usize>, initial_value: T) -> Self {
        Self(
            Grid::init(
                height.try_into().ok().expect(EXPECT_COORD_INTO_USIZE), // TODO: Kinda verbose; make a trait?
                width.try_into().ok().expect(EXPECT_COORD_INTO_USIZE),
                initial_value
            )
        )
    }
}

//
// Service
//