pub fn encode<W, M>(writer: &mut W, registry: &Registry<M>) -> Result<(), Error>where
    W: Write,
    M: EncodeMetric,