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§
sourceconst DIM: u8
const DIM: u8
Dimension of the qty, i.e. number of bits needed to code a sub-cell relative index
sourceconst 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)
sourceconst HAS_COOSYS: bool
const HAS_COOSYS: bool
For FITS serialization (TODO: find a better approach)
sourceconst HAS_TIMESYS: bool
const HAS_TIMESYS: bool
For FITS serialization (TODO: find a better approach)
sourceconst HAS_FREQSYS: bool
const HAS_FREQSYS: bool
For FITS serialization (TODO: find a better approach)
Provided Associated Constants§
sourceconst N_RESERVED_BITS: u8 = 2u8
const N_RESERVED_BITS: u8 = 2u8
Number of bits reserved to code the quantity type
sourceconst 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
Required Methods§
sourcefn 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
sourcefn 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
Provided Methods§
Object Safety§
This trait is not object safe.