diff --git a/Cargo.toml b/Cargo.toml index b1c73ba..151a320 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,7 @@ tokio-rustls = "0.24" # Bellande Architecture bellande_step = "0.1.1" -bellande_limit = "0.1.1" +bellande_limit = "0.1.2" bellande_node_importance = "0.1.0" bellande_particle = "0.1.1" bellande_probability = "0.1.1" diff --git a/src/algorithm/bellande_limit.rs b/src/algorithm/bellande_limit.rs index 3441dd2..1aa944f 100644 --- a/src/algorithm/bellande_limit.rs +++ b/src/algorithm/bellande_limit.rs @@ -12,3 +12,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + +use crate::algorithm::connections::BellandeArchError; +use bellande_limit::make_bellande_limit_request; diff --git a/src/algorithm/bellande_step.rs b/src/algorithm/bellande_step.rs index e2dd2e9..de61bd6 100644 --- a/src/algorithm/bellande_step.rs +++ b/src/algorithm/bellande_step.rs @@ -13,33 +13,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +use crate::algorithm::connections::BellandeArchError; use bellande_step::make_bellande_step_request; use futures::future::join_all; use serde::{Deserialize, Serialize}; use serde_json::Value; -use std::fmt; - -/// Error types specific to this library -#[derive(Debug)] -pub enum BellandeArchError { - DimensionMismatch(String), - InvalidCoordinates(String), - AlgorithmError(String), - NetworkError(String), -} - -impl fmt::Display for BellandeArchError { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - BellandeArchError::DimensionMismatch(msg) => write!(f, "Dimension mismatch: {}", msg), - BellandeArchError::InvalidCoordinates(msg) => write!(f, "Invalid coordinates: {}", msg), - BellandeArchError::AlgorithmError(msg) => write!(f, "Algorithm error: {}", msg), - BellandeArchError::NetworkError(msg) => write!(f, "Network error: {}", msg), - } - } -} - -impl std::error::Error for BellandeArchError {} /// Configuration for spatial coordinate transformation #[derive(Debug, Clone, Serialize, Deserialize)] @@ -120,7 +98,7 @@ impl SpatialTransformer { } /// Process the raw Bellande Step result into our domain-specific format - fn process_result(result: Value) -> Result { + pub fn process_result(result: Value) -> Result { // Extract the path data from the result let path = result .get("path") @@ -227,7 +205,7 @@ impl SpatialTransformer { } /// Advanced path optimization that handles obstacles - async fn optimize_path_with_obstacles( + pub async fn optimize_path_with_obstacles( config: SpatialTransformConfig, obstacles: Vec>, ) -> Result { diff --git a/src/algorithm/connections.rs b/src/algorithm/connections.rs new file mode 100644 index 0000000..1ba515d --- /dev/null +++ b/src/algorithm/connections.rs @@ -0,0 +1,36 @@ +// Copyright (C) 2025 Bellande Architecture Mechanism Research Innovation Center, Ronaldson Bellande + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use std::fmt; + +/// Error types specific to this library +#[derive(Debug)] +pub enum BellandeArchError { + DimensionMismatch(String), + InvalidCoordinates(String), + AlgorithmError(String), + NetworkError(String), +} + +impl fmt::Display for BellandeArchError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + BellandeArchError::DimensionMismatch(msg) => write!(f, "Dimension mismatch: {}", msg), + BellandeArchError::InvalidCoordinates(msg) => write!(f, "Invalid coordinates: {}", msg), + BellandeArchError::AlgorithmError(msg) => write!(f, "Algorithm error: {}", msg), + BellandeArchError::NetworkError(msg) => write!(f, "Network error: {}", msg), + } + } +} diff --git a/src/algorithm/mod.rs b/src/algorithm/mod.rs index f8bd354..6f7d027 100644 --- a/src/algorithm/mod.rs +++ b/src/algorithm/mod.rs @@ -20,3 +20,4 @@ pub mod bellande_probability; pub mod bellande_segment; pub mod bellande_step; pub mod bellande_tree; +pub mod connections; diff --git a/src/mesh/connections.rs b/src/mesh/connections.rs new file mode 100644 index 0000000..e69de29 diff --git a/src/mesh/mod.rs b/src/mesh/mod.rs index cb3e16e..9dcb920 100644 --- a/src/mesh/mod.rs +++ b/src/mesh/mod.rs @@ -1 +1,2 @@ +pub mod connections; pub mod mesh;