kenz-gelsoft / wxRust2

re-exploration Rust binding to wx
MIT License
78 stars 10 forks source link

Consider safety of almost all API calls #75

Open kenz-gelsoft opened 2 years ago

kenz-gelsoft commented 2 years ago

wx manages (almost all) wxWindows' pointers which is in widgets tree.

This means that any operation potentially makes any pointers invalid.

This should be expressed unsafe in Rust, how can we do this?

kenz-gelsoft commented 2 years ago

Marking following methods unsafe may make it programmer's responsibility

I think this is a reasonable compromise than other approaches like:

Those approaches will increase run-time overhead unreasonablly. As a Rust library, this isn't desirable.

Providing unsafe and performant variants to whole APIs doubles the work for binding.