Trait moc::qty::MocableQty

source ·
pub trait MocableQty: 'static + PartialEq + Eq + Send + Sync + Clone + Debug {
    const NAME: &'static str;
    const PREFIX: char;
    const DIM: u8;
    const N_D0_CELLS: u8;
    const MOC_DIM: MocDim;
    const HAS_COOSYS: bool;
    const HAS_TIMESYS: bool;
    const HAS_FREQSYS: bool;
    const N_RESERVED_BITS: u8 = 2u8;
    const N_D0_BITS: u8 = _;
    const LEVEL_MASK: u8 = _;

    // Required methods
    fn mult_by_dim<T: Idx>(v: T) -> T;
    fn div_by_dim<T: Idx>(v: T) -> T;

    // Provided method
    fn shift(delta_depth: u8) -> u8 { ... }
}
Expand description

Generic constants defining a quantity that can be put in a MOC, independently of it the precise integer type used to represent it.

Required Associated Constants§

source

const NAME: &'static str

A simple str to identify the quantity (e.g. in ASCII serialisation)

source

const PREFIX: char

A simple char prefix to identify the quantity (e.g. in ASCII serialisation)

source

const DIM: u8

Dimension of the qty, i.e. number of bits needed to code a sub-cell relative index

source

const N_D0_CELLS: u8

Number of base cells, i.e. number of cell at depth 0 (usually 2^dim, but 12 in the HEALPix case)

source

const MOC_DIM: MocDim

FITS keyword

source

const HAS_COOSYS: bool

For FITS serialization (TODO: find a better approach)

source

const HAS_TIMESYS: bool

For FITS serialization (TODO: find a better approach)

source

const HAS_FREQSYS: bool

For FITS serialization (TODO: find a better approach)

Provided Associated Constants§

source

const N_RESERVED_BITS: u8 = 2u8

Number of bits reserved to code the quantity type

source

const N_D0_BITS: u8 = _

Number of bits needed to code the base cell index

source

const LEVEL_MASK: u8 = _

Mask to select the bit(s) of a level > 0:

  • dim 1: 001
  • dim 2: 011
  • dim 3: 111

Required Methods§

source

fn mult_by_dim<T: Idx>(v: T) -> T

v * Self::DIM, generic so that for:

  • DIM=1 this is a no operation,
  • DIM=2 we can use v << 1
source

fn div_by_dim<T: Idx>(v: T) -> T

v / Self::DIM, generic so that for:

  • DIM=1 this is a no operation,
  • DIM=2 we can use v >> 1

Provided Methods§

source

fn shift(delta_depth: u8) -> u8

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T: Idx> MocableQty for Frequency<T>

source§

const N_RESERVED_BITS: u8 = 4u8

source§

const NAME: &'static str = "FREQUENCY"

source§

const PREFIX: char = 'f'

source§

const DIM: u8 = 1u8

source§

const N_D0_CELLS: u8 = 2u8

source§

const MOC_DIM: MocDim = MocDim::Frequency

source§

const HAS_COOSYS: bool = false

source§

const HAS_TIMESYS: bool = false

source§

const HAS_FREQSYS: bool = true

source§

impl<T: Idx> MocableQty for Hpx<T>

source§

const NAME: &'static str = "HPX"

source§

const PREFIX: char = 's'

source§

const DIM: u8 = 2u8

source§

const N_D0_CELLS: u8 = 12u8

source§

const MOC_DIM: MocDim = MocDim::Space

source§

const HAS_COOSYS: bool = true

source§

const HAS_TIMESYS: bool = false

source§

const HAS_FREQSYS: bool = false

source§

impl<T: Idx> MocableQty for Time<T>

source§

const NAME: &'static str = "TIME"

source§

const PREFIX: char = 't'

source§

const DIM: u8 = 1u8

source§

const N_D0_CELLS: u8 = 2u8

source§

const MOC_DIM: MocDim = MocDim::Time

source§

const HAS_COOSYS: bool = false

source§

const HAS_TIMESYS: bool = true

source§

const HAS_FREQSYS: bool = false