Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
218: godot-core: builtin: reimplement Rect2i to reduce need of inner usage r=Bromeon a=yannick-was-taken Addresses part of #209 . Only doing `Rect2i` for now, so that suggestions only have to be applied once, instead of four times ;) The implementations are tested (regular case + edge case where applicable) including an itest that checks equivalence between the inner type's fns and the implemented fns. Documentation is mostly taken from Godot's docs for Rect2i, with little changes here and there. There are a bunch of FIXMEs that need to be resolved before this is mergable: Godot's rect2i.h prints errors in some cases when the rect size is negative. In accordance with what I believe to be a design principle of gdext, the equivalent fns panic in that case (compare to `cast`/`try_cast`: default is to assume and panic?). There could be `_unchecked` fns that likely should be marked unsafe, as though they would not introduce memory unsafety, they would result in "Garbage In / Garbage Out", which in Rust usually is considered unsafe, as the safe bet would be to prevent the Garbage In situation via typing, or at least make it return `Option<Garbage Out>`. The Option approach could be used here as well, but would change the type's API as opposed to what it is in GdScript. So please provide input on those FIXMEs as to what you think should be done here. Co-authored-by: yannick-was-taken <yannick-was-taken@posteo.de>
- Loading branch information