diff --git a/Cargo.lock b/Cargo.lock index 75d4f99a..08f099fb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1187,10 +1187,10 @@ dependencies = [ [[package]] name = "lyon_extra" -version = "1.0.3" +version = "1.1.0" dependencies = [ "lyon_path", - "thiserror 1.0.65", + "thiserror 2.0.11", ] [[package]] diff --git a/crates/extra/Cargo.toml b/crates/extra/Cargo.toml index 04ef0815..9069e3f1 100644 --- a/crates/extra/Cargo.toml +++ b/crates/extra/Cargo.toml @@ -1,19 +1,22 @@ [package] name = "lyon_extra" -version = "1.0.3" +version = "1.1.0" description = "Various optional utilities for the lyon crate." authors = ["Nicolas Silva "] repository = "https://github.com/nical/lyon" documentation = "https://docs.rs/lyon_extra/" license = "MIT OR Apache-2.0" workspace = "../.." +edition = "2018" [lib] name = "lyon_extra" [features] +default = ["std"] serialization = ["lyon_path/serialization"] +std = ["thiserror/std", "lyon_path/std"] [dependencies] -lyon_path = { version = "1.0.0", path = "../path" } -thiserror = "1.0" +lyon_path = { version = "1.0.0", path = "../path", default-features = false } +thiserror = { version = "2.0", default-features = false } diff --git a/crates/extra/src/debugging.rs b/crates/extra/src/debugging.rs index cc203724..9abd585f 100644 --- a/crates/extra/src/debugging.rs +++ b/crates/extra/src/debugging.rs @@ -2,6 +2,8 @@ use path::math::Point; use path::PathEvent; use path::{Path, PathSlice}; +use std::{println, vec::Vec, panic}; + pub type Polygons = Vec>; pub type PolygonsRef<'a> = &'a [Vec]; @@ -105,8 +107,6 @@ pub fn find_reduced_test_case bool + panic::UnwindSafe + panic::R path } -use std::panic; - fn find_reduced_test_case_sp(mut polygons: Polygons, cb: &F) -> Polygons where F: Fn(Path) -> bool + panic::UnwindSafe + panic::RefUnwindSafe, diff --git a/crates/extra/src/lib.rs b/crates/extra/src/lib.rs index eb7f5357..f32c6635 100644 --- a/crates/extra/src/lib.rs +++ b/crates/extra/src/lib.rs @@ -2,12 +2,21 @@ #![deny(bare_trait_objects)] #![allow(dead_code)] #![allow(unused_variables)] +#![no_std] extern crate lyon_path as path; +extern crate alloc; + +#[cfg(any(test, feature = "std"))] +#[macro_use] +extern crate std; + + pub use path::geom::euclid; pub use path::math; +#[cfg(any(test, feature = "std"))] pub mod debugging; pub mod parser; pub mod rust_logo; diff --git a/crates/extra/src/parser.rs b/crates/extra/src/parser.rs index 96d16628..732550e2 100644 --- a/crates/extra/src/parser.rs +++ b/crates/extra/src/parser.rs @@ -3,10 +3,12 @@ use path::{ math::{point, vector, Angle, Point}, traits::PathBuilder, }; +use core::{mem}; -extern crate thiserror; +extern crate alloc; +use alloc::{string::String, vec::Vec}; -use self::thiserror::Error; +use thiserror::Error; #[non_exhaustive] #[derive(Error, Clone, Debug, PartialEq)] @@ -457,7 +459,7 @@ impl PathParser { match self.float_buffer.parse::() { Ok(val) => Ok(val), Err(_) => Err(ParseError::Number { - src: std::mem::take(&mut self.float_buffer), + src: mem::take(&mut self.float_buffer), line, column, }),