You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What problem does this solve or what need does it fill?
Distributing single binaries is really convenient and somnetimes a very efficient solution. The core question is wether the data field actually has to be a Vec<u8> or if it could be replaced with a Cow which spares memory allocation if the data is already inside the binary.
What solution would you like?
Optimally one would replace the data field with a Cow<'static, [u8]> and fits other functions that need to mutate the buffer to use Cow::to_mut
What alternative(s) have you considered?
This seems to be a rather "niche" case but it could add a lot of value, espacially for "default"/fallback textures.
Additional context
Generally loading Assets without the AssetServer is quite a hassle in my opinion, the documentation on how to create the assets could be improved or there could be a embedded assets asset server io based on rust_embed, but then there would also need to be an easy way to swap the AssetIo of the AssetServer.
The text was updated successfully, but these errors were encountered:
Not sure if completely changing the underlying storage type permanently is the best route, however, possibly making it generic over the data type is another solution.
Especially if a Vec<u8> is the common use case, ideally not needing to pay for the extra overhead of a Cow<..> is likely preferred.
structImage<T:AsRef<[u8]> = Vec<u8>>{data:T,
..
}
Granted this makes mixing Images with different data types a little more cumbersome.
What problem does this solve or what need does it fill?
Distributing single binaries is really convenient and somnetimes a very efficient solution. The core question is wether the data field actually has to be a
Vec<u8>
or if it could be replaced with aCow
which spares memory allocation if the data is already inside the binary.What solution would you like?
Optimally one would replace the data field with a
Cow<'static, [u8]>
and fits other functions that need to mutate the buffer to useCow::to_mut
What alternative(s) have you considered?
This seems to be a rather "niche" case but it could add a lot of value, espacially for "default"/fallback textures.
Additional context
Generally loading Assets without the
AssetServer
is quite a hassle in my opinion, the documentation on how to create the assets could be improved or there could be a embedded assets asset server io based onrust_embed
, but then there would also need to be an easy way to swap theAssetIo
of theAssetServer
.The text was updated successfully, but these errors were encountered: