Skip to main content

Algorithm

Trait Algorithm 

Source
pub trait Algorithm {
    type Input;
    type Output;
    type Params: Default;
    type Error: Error;

    // Required methods
    fn name(&self) -> &'static str;
    fn description(&self) -> &'static str;
    fn execute(
        &self,
        input: Self::Input,
        params: Self::Params,
    ) -> Result<Self::Output, Self::Error>;

    // Provided method
    fn execute_default(
        &self,
        input: Self::Input,
    ) -> Result<Self::Output, Self::Error> { ... }
}
Expand description

Core trait for all algorithms in SurtGis.

Algorithms are pure functions that transform input data according to parameters.

Required Associated Types§

Source

type Input

Input type for the algorithm

Source

type Output

Output type for the algorithm

Source

type Params: Default

Parameters controlling algorithm behavior

Source

type Error: Error

Error type for algorithm execution

Required Methods§

Source

fn name(&self) -> &'static str

Returns the algorithm name

Source

fn description(&self) -> &'static str

Returns a description of what the algorithm does

Source

fn execute( &self, input: Self::Input, params: Self::Params, ) -> Result<Self::Output, Self::Error>

Execute the algorithm

Provided Methods§

Source

fn execute_default( &self, input: Self::Input, ) -> Result<Self::Output, Self::Error>

Execute with default parameters

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§