Skip to main content

Operation

Trait Operation 

Source
pub trait Operation<S: Scalar> {
    type Args;

    // Required method
    fn apply(
        &self,
        part: Part<S>,
        operation_id: &str,
        args: &Self::Args,
    ) -> GeopResult<Part<S>>;

    // Provided method
    fn handles(
        &self,
        before: &Part<S>,
        args: &Self::Args,
    ) -> GeopResult<Vec<Handle>> { ... }
}
Expand description

One kind of operation on a Part.

Required Associated Types§

Source

type Args

Everything the operation needs, as plain, serializable design data.

Required Methods§

Source

fn apply( &self, part: Part<S>, operation_id: &str, args: &Self::Args, ) -> GeopResult<Part<S>>

Applies the operation as the program step operation_id, consuming part and returning the part it produces. Everything the operation creates is named after operation_id (see geop_core_part), so the id has to be unique within a program.

On error no part is returned — a caller that still needs the original should clone it first.

Provided Methods§

Source

fn handles( &self, before: &Part<S>, args: &Self::Args, ) -> GeopResult<Vec<Handle>>

The step’s handles (see Handle), given the part before it — what it is applied to. None, unless the operation offers some.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§