npub1dv…7ttxk on Nostr: Help, #rustaceans ! What does "unsafe" mean? I want to pass around raw file ...
Help, #rustaceans !
What does "unsafe" mean?
I want to pass around raw file descriptors (to image buffers), so that they can be consumed in many places. There are different kinds of descriptors on Linux, though.
Loading a regular file by accident instead of an image won't cause a segfault, but it may error out later when you try to use it.
fn load_image(fd: File) -> Result<ImageFd, LoadError>;
Should the above be an unsafe operation?
#rustlang #askfedi
What does "unsafe" mean?
I want to pass around raw file descriptors (to image buffers), so that they can be consumed in many places. There are different kinds of descriptors on Linux, though.
Loading a regular file by accident instead of an image won't cause a segfault, but it may error out later when you try to use it.
fn load_image(fd: File) -> Result<ImageFd, LoadError>;
Should the above be an unsafe operation?
#rustlang #askfedi