Closed FredTheDino closed 3 years ago
Do you need to create arbitrary asset IDs as well or do you only need to extract the inner value? I'd rather have this
impl std::ops::Deref for ImageAssetID {
type Target = usize;
fn deref(&self) -> &Self::Target {
&self.0
}
}
in the second case.
If you need to create asset IDs as well I'd like this:
impl ImageAssetID {
/// Wrap a usize as an ID.
///
/// # Safety
///
/// The usize needs to be a valid ID that has previously been returned from [AssetSystem::load_image].
pub unsafe fn from_usize(u: usize) -> Self {
Self(u)
}
}
Otherwise we need to check all IDs in the asset code.
My boilerplate alert is going off.
But yes, I need to create the ID's from usizes - unless I add another layer of indirection. I'm not super sold on the extra layer of indirection. We can diskus it further in person. There's a PR up for it https://github.com/FredTheDino/sylt-lang/pull/177
Superseded by #48
If you wanted to remove the wrapping type for some reason...