-
Notifications
You must be signed in to change notification settings - Fork 5
Should image-core
be no_std
#4
Comments
I'd also really like for image-core to be no_std. I'd also add that
With some work it might be possible to punt the standard library dependency into the crates that implement ImageDecoder, but I'd view that as only a partial solution. There isn't really a good reason that a BMP or PNG decoding crate shouldn't be able to work just with alloc. |
I think |
We can take |
Could you point to which part/types in that that crate use the pattern you are describing? Since most of our users are still likely going to be running in libstd settings, we want to make sure that there are still ergonomic ways to use the interface with For specifically providing features only when an OS is present, we can rely on a "std" feature on the image-core crate. This would work better than trying to provide trait implementations in a second crate due to coherence issues. (This is actually a problem for the standard library, and why they are actually thinking of trying to merge the |
The discussion in image#1184 made me realized that the naming
image-core
might imply that the crate actually only depends oncore
. Since this is not already the case, it's liky a very good idea to follow regardless. As a very first step it would help if it were at least clear what features require which standard dependency. This also surfaces some other questions:The error type has a variant for
io::Error
. We, ourselves, had misused that variant a couple of times until0.23
which had made the switch more painful than necessary. It's also preventing us from developing our own error type independently and not particularly accurate. Why should it be possible that copying an image buffer results in an IO error?. As also mentioned in this blog post aboutsled
it is also not very ergonomic when one considers that io errors are possibly more fatal to a program than wrong data.ImageDecoder
locks all implementors into returningImageError
. This crates a close dependency between the error type and decoding functionality, possibly a lot closer than necessary.The
ImageFormat::from_path
functionality relies onPath
which is only available instd
as it is (somewhat) OS-dependent.The text was updated successfully, but these errors were encountered: