Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
GdkPixbuf::new return Option #97
Jan 13, 2019
Yeah, see gtk-rs/gir#655 . We currently assume "nullable" for return values by default if nothing is specified (and "not nullable" could be used to make the configuration in the toml not needed in a few cases), and for parameters we assume "not nullable if nothing is specified (and "nullable" is already used to override that to not need the toml configuration). In addition, constructors are assumed to not be nullable but we should probably make use of the annotation there if it's provided.
I checked pixbuf sources:
gdk_pixbuf_new_from_xpm_data also Option because it freed errors: https://github.com/GNOME/gdk-pixbuf/blob/6a0cb9e015e5bbd3cbbdb71fef9154d9ce59d6a8/gdk-pixbuf/gdk-pixbuf-io.c#L2085
All constructors returning error looks normal except
Yes and then we would panic, which is the correct behaviour. It's not something the caller can handle, it's something the caller did wrong.
Same story really. The checks are more complicated but it's not an handleable error.
Only if there's a clean error path that can return