Skip to main content

path_offset/offset/
mod.rs

1//! Defines the `Offset` trait for path offsetting.
2//!
3//! This module provides the central `Offset` trait, which defines the contract for path offsetting algorithms.
4//! It also includes modules for different offsetting implementations, such as `cavalier_contours` and `flo_curves`.
5
6pub mod cavalier_contours;
7pub mod flo_curves;
8
9use crate::{error::Result, path::Path};
10
11/// A trait for types that can offset a path.
12///
13/// This trait provides a generic interface for path offsetting algorithms.
14/// Implementors of this trait are expected to provide an implementation for the `offset_path` method.
15pub trait Offset {
16    /// Offsets the given path.
17    ///
18    /// # Arguments
19    ///
20    /// * `path` - A reference to the `Path` to be offset.
21    ///
22    /// # Returns
23    ///
24    /// A `Result` containing the offset `Path` or an error.
25    fn offset_path(&self) -> Result<Path>;
26}