[librsvg: 6/8] Move C API glue to a librsvg_c_api crate



commit 78219898d17440a41d21a206afa5a5d982dcbf9f
Author: Federico Mena Quintero <federico gnome org>
Date:   Mon Aug 26 15:42:05 2019 +0300

    Move C API glue to a librsvg_c_api crate
    
    Now, the dependencies are like this:
    
          rsvg_internals
           ^           ^
           |             \
           |               \
    librsvg_crate     librsvg_c_api
                             ^
                             |
                        librsvg.so
    
    This will eventually let us build rsvg_internals without a Cargo
    feature (the "c-library") feature, so it will only be built *once* for
    the whole librsvg compilation.

 Cargo.lock                               | 223 +++++++++++++++++++++----------
 Cargo.toml                               |   1 +
 Makefile.am                              |  32 +++--
 librsvg/Cargo.toml                       |  31 +++++
 librsvg/build.rs                         |  70 ++++++++++
 {rsvg_internals/src => librsvg}/c_api.rs | 120 ++---------------
 librsvg/lib.rs                           |  42 ++++++
 rsvg_internals/Cargo.toml                |   9 +-
 rsvg_internals/build.rs                  |  65 ---------
 rsvg_internals/src/handle.rs             | 112 +++++++++++++++-
 rsvg_internals/src/lib.rs                |  60 ++-------
 rsvg_internals/src/log.rs                |   2 +-
 rsvg_internals/src/pixbuf_utils.rs       |   3 +-
 13 files changed, 455 insertions(+), 315 deletions(-)
