Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove -rs suffix from the crate name #9

Merged
merged 1 commit into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Test
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "earcut-rs"
version = "0.3.1"
name = "earcut"
version = "0.3.4"
edition = "2021"
description = "A Rust port of the Earcut polygon triangulation library"
authors = ["Taku Fukada <naninunenor@gmail.com>", "MIERUNE Inc. <info@mierune.co.jp>"]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Test](https://github.com/MIERUNE/earcut-rs/actions/workflows/Test.yml/badge.svg)](https://github.com/MIERUNE/earcut-rs/actions/workflows/Test.yml)
[![codecov](https://codecov.io/gh/MIERUNE/earcut-rs/graph/badge.svg?token=thKlQiVjLc)](https://codecov.io/gh/MIERUNE/earcut-rs)
[![Crates.io Version](https://img.shields.io/crates/v/earcut-rs)](https://crates.io/crates/earcut-rs)
[![Crates.io Version](https://img.shields.io/crates/v/earcut)](https://crates.io/crates/earcut)

A Rust port of the [mapbox/earcut](https://github.com/mapbox/earcut) polygon triangulation library, implemented from scratch with some reference to [donbright/earcutr](https://github.com/donbright/earcutr).

Expand Down
2 changes: 1 addition & 1 deletion benches/benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::fs;

use criterion::{criterion_group, criterion_main, Criterion};

use earcut_rs::Earcut;
use earcut::Earcut;

fn load_fixture(name: &str) -> (Vec<f64>, Vec<usize>) {
// load JSON
Expand Down
2 changes: 1 addition & 1 deletion examples/example.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use earcut_rs::{deviation, Earcut};
use earcut::{deviation, Earcut};

use std::fs;

Expand Down
8 changes: 6 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! A Rust port of the [Earcut](https://github.com/mapbox/earcut) polygon triangulation library.

#![no_std]

extern crate alloc;
Expand All @@ -8,6 +10,7 @@ use alloc::vec::Vec;
use core::ptr;
use num_traits::float::Float;

/// Index of a vertex
pub trait Index: Copy {
fn into_usize(self) -> usize;
fn from_usize(v: usize) -> Self;
Expand Down Expand Up @@ -92,6 +95,7 @@ impl<T: Float> Node<T> {
}
}

/// Instance of the earcut algorithm.
pub struct Earcut<T: Float> {
data: Vec<T>,
nodes: Vec<Node<T>>,
Expand All @@ -105,9 +109,9 @@ impl<T: Float> Default for Earcut<T> {
}

impl<T: Float> Earcut<T> {
/// Creates a new instance for the earcut algorithm.
/// Creates a new instance of the earcut algorithm.
///
/// You can reuse the same instance for multiple triangulations to reduce memory allocations.
/// You can reuse a single instance for multiple triangulations to reduce memory allocations.
pub fn new() -> Self {
Self {
data: Vec::new(),
Comment on lines 109 to 117
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [98-114]

Review the use of unsafe in macros node and node_mut.

The use of unsafe in the node and node_mut macros for unchecked indexing could lead to undefined behavior if indices are out of bounds. Consider adding bounds checks or documenting the conditions under which these macros are guaranteed to be safe.

Expand Down
2 changes: 1 addition & 1 deletion tests/fixture.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use earcut_rs::{deviation, Earcut};
use earcut::{deviation, Earcut};

use std::fs;

Expand Down
2 changes: 1 addition & 1 deletion tests/simple.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use earcut_rs::{deviation, Earcut};
use earcut::{deviation, Earcut};

#[test]
fn test_empty() {
Expand Down