Move the C API to Rust
The public C API is just skeleton functions that do the g_return_if_fail
checks, and immediately call into Rust functions that do the actual work.
It should be possible to move all that into Rust. Some things to note:
-
This experiment didn't work - some of the public functions are moved to Rust, but their symbols are not visible in the final
librsvg.so
. -
Maybe all the public functions need to be moved to Rust, and then
librsvg.so
should be created there, instead of the current scheme of linking a C library to a Rust internals library? -
I haven't investigated how to tell rust to just export certain symbols; by default I think it includes some exception-handling stuff in libraries as well. Maybe we should just spit the
.so
from Rust and see what is visible there. -
Should we get into hard-ass mode and turn the
g_return_if_fail
intopanic
? This already happens for the loading-stage checks in the rust-api branch, with the rationale that we can't do anything about programming errors except crash.
CC @sdroege because he expressed interest in this in Mastodon.