diff --git a/src/rust/Cargo.lock b/src/rust/Cargo.lock index d082b6b..fe04699 100644 --- a/src/rust/Cargo.lock +++ b/src/rust/Cargo.lock @@ -188,9 +188,9 @@ dependencies = [ [[package]] name = "savvy" -version = "0.1.19" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f4fde07ca332736e5df239a4bcfbbb30cb76c997f4e084694426cf960a275b2" +checksum = "cb3d94cb5d1f0b63f977a7803e3ec9e53424d88a035f26e28997a1231c6b57aa" dependencies = [ "cc", "once_cell", @@ -200,9 +200,9 @@ dependencies = [ [[package]] name = "savvy-bindgen" -version = "0.1.19" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d997f061fcdf56ce60b5515f671d3d1b1ef401521c1ee2ed7467492eebfa958" +checksum = "35048a37c7978a18b4dda9c6a68cee383266f6d3e8009b35f65405fa56c85db8" dependencies = [ "proc-macro2", "quote", @@ -217,9 +217,9 @@ checksum = "3405f314296bdb504aaec0f5ff3551b74917be9dd9d2e36949a672b202b34382" [[package]] name = "savvy-macro" -version = "0.1.19" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e884269440be52a9964c656458195f19c8a3deb0e709ac9a9fb9e764826f655" +checksum = "45b5e2be61d025f196903ad12f4b768df18b7eef2cd04e10c3022c34040e9cb9" dependencies = [ "proc-macro2", "quote", diff --git a/src/rust/src/lib.rs b/src/rust/src/lib.rs index cee125b..04b7abc 100644 --- a/src/rust/src/lib.rs +++ b/src/rust/src/lib.rs @@ -22,7 +22,7 @@ fn string2any_family( tolerance: f64, line_width: f64, ct: ConversionType, -) -> savvy::Result { +) -> savvy::Result { let mut builder = builder::LyonPathBuilder::new(tolerance as _, line_width as _); builder @@ -44,7 +44,7 @@ fn string2any_file( tolerance: f64, line_width: f64, ct: ConversionType, -) -> savvy::Result { +) -> savvy::Result { let mut builder = builder::LyonPathBuilder::new(tolerance as _, line_width as _); builder.outline_from_file(text, font_file).unwrap(); @@ -65,7 +65,7 @@ fn string2path_family( font_weight: &str, font_style: &str, tolerance: f64, -) -> savvy::Result { +) -> savvy::Result { string2any_family( text, font_family, @@ -78,7 +78,7 @@ fn string2path_family( } #[savvy] -fn string2path_file(text: &str, font_file: &str, tolerance: f64) -> savvy::Result { +fn string2path_file(text: &str, font_file: &str, tolerance: f64) -> savvy::Result { string2any_file(text, font_file, tolerance, 0., ConversionType::Path) } @@ -90,7 +90,7 @@ fn string2stroke_family( font_style: &str, tolerance: f64, line_width: f64, -) -> savvy::Result { +) -> savvy::Result { string2any_family( text, font_family, @@ -108,7 +108,7 @@ fn string2stroke_file( font_file: &str, tolerance: f64, line_width: f64, -) -> savvy::Result { +) -> savvy::Result { string2any_file(text, font_file, tolerance, line_width, ConversionType::Path) } @@ -119,7 +119,7 @@ fn string2fill_family( font_weight: &str, font_style: &str, tolerance: f64, -) -> savvy::Result { +) -> savvy::Result { string2any_family( text, font_family, @@ -132,12 +132,12 @@ fn string2fill_family( } #[savvy] -fn string2fill_file(text: &str, font_file: &str, tolerance: f64) -> savvy::Result { +fn string2fill_file(text: &str, font_file: &str, tolerance: f64) -> savvy::Result { string2any_file(text, font_file, tolerance, 0., ConversionType::Path) } #[savvy] -fn dump_fontdb_impl() -> savvy::Result { +fn dump_fontdb_impl() -> savvy::Result { let mut source: Vec = Vec::new(); let mut index: Vec = Vec::new(); let mut family: Vec = Vec::new(); diff --git a/src/rust/src/result.rs b/src/rust/src/result.rs index cf01778..df075c3 100644 --- a/src/rust/src/result.rs +++ b/src/rust/src/result.rs @@ -1,4 +1,4 @@ -use savvy::{OwnedIntegerSxp, OwnedRealSxp, OwnedStringSxp}; +use savvy::{OwnedIntegerSexp, OwnedRealSexp, OwnedStringSexp}; /// An intermediate form of the extracted path information to convert to a tibble. pub struct PathTibble { @@ -14,35 +14,35 @@ pub struct PathTibble { pub triangle_id: Option>, } -impl TryFrom for savvy::SEXP { +impl TryFrom for savvy::Sexp { type Error = savvy::Error; fn try_from(value: PathTibble) -> savvy::Result { let len = if value.triangle_id.is_none() { 4 } else { 5 }; - let mut out = savvy::OwnedListSxp::new(len, true)?; + let mut out = savvy::OwnedListSexp::new(len, true)?; - out.set_name_and_value(0, "x", ::try_from(value.x.as_slice())?)?; - out.set_name_and_value(1, "y", ::try_from(value.y.as_slice())?)?; + out.set_name_and_value(0, "x", ::try_from(value.x.as_slice())?)?; + out.set_name_and_value(1, "y", ::try_from(value.y.as_slice())?)?; out.set_name_and_value( 2, "glyph_id", - ::try_from(value.glyph_id.as_slice())?, + ::try_from(value.glyph_id.as_slice())?, )?; out.set_name_and_value( 3, "path_id", - ::try_from(value.path_id.as_slice())?, + ::try_from(value.path_id.as_slice())?, )?; if let Some(triangle_id) = value.triangle_id { out.set_name_and_value( 4, "triangle_id", - ::try_from(triangle_id.as_slice())?, + ::try_from(triangle_id.as_slice())?, )?; } - Ok(out.into()) + out.into() } } @@ -55,29 +55,37 @@ pub struct FontDBTibble { pub style: Vec, } -impl TryFrom for savvy::SEXP { +impl TryFrom for savvy::Sexp { type Error = savvy::Error; fn try_from(value: FontDBTibble) -> savvy::Result { - let mut out = savvy::OwnedListSxp::new(5, true)?; + let mut out = savvy::OwnedListSexp::new(5, true)?; - out.set_name_and_value(0, "x", ::try_from(value.source.as_slice())?)?; - out.set_name_and_value(1, "y", ::try_from(value.index.as_slice())?)?; + out.set_name_and_value( + 0, + "x", + ::try_from(value.source.as_slice())?, + )?; + out.set_name_and_value( + 1, + "y", + ::try_from(value.index.as_slice())?, + )?; out.set_name_and_value( 2, "family", - ::try_from(value.family.as_slice())?, + ::try_from(value.family.as_slice())?, )?; out.set_name_and_value( 3, "weight", - ::try_from(value.weight.as_slice())?, + ::try_from(value.weight.as_slice())?, )?; out.set_name_and_value( 4, "style", - ::try_from(value.style.as_slice())?, + ::try_from(value.style.as_slice())?, )?; - Ok(out.into()) + out.into() } } diff --git a/src/rust/vendor.tar.xz b/src/rust/vendor.tar.xz index 6c3486e..0c93f03 100644 Binary files a/src/rust/vendor.tar.xz and b/src/rust/vendor.tar.xz differ