Skip to main content

ReferenceCenter

Trait ReferenceCenter 

Source
pub trait ReferenceCenter:
    Copy
    + Clone
    + Debug {
    type Params: Clone + Debug + Default + PartialEq;

    // Required method
    fn center_name() -> &'static str;
}
Expand description

A trait for defining a reference center (coordinate origin).

§Associated Types

  • Params: Runtime parameters for this center. Use () for centers that don’t need parameters. For parameterized centers, this carries the required data.

§Implementing

use affn::centers::ReferenceCenter;

#[derive(Debug, Copy, Clone)]
pub struct MyCenter;

impl ReferenceCenter for MyCenter {
    type Params = ();
    fn center_name() -> &'static str {
        "MyCenter"
    }
}

Required Associated Types§

Source

type Params: Clone + Debug + Default + PartialEq

Runtime parameters for this center. Use () for centers that don’t need parameters.

Required Methods§

Source

fn center_name() -> &'static str

Returns the canonical name of this reference center.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl ReferenceCenter for ()

Source§

type Params = ()

Source§

fn center_name() -> &'static str

Implementors§