---
diff --git a/Cargo.lock b/Cargo.lock
index c58b53cb..a2cd4c67 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -46,7 +46,7 @@ dependencies = [
 
 [[package]]
 name = "autocfg"
-version = "0.1.5"
+version = "0.1.6"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 
 [[package]]
@@ -54,15 +54,20 @@ name = "bitflags"
 version = "1.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 
+[[package]]
+name = "block"
+version = "0.1.6"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+
 [[package]]
 name = "bstr"
 version = "0.2.7"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 dependencies = [
- "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "regex-automata 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -111,7 +116,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index";
 dependencies = [
  "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -133,7 +138,7 @@ dependencies = [
  "criterion-plot 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "csv 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
  "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -141,8 +146,8 @@ dependencies = [
  "rand_xoshiro 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "rayon 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "rayon-core 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)",
  "tinytemplate 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -175,7 +180,7 @@ dependencies = [
  "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
  "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
  "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "memoffset 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
@@ -194,37 +199,37 @@ version = "0.6.6"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 dependencies = [
  "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
- "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "cssparser"
-version = "0.25.8"
+version = "0.25.9"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 dependencies = [
- "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "cssparser-macros 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "cssparser-macros 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "dtoa-short 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "phf 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)",
- "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "procedural-masquerade 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
+ "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
- "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)",
+ "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "cssparser-macros"
-version = "0.3.5"
+version = "0.3.6"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 dependencies = [
  "phf_codegen 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)",
- "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "procedural-masquerade 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
- "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)",
+ "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -236,7 +241,7 @@ dependencies = [
  "csv-core 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -393,7 +398,7 @@ name = "generic-array"
 version = "0.12.3"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 dependencies = [
- "typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -407,7 +412,7 @@ dependencies = [
  "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
@@ -430,7 +435,7 @@ dependencies = [
  "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
@@ -483,7 +488,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index";
 
 [[package]]
 name = "lazy_static"
-version = "1.3.0"
+version = "1.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 
 [[package]]
@@ -508,12 +513,33 @@ dependencies = [
  "url 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
+[[package]]
+name = "librsvg_c_api"
+version = "0.0.1"
+dependencies = [
+ "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gdk-pixbuf 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gdk-pixbuf-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rsvg_internals 0.0.1",
+ "url 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
 [[package]]
 name = "locale_config"
-version = "0.2.3"
+version = "0.3.0"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 dependencies = [
- "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "objc-foundation 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
@@ -531,6 +557,14 @@ name = "mac"
 version = "0.1.1"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 
+[[package]]
+name = "malloc_buf"
+version = "0.0.6"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+dependencies = [
+ "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
 [[package]]
 name = "markup5ever"
 version = "0.9.0"
@@ -539,8 +573,8 @@ dependencies = [
  "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "phf 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)",
  "phf_codegen 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)",
  "string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "string_cache_codegen 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -588,7 +622,7 @@ dependencies = [
  "num-complex 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -606,7 +640,7 @@ name = "num-complex"
 version = "0.2.3"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 dependencies = [
- "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
@@ -615,7 +649,7 @@ name = "num-traits"
 version = "0.2.8"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 dependencies = [
- "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -626,6 +660,32 @@ dependencies = [
  "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
+[[package]]
+name = "objc"
+version = "0.2.6"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+dependencies = [
+ "malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "objc-foundation"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+dependencies = [
+ "block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "objc_id 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "objc_id"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+dependencies = [
+ "objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
 [[package]]
 name = "pango"
 version = "0.7.0"
@@ -635,7 +695,7 @@ dependencies = [
  "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
  "pango-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
@@ -737,6 +797,14 @@ dependencies = [
  "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
+[[package]]
+name = "proc-macro2"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+dependencies = [
+ "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
 [[package]]
 name = "procedural-masquerade"
 version = "0.1.6"
@@ -750,12 +818,20 @@ dependencies = [
  "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
+[[package]]
+name = "quote"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+dependencies = [
+ "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
 [[package]]
 name = "rand"
 version = "0.6.5"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 dependencies = [
- "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
  "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -773,7 +849,7 @@ name = "rand_chacha"
 version = "0.1.1"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 dependencies = [
- "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
@@ -834,7 +910,7 @@ name = "rand_pcg"
 version = "0.1.2"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 dependencies = [
- "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
@@ -878,7 +954,7 @@ dependencies = [
  "crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
@@ -923,11 +999,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index";
 name = "rsvg_internals"
 version = "0.0.1"
 dependencies = [
- "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "cairo-sys-rs 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "criterion 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
- "cssparser 0.25.8 (registry+https://github.com/rust-lang/crates.io-index)",
+ "cssparser 0.25.9 (registry+https://github.com/rust-lang/crates.io-index)",
  "data-url 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "downcast-rs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -938,12 +1013,11 @@ dependencies = [
  "gio-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "glib 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "gobject-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
- "locale_config 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "locale_config 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "markup5ever 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "nalgebra 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -999,17 +1073,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index";
 
 [[package]]
 name = "serde"
-version = "1.0.98"
+version = "1.0.99"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 
 [[package]]
 name = "serde_derive"
-version = "1.0.98"
+version = "1.0.99"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 dependencies = [
- "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
- "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
- "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -1019,7 +1093,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index";
 dependencies = [
  "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -1037,11 +1111,11 @@ name = "string_cache"
 version = "0.7.3"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 dependencies = [
- "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "new_debug_unreachable 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)",
  "precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
  "string_cache_codegen 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
@@ -1065,12 +1139,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index";
 
 [[package]]
 name = "syn"
-version = "0.15.44"
+version = "1.0.5"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 dependencies = [
- "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
- "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
- "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -1088,7 +1162,7 @@ name = "textwrap"
 version = "0.11.0"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 dependencies = [
- "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -1096,7 +1170,7 @@ name = "thread_local"
 version = "0.3.6"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 dependencies = [
- "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -1104,13 +1178,13 @@ name = "tinytemplate"
 version = "1.0.2"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 dependencies = [
- "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "typenum"
-version = "1.10.0"
+version = "1.11.2"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 
 [[package]]
@@ -1131,7 +1205,7 @@ dependencies = [
 
 [[package]]
 name = "unicode-width"
-version = "0.1.5"
+version = "0.1.6"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 
 [[package]]
@@ -1139,6 +1213,11 @@ name = "unicode-xid"
 version = "0.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index";
 
+[[package]]
+name = "unicode-xid"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+
 [[package]]
 name = "url"
 version = "2.1.0"
@@ -1202,8 +1281,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index";
 "checksum approx 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = 
"f0e60b75072ecd4168020818c0107f2857bb6c4e64252d8d3983f6263b40a5c3"
 "checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = 
"b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba"
 "checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = 
"1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90"
-"checksum autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = 
"22130e92352b948e7e82a49cdb0aa94f2211761117f29e052dd397c1ac33542b"
+"checksum autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = 
"b671c8fb71b457dd4ae18c4ba1e59aa81793daacc361d82fcd410cef0d491875"
 "checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd"
+"checksum block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = 
"0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
 "checksum bstr 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = 
"94cdf78eb7e94c566c1f5dbe2abf8fc70a548fc902942a48c4b3a98b48ca9ade"
 "checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = 
"a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5"
 "checksum cairo-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = 
"e05db47de3b0f09a222fa4bba2eab957d920d4243962a86b2d77ab401e4a359c"
@@ -1218,8 +1298,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index";
 "checksum crossbeam-epoch 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = 
"fedcd6772e37f3da2a9af9bf12ebe046c0dfe657992377b4df982a2b54cd37a9"
 "checksum crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = 
"7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b"
 "checksum crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = 
"04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6"
-"checksum cssparser 0.25.8 (registry+https://github.com/rust-lang/crates.io-index)" = 
"629648697bc0002c30e9e3775314e18d02935f43ecc8fa224140f40e8ffc7bb1"
-"checksum cssparser-macros 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = 
"b16e382d9b983fdb9ac6a36b37fdeb84ce3ea81f749febfee3463cfa7f24275e"
+"checksum cssparser 0.25.9 (registry+https://github.com/rust-lang/crates.io-index)" = 
"fbe18ca4efb9ba3716c6da66cc3d7e673bf59fa576353011f48c4cfddbdd740e"
+"checksum cssparser-macros 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = 
"5bb1c84e87c717666564ec056105052331431803d606bd45529b28547b611eef"
 "checksum csv 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = 
"37519ccdfd73a75821cac9319d4fce15a81b9fcf75f951df5b9988aa3a0af87d"
 "checksum csv-core 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = 
"9b5cadb6b25c77aeff80ba701712494213f4a8418fcda2ee11b6560c3ad0bf4c"
 "checksum data-url 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"d33fe99ccedd6e84bc035f1931bb2e6be79739d6242bd895e7311c886c50dc9c"
@@ -1250,12 +1330,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index";
 "checksum itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"5b8467d9c1cebe26feb08c640139247fac215782d35371ade9a2136ed6085358"
 "checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = 
"501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f"
 "checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = 
"a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a"
-"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14"
+"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
 "checksum libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)" = 
"34fcd2c08d2f832f376f4173a231990fa5aef4e99fb569867318a227ef4c06ba"
 "checksum libm 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = 
"7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a"
-"checksum locale_config 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = 
"73ac19ebe45489e5d53b4346d8b90bb3dd03275c5fdf2ce22a982516d86b535c"
+"checksum locale_config 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"08d2c35b16f4483f6c26f0e4e9550717a2f6575bcd6f12a53ff0c490a94a6934"
 "checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = 
"14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
 "checksum mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = 
"c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4"
+"checksum malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = 
"62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb"
 "checksum markup5ever 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"65381d9d47506b8592b97c4efd936afcf673b09b059f2bef39c7211ee78b9d03"
 "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = 
"7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
 "checksum matrixmultiply 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = 
"dcfed72d871629daa12b25af198f110e8095d7650f5f4c61c5bac28364604f9b"
@@ -1267,6 +1348,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index";
 "checksum num-complex 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = 
"fcb0cf31fb3ff77e6d2a6ebd6800df7fdcd106f2ad89113c9130bcd07f93dffc"
 "checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = 
"6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32"
 "checksum num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = 
"bcef43580c035376c0705c42792c294b66974abbfd2789b511784023f71f3273"
+"checksum objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = 
"31d20fd2b37e07cf5125be68357b588672e8cefe9a96f8c17a9d46053b3e590d"
+"checksum objc-foundation 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = 
"1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9"
+"checksum objc_id 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = 
"c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b"
 "checksum pango 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"393fa071b144f8ffb83ede273758983cf414ca3c0b1d2a5a9ce325b3ba3dd786"
 "checksum pango-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"1ee97abcad820f9875e032656257ad1c790e7b11a0e6ce2516a8f5b0d8f8213f"
 "checksum pangocairo 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"7486695787f206924b662cb8ca7b3c987fdbbff4ccff3612017cf471aee65162"
@@ -1279,8 +1363,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index";
 "checksum pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = 
"a7c1d2cfa5a714db3b5f24f0915e74fcdf91d09d496ba61329705dda7774d2af"
 "checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = 
"925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
 "checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = 
"cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
+"checksum proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = 
"4c5c2380ae88876faae57698be9e9775e3544decad214599c3a6266cca6ac802"
 "checksum procedural-masquerade 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = 
"9a1574a51c3fd37b26d2c0032b649d08a7d51d4cca9c41bbc5bf7118fa4509d0"
 "checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = 
"6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
+"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = 
"053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
 "checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = 
"6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca"
 "checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = 
"556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef"
 "checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = 
"7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
@@ -1306,24 +1392,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index";
 "checksum scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d"
 "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
 "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
-"checksum serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)" = 
"7fe5626ac617da2f2d9c48af5515a21d5a480dbd151e01bb1c355e26a3e68113"
-"checksum serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)" = 
"01e69e1b8a631f245467ee275b8c757b818653c6d704cdbcaeb56b56767b529c"
+"checksum serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)" = 
"fec2851eb56d010dc9a21b89ca53ee75e6528bab60c11e89d38390904982da9f"
+"checksum serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)" = 
"cb4dc18c61206b08dc98216c98faa0232f4337e1e1b8574551d5bad29ea1b425"
 "checksum serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = 
"051c49229f282f7c6f3813f8286cc1e3323e8051823fce42c7ea80fe13521704"
 "checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = 
"0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac"
 "checksum smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = 
"ab606a9c5e214920bb66c458cd7be8ef094f813f20fe77a54cc7dbfff220d4b7"
 "checksum string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = 
"25d70109977172b127fe834e5449e5ab1740b9ba49fa18a2020f509174f25423"
 "checksum string_cache_codegen 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = 
"1eea1eee654ef80933142157fdad9dd8bc43cf7c74e999e369263496f04ff4da"
 "checksum string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"b1884d1bc09741d466d9b14e6d37ac89d6909cbcac41dd9ae982d4d063bbedfc"
-"checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = 
"9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5"
+"checksum syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = 
"66850e97125af79138385e9b88339cbcd037e3f28ceab8c5ad98e64f0f1f80bf"
 "checksum tendril 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = 
"707feda9f2582d5d680d733e38755547a3e8fb471e7ba11452ecfd9ce93a5d3b"
 "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
 "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = 
"c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
 "checksum tinytemplate 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = 
"4574b75faccaacddb9b284faecdf0b544b80b6b294f3d062d325c5726a209c20"
-"checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169"
+"checksum typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = 
"6d2783fe2d6b8c1101136184eb41be8b1ad379e4657050b8aaff0c79ee7575f9"
 "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = 
"49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
 "checksum unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = 
"141339a08b982d942be2ca06ff8b076563cbe223d1befd5450716790d44e2426"
-"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = 
"882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526"
+"checksum unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = 
"7007dbd421b92cc6e28410fe7362e2e0a2503394908f417b68ec8d1c364c4e20"
 "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
+"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
 "checksum url 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = 
"75b414f6c464c879d7f9babf951f23bc3743fb7313c081b2e6ca719067ea9d61"
 "checksum utf-8 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = 
"05e42f7c18b8f902290b009cde6d651262f956c98bc51bca4cd1d511c9cd85c7"
 "checksum walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = 
"9658c94fa8b940eab2250bd5a457f9c48b748420d71293b165c8cdbe2f55f71e"
diff --git a/Cargo.toml b/Cargo.toml
index 9bde4269..615a17b0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,5 +1,6 @@
 [workspace]
 members = [
+    "librsvg",
     "librsvg_crate",
     "rsvg_internals",
 ]
diff --git a/Makefile.am b/Makefile.am
index 9289a384..0bf04599 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4,7 +4,7 @@ NULL =
 BUILT_SOURCES =
 
 lib_LTLIBRARIES = librsvg-@RSVG_API_MAJOR_VERSION@.la
-noinst_LTLIBRARIES = librsvg_internals.la
+noinst_LTLIBRARIES = librsvg_c_api.la
 
 bin_PROGRAMS = rsvg-convert
 
@@ -14,7 +14,7 @@ librsvg_@RSVG_API_MAJOR_VERSION@_la_SOURCES = \
        $(librsvg_c_srcs)                       \
        $(NULL)
 
-librsvg_internals_la_SOURCES =         \
+LIBRSVG_INTERNALS_SOURCES =                                    \
        Cargo.toml                                              \
        rsvg_internals/Cargo.toml                               \
        rsvg_internals/build.rs                                 \
@@ -22,7 +22,6 @@ librsvg_internals_la_SOURCES =                \
        rsvg_internals/src/angle.rs                             \
        rsvg_internals/src/aspect_ratio.rs                      \
        rsvg_internals/src/bbox.rs                              \
-       rsvg_internals/src/c_api.rs                             \
        rsvg_internals/src/clip_path.rs                         \
        rsvg_internals/src/color.rs                             \
        rsvg_internals/src/cond.rs                              \
@@ -98,7 +97,8 @@ librsvg_internals_la_SOURCES =                \
        rsvg_internals/src/viewbox.rs                           \
        rsvg_internals/src/xml.rs                               \
        rsvg_internals/src/xml2.rs                              \
-       rsvg_internals/src/xml2_load.rs
+       rsvg_internals/src/xml2_load.rs                         \
+       $(NULL)
 
 LIBRSVG_CRATE_SOURCES =                                        \
        librsvg_crate/Cargo.toml                                \
@@ -110,7 +110,15 @@ LIBRSVG_CRATE_SOURCES =                                    \
        librsvg_crate/tests/render_to_viewport.rs               \
        librsvg_crate/tests/primitives.rs                       \
        librsvg_crate/tests/utils/mod.rs                        \
-       librsvg_crate/tests/utils/compare_surfaces.rs
+       librsvg_crate/tests/utils/compare_surfaces.rs           \
+       $(NULL)
+
+LIBRSVG_C_API_SOURCES =                                                \
+       librsvg/Cargo.toml                                      \
+       librsvg/build.rs                                        \
+       librsvg/c_api.rs                                        \
+       librsvg/lib.rs                                          \
+       $(NULL)
 
 RUST_EXTRA =                                           \
        Cargo.lock                                      \
@@ -119,7 +127,8 @@ RUST_EXTRA =                                                \
        rsvg_internals/benches/composite.rs             \
        rsvg_internals/benches/lighting.rs              \
        rsvg_internals/benches/pixel_iterators.rs       \
-       rsvg_internals/benches/srgb.rs
+       rsvg_internals/benches/srgb.rs                  \
+       $(NULL)
 
 if DEBUG_RELEASE
 CARGO_RELEASE_ARGS=
@@ -140,7 +149,7 @@ LIBRSVG_BUILD_DIR=@abs_top_builddir@
 CARGO_TARGET_DIR=$(LIBRSVG_BUILD_DIR)/target
 LIBRSVG_TARGET_DIR=$(CARGO_TARGET_DIR)/$(RUST_TARGET_SUBDIR)
 
-RUST_LIB=$(LIBRSVG_BUILD_DIR)/.libs/librsvg_internals.a
+RUST_LIB=$(LIBRSVG_BUILD_DIR)/.libs/librsvg_c_api.a
 
 check-local:
        cd $(srcdir) && \
@@ -169,8 +178,8 @@ dist-hook:
        mkdir .cargo &&                                                         \
        cp cargo-vendor-config .cargo/config)
 
-librsvg_internals.la: $(librsvg_internals_la_SOURCES)
-       +cd $(top_srcdir)/rsvg_internals &&                                     \
+librsvg_c_api.la: $(LIBRSVG_INTERNALS_SOURCES) $(LIBRSVG_C_API_SOURCES)
+       +cd $(top_srcdir)/librsvg &&                                            \
        PKG_CONFIG_ALLOW_CROSS=1                                                \
        PKG_CONFIG='$(PKG_CONFIG)'                                              \
        CARGO_TARGET_DIR=$(CARGO_TARGET_DIR)                                    \
@@ -205,7 +214,7 @@ librsvg_@RSVG_API_MAJOR_VERSION@_la_LDFLAGS = \
        $(AM_LDFLAGS)
 
 librsvg_@RSVG_API_MAJOR_VERSION@_la_LIBADD = \
-       librsvg_internals.la \
+       librsvg_c_api.la \
        $(LIBRSVG_LIBS)         \
        $(LIBM)                 \
        $(DLOPEN_LIBS)
@@ -246,7 +255,8 @@ dist_doc_DATA =                             \
        code-of-conduct.md
 
 EXTRA_DIST =                           \
-       $(librsvg_internals_la_SOURCES)         \
+       $(LIBRSVG_INTERNALS_SOURCES)    \
+       $(LIBRSVG_C_API_SOURCES)        \
        $(RUST_EXTRA)                   \
        $(LIBRSVG_CRATE_SOURCES)        \
        librsvg.doap                    \
diff --git a/librsvg/Cargo.toml b/librsvg/Cargo.toml
new file mode 100644
index 00000000..39fb945b
--- /dev/null
+++ b/librsvg/Cargo.toml
@@ -0,0 +1,31 @@
+[package]
+name = "librsvg_c_api"
+version = "0.0.1"
+authors = ["Federico Mena Quintero <federico gnome org>"]
+workspace = "../"
+build = "build.rs"
+edition = "2018"
+
+[lib]
+name = "rsvg_c_api"
+path = "lib.rs"
+crate-type = [ "staticlib" ]
+
+[features]
+# Enables calling g_warning() when built as part of librsvg.so
+c-library = []
+
+[dependencies]
+bitflags = "1.0"
+cairo-rs = { version="0.7.0", features=["v1_16"] }
+cairo-sys-rs = "0.9.0"
+gdk-pixbuf = "0.7.0"
+gdk-pixbuf-sys = "0.9.0"
+glib = { version="0.8.0", features=["subclassing"] }
+glib-sys = "0.9.0"
+gio = { version="0.7.0", features=["v2_48"] } # per configure.ac
+gio-sys = "0.9.0"
+gobject-sys = "0.9.0"
+libc = "0.2"
+rsvg_internals = { path = "../rsvg_internals" }
+url = "2"
diff --git a/librsvg/build.rs b/librsvg/build.rs
new file mode 100644
index 00000000..0dcdb6f3
--- /dev/null
+++ b/librsvg/build.rs
@@ -0,0 +1,70 @@
+use std::env;
+use std::fs::File;
+use std::io::prelude::*;
+
+#[cfg(all(unix, feature = "c-library"))]
+use std::os::unix::fs::symlink;
+
+#[cfg(all(windows, not(target_env = "msvc"), feature="c-library"))]
+use std::os::windows::fs::symlink_file as symlink;
+
+#[cfg(all(not(target_env = "msvc"), feature="c-library"))]
+use std::fs;
+#[cfg(all(not(target_env = "msvc"), feature="c-library"))]
+use std::path::PathBuf;
+
+fn main() {
+    generate_convenience_lib().unwrap();
+}
+
+/// Generate libtool archive file librsvg_c_api.la
+/// From: https://docs.rs/libtool/0.1.1/libtool/
+#[cfg(all(feature = "c-library", not(target_env = "msvc")))]
+pub fn generate_convenience_lib() -> std::io::Result<()> {
+    let target = env::var("TARGET").expect("TARGET was not set");
+    let build_dir = env::var("LIBRSVG_BUILD_DIR").expect("LIBRSVG_BUILD_DIR was not set");
+    let target_dir = env::var("LIBRSVG_TARGET_DIR").expect("LIBRSVG_TARGET_DIR was not set");
+    let libs_dir = format!("{}/.libs", build_dir);
+    let libs_path = PathBuf::from(&libs_dir);
+    let la_path = PathBuf::from(format!("{}/librsvg_c_api.la", build_dir));
+    let rust_lib = if target.contains("windows") {
+        /* https://github.com/rust-lang/rust/issues/43749 */
+        "rsvg_c_api.lib"
+    } else {
+        "librsvg_c_api.a"
+    };
+    let old_lib_path = PathBuf::from(format!("{}/{}", target_dir, rust_lib));
+    let new_lib_path = PathBuf::from(format!("{}/librsvg_c_api.a", libs_dir));
+
+    match fs::create_dir_all(&libs_path) {
+        Ok(()) => println!("libs_path created"),
+        _ => panic!("Failed to create libs_path"),
+    }
+
+    if la_path.exists() {
+        fs::remove_file(&la_path)?;
+    }
+
+    /* PathBuf.exists() traverses symlinks so just try and remove it */
+    match fs::remove_file(&new_lib_path) {
+        Ok(_v) => {},
+        Err(e) => println!("Error removing symlink: {:?}", e),
+    }
+
+    let mut file = File::create(&la_path).unwrap();
+    writeln!(file, "# librsvg_c_api.la - a libtool library file")?;
+    writeln!(file, "# Generated by libtool-rust")?;
+    writeln!(file, "dlname=''")?;
+    writeln!(file, "library_names=''")?;
+    writeln!(file, "old_library='librsvg_c_api.a'")?;
+    writeln!(file, "inherited_linker_flags=''")?;
+    writeln!(file, "installed=no")?;
+    writeln!(file, "shouldnotlink=no")?;
+    symlink(&old_lib_path, &new_lib_path)?;
+    Ok(())
+}
+
+#[cfg(not(all(feature = "c-library", not(target_env = "msvc"))))]
+pub fn generate_convenience_lib() -> std::io::Result<()> {
+    Ok(())
+}
diff --git a/rsvg_internals/src/c_api.rs b/librsvg/c_api.rs
similarity index 94%
rename from rsvg_internals/src/c_api.rs
rename to librsvg/c_api.rs
index 005e0cab..4bc211a5 100644
--- a/rsvg_internals/src/c_api.rs
+++ b/librsvg/c_api.rs
@@ -8,13 +8,16 @@ use std::sync::Once;
 use std::{f64, i32};
 
 use cairo;
+use cairo_sys;
 use gdk_pixbuf::Pixbuf;
+use gdk_pixbuf_sys;
 use libc;
 use url::Url;
 
 use bitflags::bitflags;
 
 use gio::prelude::*;
+use gio_sys;
 
 use glib::object::ObjectClass;
 use glib::subclass;
@@ -30,12 +33,11 @@ use glib::{
 use glib_sys;
 use gobject_sys::{self, GEnumValue, GFlagsValue};
 
-use crate::dpi::Dpi;
-use crate::drawing_ctx::RsvgRectangle;
-use crate::error::{set_gerror, DefsLookupErrorKind, LoadingError, RenderingError, RSVG_ERROR_FAILED};
-use crate::handle::{Handle, LoadOptions};
-use crate::length::RsvgLength;
-use crate::structure::IntrinsicDimensions;
+use rsvg_internals::{
+    rsvg_log, set_gerror, DefsLookupErrorKind, Dpi, Handle, IntrinsicDimensions, LoadOptions,
+    LoadingError, RenderingError, RsvgDimensionData, RsvgLength, RsvgPositionData, RsvgRectangle,
+    RsvgSizeFunc, SizeCallback, RSVG_ERROR_FAILED,
+};
 
 mod handle_flags {
     // The following is entirely stolen from the auto-generated code
@@ -127,45 +129,6 @@ impl From<LoadFlags> for HandleFlags {
     }
 }
 
-// Keep in sync with rsvg.h:RsvgDimensionData
-#[repr(C)]
-pub struct RsvgDimensionData {
-    pub width: libc::c_int,
-    pub height: libc::c_int,
-    pub em: f64,
-    pub ex: f64,
-}
-
-impl RsvgDimensionData {
-    // This is not #[derive(Default)] to make it clear that it
-    // shouldn't be the default value for anything; it is actually a
-    // special case we use to indicate an error to the public API.
-    pub fn empty() -> RsvgDimensionData {
-        RsvgDimensionData {
-            width: 0,
-            height: 0,
-            em: 0.0,
-            ex: 0.0,
-        }
-    }
-}
-
-// Keep in sync with rsvg.h:RsvgPositionData
-#[repr(C)]
-pub struct RsvgPositionData {
-    pub x: libc::c_int,
-    pub y: libc::c_int,
-}
-
-// Keep in sync with rsvg.h:RsvgSizeFunc
-pub type RsvgSizeFunc = Option<
-    unsafe extern "C" fn(
-        inout_width: *mut libc::c_int,
-        inout_height: *mut libc::c_int,
-        user_data: glib_sys::gpointer,
-    ),
->;
-
 // Keep this in sync with rsvg.h:RsvgHandleClass
 #[repr(C)]
 pub struct RsvgHandleClass {
@@ -182,63 +145,6 @@ pub struct RsvgHandle {
     _abi_padding: [glib_sys::gpointer; 16],
 }
 
-pub struct SizeCallback {
-    size_func: RsvgSizeFunc,
-    user_data: glib_sys::gpointer,
-    destroy_notify: glib_sys::GDestroyNotify,
-    in_loop: Cell<bool>,
-}
-
-impl SizeCallback {
-    pub fn call(&self, width: libc::c_int, height: libc::c_int) -> (libc::c_int, libc::c_int) {
-        unsafe {
-            let mut w = width;
-            let mut h = height;
-
-            if let Some(ref f) = self.size_func {
-                f(&mut w, &mut h, self.user_data);
-            };
-
-            (w, h)
-        }
-    }
-
-    pub fn start_loop(&self) {
-        assert!(!self.in_loop.get());
-        self.in_loop.set(true);
-    }
-
-    pub fn end_loop(&self) {
-        assert!(self.in_loop.get());
-        self.in_loop.set(false);
-    }
-
-    pub fn get_in_loop(&self) -> bool {
-        self.in_loop.get()
-    }
-}
-
-impl Default for SizeCallback {
-    fn default() -> SizeCallback {
-        SizeCallback {
-            size_func: None,
-            user_data: ptr::null_mut(),
-            destroy_notify: None,
-            in_loop: Cell::new(false),
-        }
-    }
-}
-
-impl Drop for SizeCallback {
-    fn drop(&mut self) {
-        unsafe {
-            if let Some(ref f) = self.destroy_notify {
-                f(self.user_data);
-            };
-        }
-    }
-}
-
 enum LoadState {
     // Just created the CHandle
     Start,
@@ -534,12 +440,7 @@ impl CHandle {
         user_data: glib_sys::gpointer,
         destroy_notify: glib_sys::GDestroyNotify,
     ) {
-        *self.size_callback.borrow_mut() = SizeCallback {
-            size_func,
-            user_data,
-            destroy_notify,
-            in_loop: Cell::new(false),
-        };
+        *self.size_callback.borrow_mut() = SizeCallback::new(size_func, user_data, destroy_notify);
     }
 
     fn write(&self, buf: &[u8]) {
@@ -1538,8 +1439,7 @@ pub fn rsvg_g_critical(msg: &str) {
 }
 
 #[cfg(not(feature = "c-library"))]
-pub fn rsvg_g_critical(_msg: &str) {
-}
+pub fn rsvg_g_critical(_msg: &str) {}
 
 #[cfg(test)]
 mod tests {
diff --git a/librsvg/lib.rs b/librsvg/lib.rs
new file mode 100644
index 00000000..20a4a39a
--- /dev/null
+++ b/librsvg/lib.rs
@@ -0,0 +1,42 @@
+#![allow(clippy::clone_on_ref_ptr)]
+#![allow(clippy::not_unsafe_ptr_arg_deref)]
+#![allow(clippy::too_many_arguments)]
+#![warn(unused)]
+
+pub use crate::c_api::{
+    rsvg_rust_error_get_type,
+    rsvg_rust_handle_close,
+    rsvg_rust_handle_flags_get_type,
+    rsvg_rust_handle_get_base_url,
+    rsvg_rust_handle_get_dimensions,
+    rsvg_rust_handle_get_dimensions_sub,
+    rsvg_rust_handle_get_dpi_x,
+    rsvg_rust_handle_get_dpi_y,
+    rsvg_rust_handle_get_flags,
+    rsvg_rust_handle_get_geometry_for_element,
+    rsvg_rust_handle_get_geometry_for_layer,
+    rsvg_rust_handle_get_intrinsic_dimensions,
+    rsvg_rust_handle_get_pixbuf_sub,
+    rsvg_rust_handle_get_position_sub,
+    rsvg_rust_handle_has_sub,
+    rsvg_rust_handle_new_from_data,
+    rsvg_rust_handle_new_from_file,
+    rsvg_rust_handle_new_from_gfile_sync,
+    rsvg_rust_handle_new_from_stream_sync,
+    rsvg_rust_handle_new_with_flags,
+    rsvg_rust_handle_read_stream_sync,
+    rsvg_rust_handle_render_cairo_sub,
+    rsvg_rust_handle_render_element,
+    rsvg_rust_handle_render_document,
+    rsvg_rust_handle_render_layer,
+    rsvg_rust_handle_set_base_gfile,
+    rsvg_rust_handle_set_base_url,
+    rsvg_rust_handle_set_dpi_x,
+    rsvg_rust_handle_set_dpi_y,
+    rsvg_rust_handle_set_flags,
+    rsvg_rust_handle_set_size_callback,
+    rsvg_rust_handle_set_testing,
+    rsvg_rust_handle_write,
+};
+
+mod c_api;
diff --git a/rsvg_internals/Cargo.toml b/rsvg_internals/Cargo.toml
index 873371bc..dbd23948 100644
--- a/rsvg_internals/Cargo.toml
+++ b/rsvg_internals/Cargo.toml
@@ -18,7 +18,6 @@ edition = "2018"
 # from there into cargo-fetcher/Cargo.toml.
 
 [dependencies]
-bitflags = "1.0"
 cairo-rs = { version="0.7.0", features=["v1_16"] }
 cairo-sys-rs = "0.9.0"
 cssparser = "0.25.5"
@@ -30,9 +29,8 @@ gdk-pixbuf = "0.7.0"
 gdk-pixbuf-sys = "0.9.0"
 gio = { version="0.7.0", features=["v2_48"] } # per configure.ac
 gio-sys = "0.9.0"
-glib = { version="0.8.0", features=["subclassing"] }
+glib = { version="0.8.0" }
 glib-sys = "0.9.0"
-gobject-sys = "0.9.0"
 itertools = "0.8"
 language-tags = "0.2.2"
 lazy_static = "1.0.0"
@@ -56,7 +54,6 @@ criterion = "0.2"
 
 [lib]
 name = "rsvg_internals"
-crate-type = ["staticlib", "lib"]
 
 [[bench]]
 name = "box_blur"
@@ -77,7 +74,3 @@ harness = false
 [[bench]]
 name = "srgb"
 harness = false
-
-[features]
-# Enables calling g_warning() when built as part of librsvg.so
-c-library = []
diff --git a/rsvg_internals/build.rs b/rsvg_internals/build.rs
index e29e45de..b30fac62 100644
--- a/rsvg_internals/build.rs
+++ b/rsvg_internals/build.rs
@@ -3,21 +3,8 @@ use std::fs::File;
 use std::io::{BufWriter, Write};
 use std::path::Path;
 
-#[cfg(all(unix, feature = "c-library"))]
-use std::os::unix::fs::symlink;
-
-#[cfg(all(windows, not(target_env = "msvc"), feature="c-library"))]
-use std::os::windows::fs::symlink_file as symlink;
-
-#[cfg(all(not(target_env = "msvc"), feature="c-library"))]
-use std::fs;
-#[cfg(all(not(target_env = "msvc"), feature="c-library"))]
-use std::path::PathBuf;
-
 fn main() {
     generate_srgb_tables();
-
-    generate_convenience_lib().unwrap();
 }
 
 /// Converts an sRGB color value to a linear sRGB color value (undoes the gamma correction).
@@ -76,55 +63,3 @@ fn generate_srgb_tables() {
     print_table(&mut file, "LINEARIZE", &linearize_table);
     print_table(&mut file, "UNLINEARIZE", &unlinearize_table);
 }
-
-/// Generate libtool archive file librsvg_internals.la
-/// From: https://docs.rs/libtool/0.1.1/libtool/
-#[cfg(all(feature = "c-library", not(target_env = "msvc")))]
-pub fn generate_convenience_lib() -> std::io::Result<()> {
-    let target = env::var("TARGET").expect("TARGET was not set");
-    let build_dir = env::var("LIBRSVG_BUILD_DIR").expect("LIBRSVG_BUILD_DIR was not set");
-    let target_dir = env::var("LIBRSVG_TARGET_DIR").expect("LIBRSVG_TARGET_DIR was not set");
-    let libs_dir = format!("{}/.libs", build_dir);
-    let libs_path = PathBuf::from(&libs_dir);
-    let la_path = PathBuf::from(format!("{}/librsvg_internals.la", build_dir));
-    let rust_lib = if target.contains("windows") {
-        /* https://github.com/rust-lang/rust/issues/43749 */
-        "rsvg_internals.lib"
-    } else {
-        "librsvg_internals.a"
-    };
-    let old_lib_path = PathBuf::from(format!("{}/{}", target_dir, rust_lib));
-    let new_lib_path = PathBuf::from(format!("{}/librsvg_internals.a", libs_dir));
-
-    match fs::create_dir_all(&libs_path) {
-        Ok(()) => println!("libs_path created"),
-        _ => panic!("Failed to create libs_path"),
-    }
-
-    if la_path.exists() {
-        fs::remove_file(&la_path)?;
-    }
-
-    /* PathBuf.exists() traverses symlinks so just try and remove it */
-    match fs::remove_file(&new_lib_path) {
-        Ok(_v) => {},
-        Err(e) => println!("Error removing symlink: {:?}", e),
-    }
-
-    let mut file = File::create(&la_path).unwrap();
-    writeln!(file, "# librsvg_internals.la - a libtool library file")?;
-    writeln!(file, "# Generated by libtool-rust")?;
-    writeln!(file, "dlname=''")?;
-    writeln!(file, "library_names=''")?;
-    writeln!(file, "old_library='librsvg_internals.a'")?;
-    writeln!(file, "inherited_linker_flags=''")?;
-    writeln!(file, "installed=no")?;
-    writeln!(file, "shouldnotlink=no")?;
-    symlink(&old_lib_path, &new_lib_path)?;
-    Ok(())
-}
-
-#[cfg(not(all(feature = "c-library", not(target_env = "msvc"))))]
-pub fn generate_convenience_lib() -> std::io::Result<()> {
-    Ok(())
-}
diff --git a/rsvg_internals/src/handle.rs b/rsvg_internals/src/handle.rs
index 290ad5e4..04358d60 100644
--- a/rsvg_internals/src/handle.rs
+++ b/rsvg_internals/src/handle.rs
@@ -1,3 +1,5 @@
+use std::cell::Cell;
+use std::ptr;
 use std::rc::Rc;
 
 use cairo::{self, ImageSurface, Status};
@@ -9,7 +11,6 @@ use locale_config::{LanguageRange, Locale};
 
 use crate::allowed_url::{AllowedUrl, Href};
 use crate::bbox::BoundingBox;
-use crate::c_api::{RsvgDimensionData, RsvgPositionData, SizeCallback};
 use crate::dpi::Dpi;
 use crate::drawing_ctx::{DrawingCtx, RsvgRectangle};
 use crate::error::{DefsLookupErrorKind, LoadingError, RenderingError};
@@ -68,6 +69,115 @@ impl LoadOptions {
     }
 }
 
+// Keep in sync with rsvg.h:RsvgDimensionData
+#[repr(C)]
+pub struct RsvgDimensionData {
+    pub width: libc::c_int,
+    pub height: libc::c_int,
+    pub em: f64,
+    pub ex: f64,
+}
+
+impl RsvgDimensionData {
+    // This is not #[derive(Default)] to make it clear that it
+    // shouldn't be the default value for anything; it is actually a
+    // special case we use to indicate an error to the public API.
+    pub fn empty() -> RsvgDimensionData {
+        RsvgDimensionData {
+            width: 0,
+            height: 0,
+            em: 0.0,
+            ex: 0.0,
+        }
+    }
+}
+
+// Keep in sync with rsvg.h:RsvgPositionData
+#[repr(C)]
+pub struct RsvgPositionData {
+    pub x: libc::c_int,
+    pub y: libc::c_int,
+}
+
+// Keep in sync with rsvg.h:RsvgSizeFunc
+pub type RsvgSizeFunc = Option<
+    unsafe extern "C" fn(
+        inout_width: *mut libc::c_int,
+        inout_height: *mut libc::c_int,
+        user_data: glib_sys::gpointer,
+    ),
+>;
+
+pub struct SizeCallback {
+    pub size_func: RsvgSizeFunc,
+    pub user_data: glib_sys::gpointer,
+    pub destroy_notify: glib_sys::GDestroyNotify,
+    pub in_loop: Cell<bool>,
+}
+
+impl SizeCallback {
+    pub fn new(
+        size_func: RsvgSizeFunc,
+        user_data: glib_sys::gpointer,
+        destroy_notify: glib_sys::GDestroyNotify,
+    ) -> Self {
+        SizeCallback {
+            size_func,
+            user_data,
+            destroy_notify,
+            in_loop: Cell::new(false),
+        }
+    }
+
+    pub fn call(&self, width: libc::c_int, height: libc::c_int) -> (libc::c_int, libc::c_int) {
+        unsafe {
+            let mut w = width;
+            let mut h = height;
+
+            if let Some(ref f) = self.size_func {
+                f(&mut w, &mut h, self.user_data);
+            };
+
+            (w, h)
+        }
+    }
+
+    pub fn start_loop(&self) {
+        assert!(!self.in_loop.get());
+        self.in_loop.set(true);
+    }
+
+    pub fn end_loop(&self) {
+        assert!(self.in_loop.get());
+        self.in_loop.set(false);
+    }
+
+    pub fn get_in_loop(&self) -> bool {
+        self.in_loop.get()
+    }
+}
+
+impl Default for SizeCallback {
+    fn default() -> SizeCallback {
+        SizeCallback {
+            size_func: None,
+            user_data: ptr::null_mut(),
+            destroy_notify: None,
+            in_loop: Cell::new(false),
+        }
+    }
+}
+
+impl Drop for SizeCallback {
+    fn drop(&mut self) {
+        unsafe {
+            if let Some(ref f) = self.destroy_notify {
+                f(self.user_data);
+            };
+        }
+    }
+}
+
 pub struct Handle {
     svg: Rc<Svg>,
 }
diff --git a/rsvg_internals/src/lib.rs b/rsvg_internals/src/lib.rs
index d359fde9..4257232a 100644
--- a/rsvg_internals/src/lib.rs
+++ b/rsvg_internals/src/lib.rs
@@ -5,42 +5,6 @@
 
 use ::xml as xml_rs;
 
-pub use crate::c_api::{
-    rsvg_rust_error_get_type,
-    rsvg_rust_handle_close,
-    rsvg_rust_handle_flags_get_type,
-    rsvg_rust_handle_get_base_url,
-    rsvg_rust_handle_get_dimensions,
-    rsvg_rust_handle_get_dimensions_sub,
-    rsvg_rust_handle_get_dpi_x,
-    rsvg_rust_handle_get_dpi_y,
-    rsvg_rust_handle_get_flags,
-    rsvg_rust_handle_get_geometry_for_element,
-    rsvg_rust_handle_get_geometry_for_layer,
-    rsvg_rust_handle_get_intrinsic_dimensions,
-    rsvg_rust_handle_get_pixbuf_sub,
-    rsvg_rust_handle_get_position_sub,
-    rsvg_rust_handle_has_sub,
-    rsvg_rust_handle_new_from_data,
-    rsvg_rust_handle_new_from_file,
-    rsvg_rust_handle_new_from_gfile_sync,
-    rsvg_rust_handle_new_from_stream_sync,
-    rsvg_rust_handle_new_with_flags,
-    rsvg_rust_handle_read_stream_sync,
-    rsvg_rust_handle_render_cairo_sub,
-    rsvg_rust_handle_render_element,
-    rsvg_rust_handle_render_document,
-    rsvg_rust_handle_render_layer,
-    rsvg_rust_handle_set_base_gfile,
-    rsvg_rust_handle_set_base_url,
-    rsvg_rust_handle_set_dpi_x,
-    rsvg_rust_handle_set_dpi_y,
-    rsvg_rust_handle_set_flags,
-    rsvg_rust_handle_set_size_callback,
-    rsvg_rust_handle_set_testing,
-    rsvg_rust_handle_write,
-};
-
 pub use crate::color::{rsvg_css_parse_color, ColorKind, ColorSpec};
 
 pub use crate::dpi::{rsvg_rust_set_default_dpi_x_y, Dpi};
@@ -48,28 +12,27 @@ pub use crate::dpi::{rsvg_rust_set_default_dpi_x_y, Dpi};
 pub use crate::drawing_ctx::RsvgRectangle;
 
 pub use crate::error::{
-    rsvg_rust_error_quark,
-    DefsLookupErrorKind,
-    HrefError,
-    LoadingError,
-    RenderingError,
+    rsvg_rust_error_quark, set_gerror, DefsLookupErrorKind, HrefError, LoadingError,
+    RenderingError, RSVG_ERROR_FAILED,
 };
 
-pub use crate::handle::{Handle, LoadOptions};
+pub use crate::handle::{
+    Handle, LoadOptions, RsvgDimensionData, RsvgPositionData, RsvgSizeFunc, SizeCallback,
+};
 
-pub use crate::length::{Length, LengthUnit};
+pub use crate::length::{Length, LengthUnit, RsvgLength};
 
 pub use crate::pixbuf_utils::{
-    rsvg_rust_pixbuf_from_file_at_max_size,
-    rsvg_rust_pixbuf_from_file_at_size,
-    rsvg_rust_pixbuf_from_file_at_zoom,
-    rsvg_rust_pixbuf_from_file_at_zoom_with_max,
+    rsvg_rust_pixbuf_from_file_at_max_size, rsvg_rust_pixbuf_from_file_at_size,
+    rsvg_rust_pixbuf_from_file_at_zoom, rsvg_rust_pixbuf_from_file_at_zoom_with_max,
 };
 
 pub use crate::rect::IRect;
 
+pub use crate::structure::IntrinsicDimensions;
+
 #[macro_use]
-mod log;
+pub mod log;
 
 #[macro_use]
 mod coord_units;
@@ -84,7 +47,6 @@ mod allowed_url;
 mod angle;
 mod aspect_ratio;
 mod bbox;
-mod c_api;
 mod clip_path;
 mod color;
 mod cond;
diff --git a/rsvg_internals/src/log.rs b/rsvg_internals/src/log.rs
index 2d3e059d..6956dea2 100644
--- a/rsvg_internals/src/log.rs
+++ b/rsvg_internals/src/log.rs
@@ -5,7 +5,7 @@ macro_rules! rsvg_log {
     (
         $($arg:tt)+
     ) => {
-        if crate::log::log_enabled() {
+        if $crate::log::log_enabled() {
             println!("{}", format_args!($($arg)+));
         }
     };
diff --git a/rsvg_internals/src/pixbuf_utils.rs b/rsvg_internals/src/pixbuf_utils.rs
index 1c03717e..bab49565 100644
--- a/rsvg_internals/src/pixbuf_utils.rs
+++ b/rsvg_internals/src/pixbuf_utils.rs
@@ -11,10 +11,9 @@ use glib_sys;
 use libc;
 use url::Url;
 
-use crate::c_api::{RsvgDimensionData, SizeCallback};
 use crate::dpi::Dpi;
 use crate::error::{set_gerror, LoadingError, RenderingError};
-use crate::handle::{Handle, LoadOptions};
+use crate::handle::{Handle, LoadOptions, RsvgDimensionData, SizeCallback};
 use crate::rect::IRect;
 use crate::surface_utils::{
     iterators::Pixels,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]