librsvg_crate: New crate; this will be the public Rust API for Rust programs

The idea is to have this:

  rsvg_internals - actual implementation of the library

  librsvg - C library, also used for GObject Introspection

  librsvg_crate - public crate "librsvg" for Rust callers, visible from crates.io

The crate is not called "rsvg" publically, because the rsvg-rs
bindings already use that name: https://github.com/selaux/rsvg-rs
parent 0cec3d1a
......@@ -584,6 +584,16 @@ name = "libm"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "librsvg"
version = "0.0.1"
dependencies = [
"cairo-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rsvg_internals 0.0.1",
"url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "locale_config"
version = "0.2.2"
......
[workspace]
members = [
"librsvg_crate",
"rsvg_internals",
]
......
......@@ -114,6 +114,10 @@ RUST_SRC = \
rsvg_internals/src/xml2.rs \
rsvg_internals/src/xml2_load.rs
LIBRSVG_CRATE_SOURCES = \
librsvg_crate/Cargo.toml \
librsvg_crate/src/lib.rs
RUST_EXTRA = \
Cargo.lock \
cargo-vendor-config \
......@@ -263,6 +267,7 @@ dist_doc_DATA = \
EXTRA_DIST = \
$(RUST_SRC) \
$(RUST_EXTRA) \
$(LIBRSVG_CRATE_SOURCES) \
librsvg.doap \
AUTHORS \
NEWS \
......
[package]
name = "librsvg"
version = "0.0.1"
authors = ["Federico Mena Quintero <federico@gnome.org>"]
workspace = "../"
[lib]
name = "librsvg"
[dependencies]
cairo-rs = "0.5.0"
gio = { version="0.5.1", features=["v2_48"] } # per configure.ac
rsvg_internals = { path = "../rsvg_internals" }
url = "1.7.2"
#![warn(unused)]
extern crate rsvg_internals;
extern crate url;
use url::Url;
/// Full configuration for loading an [`SvgHandle`][SvgHandle]
///
/// [SvgHandle]: struct.SvgHandle.html
pub struct LoadOptions {
unlimited_size: bool,
keep_image_data: bool,
base_url: Option<Url>,
}
impl LoadOptions {
pub fn new() -> Self {
LoadOptions {
unlimited_size: false,
keep_image_data: false,
base_url: None,
}
}
pub fn base_url(mut self, url: Option<&Url>) -> Self {
self.base_url = url.map(|u| u.clone());
self
}
pub fn unlimited_size(mut self, unlimited: bool) -> Self {
self.unlimited_size = unlimited;
self
}
pub fn keep_image_data(mut self, keep: bool) -> Self {
self.keep_image_data = keep;
self
}
}
pub struct SvgHandle {
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment