Trait moc::qty::MocableQty [−][src]
pub trait MocableQty: PartialEq + Eq + Send + Sync + Clone + Debug {
const NAME: &'static str;
const PREFIX: char;
const DIM: u8;
const N_D0_CELLS: u8;
const N_D0_BITS: u8;
const LEVEL_MASK: u8;
const MOC_DIM: MocDim;
const HAS_COOSYS: bool;
const HAS_TIMESYS: bool;
fn mult_by_dim<T: Idx>(v: T) -> T;
fn div_by_dim<T: Idx>(v: T) -> T;
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.
Associated Constants
Dimension of the qty, i.e. number of bits needed to code a sub-cell relative index
const N_D0_CELLS: u8
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)
const LEVEL_MASK: u8
const LEVEL_MASK: u8
Mask to select the bit(s) of a level > 0:
- dim 1: 001
- dim 2: 011
- dim 3: 111
const HAS_COOSYS: bool
const HAS_COOSYS: bool
For FITS serialization (TODO: find a better approach)
const HAS_TIMESYS: bool
const HAS_TIMESYS: bool
For FITS serialization (TODO: find a better approach)
Required methods
fn mult_by_dim<T: Idx>(v: T) -> T
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 usev << 1
fn div_by_dim<T: Idx>(v: T) -> T
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 usev >> 1