Skip to content

Commit

Permalink
refactor: moves code from types crate to root
Browse files Browse the repository at this point in the history
docs: adds documentation for more Manifold functions
  • Loading branch information
NickUfer committed Nov 26, 2024
1 parent fa322ef commit 63b1d34
Show file tree
Hide file tree
Showing 25 changed files with 791 additions and 148 deletions.
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ include = [
crate-type = ["cdylib", "rlib", "staticlib"]

[dependencies]
manifold3d-types = { path = "crates/types", version = "0.0.1" }
manifold3d-macros = { path = "crates/macros", version = "0.0.1" }
manifold3d-sys = { version = "0.0.3" }
thiserror = "2.0.3"
num-traits = "0.2.19"
nalgebra = { version = "0.33.2", optional = true }

[features]
nalgebra_interop = ["manifold3d-types/nalgebra_interop"]
nalgebra_interop = ["dep:nalgebra"]
export = ["manifold3d-sys/export"]
parallel = ["manifold3d-sys/parallel"]

[workspace]
members = [
"crates/macros",
"crates/types"
"crates/macros"
]
8 changes: 4 additions & 4 deletions crates/macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub fn manifold_warp(_attr: TokenStream, input: TokenStream) -> TokenStream {
#structt

const _: () = {
use manifold3d::types::manifold::vertex::WarpVertex;
use manifold3d::manifold::WarpVertex;

#[no_mangle]
#[doc(hidden)]
Expand All @@ -42,12 +42,12 @@ pub fn manifold_warp(_attr: TokenStream, input: TokenStream) -> TokenStream {
ctx: *mut ::std::os::raw::c_void
) -> manifold3d::sys::ManifoldVec3 {
let warp = &*(ctx as *mut #struct_ident);
let result = warp.warp_vertex(manifold3d::types::math::Point3::new(x, y, z));
let result = warp.warp_vertex(manifold3d::types::Point3::new(x, y, z));
result.into()
}

#[automatically_derived]
impl manifold3d::types::manifold::vertex::ExternCWarpFn for #struct_ident {
impl manifold3d::manifold::ExternCWarpFn for #struct_ident {
fn extern_c_warp_fn(&self) -> unsafe extern "C" fn(
f64,
f64,
Expand All @@ -60,7 +60,7 @@ pub fn manifold_warp(_attr: TokenStream, input: TokenStream) -> TokenStream {
};

#[automatically_derived]
impl manifold3d::types::manifold::vertex::Warp for #struct_ident {}
impl manifold3d::manifold::Warp for #struct_ident {}
);
output.into()
}
18 changes: 0 additions & 18 deletions crates/types/Cargo.toml

This file was deleted.

1 change: 0 additions & 1 deletion crates/types/LICENSE

This file was deleted.

2 changes: 0 additions & 2 deletions crates/types/src/lib.rs

This file was deleted.

1 change: 0 additions & 1 deletion crates/types/src/manifold/mod.rs

This file was deleted.

19 changes: 0 additions & 19 deletions crates/types/src/manifold/vertex.rs

This file was deleted.

Empty file.
2 changes: 1 addition & 1 deletion src/bounding_box.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::types::math::{Matrix4x3, Point3, Vec3};
use crate::types::{Matrix4x3, Point3, Vec3};
use manifold3d_sys::{
manifold_alloc_box, manifold_box, manifold_box_center, manifold_box_contains_box,
manifold_box_contains_pt, manifold_box_dimensions, manifold_box_does_overlap_box,
Expand Down
5 changes: 4 additions & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ mod tests {
#[test]
fn test_error_from_u32() {
// Checks whether the error discrimination works at all
assert_eq!(crate::Error::from(manifold3d_sys::ManifoldError_MANIFOLD_NO_ERROR), crate::Error::NoError);
assert_eq!(
crate::Error::from(manifold3d_sys::ManifoldError_MANIFOLD_NO_ERROR),
crate::Error::NoError
);
assert_eq!(
crate::Error::from(manifold3d_sys::ManifoldError_MANIFOLD_NON_FINITE_VERTEX),
crate::Error::NonFiniteVertex
Expand Down
9 changes: 6 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@

mod bounding_box;
mod error;
mod manifold;
mod mesh_gl;
mod polygons;
mod quality;
mod simple_polygon;

pub mod manifold;
pub mod types;

pub use bounding_box::*;
pub use error::*;
pub use manifold::*;
pub use manifold::Manifold;
#[doc(inline)]
pub use manifold3d_macros as macros;
#[doc(inline)]
pub use manifold3d_sys as sys;
pub use manifold3d_types as types;
pub use mesh_gl::*;
pub use polygons::*;
pub use quality::*;
Expand Down
Loading

0 comments on commit 63b1d34

Please sign in to comment.