What is Nostr?
npub1dvs…ttxk
2024-11-01 09:34:30

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
Author Public Key
npub1dvsuqmzh4jsjerdszplqvxmgcxl8fwuknn7dd76m978uq2ac9t8qk7ttxk