mesh-sieve 4.0.2

Modular, high-performance Rust library for mesh and data management, designed for scientific computing and PDE codes.
Documentation
use super::sieve_trait::Sieve;

/// Bulk arrow insertion helpers for [`Sieve`] implementations.
///
/// These methods allow inserting many edges in one pass while
/// pre-reserving capacities and invalidating caches only once.
pub trait SieveBuildExt: Sieve {
    /// Fallible strict bulk insertion. Exact duplicates are no-ops and any
    /// payload conflict is returned instead of being overwritten.
    fn try_add_arrows_from<I>(&mut self, edges: I) -> Result<(), crate::mesh_error::MeshSieveError>
    where
        I: IntoIterator<Item = (Self::Point, Self::Point, Self::Payload)>,
    {
        for (src, dst, payload) in edges {
            self.add_arrow(src, dst, payload)?;
        }
        Ok(())
    }

    /// Fallible strict bulk insertion preserving input order and duplicate
    /// identity semantics.
    fn try_add_arrows_dedup_from<I>(
        &mut self,
        edges: I,
    ) -> Result<(), crate::mesh_error::MeshSieveError>
    where
        I: IntoIterator<Item = (Self::Point, Self::Point, Self::Payload)>,
    {
        self.try_add_arrows_from(edges)
    }

    /// Insert many arrows at once.
    ///
    /// For repeated `(src,dst)` pairs the last payload wins.
    fn add_arrows_from<I>(&mut self, edges: I)
    where
        I: IntoIterator<Item = (Self::Point, Self::Point, Self::Payload)>;

    /// Insert many arrows, deduplicating identical `(src,dst)` pairs prior to
    /// insertion. If duplicates are present in the input, the last payload wins.
    fn add_arrows_dedup_from<I>(&mut self, edges: I)
    where
        I: IntoIterator<Item = (Self::Point, Self::Point, Self::Payload)>;
}