Closed zaeleus closed 11 months ago
How do we avoid the .parse().unwrap() on? I'd like to have the whole expression be constant. data.insert( "x1".parse().unwrap(), noodles::sam::record::data::field::Value::from(value), );
How do we avoid the .parse().unwrap() on? I'd like to have the whole expression be constant.
.parse().unwrap()
data.insert( "x1".parse().unwrap(), noodles::sam::record::data::field::Value::from(value), );
Originally posted by @nh13 in https://github.com/zaeleus/noodles/issues/197#issuecomment-1724912818
sam::record::data::field::Tag should have a const fn initializer to use in const contexts, e.g.,
sam::record::data::field::Tag
const fn
const X1: Tag = match Tag::new([b'X', b'1']) { Some(tag) => tag, None => unreachable!(), }; data.insert(X1, Value::from(0));
Thank you! Wow!
This is now available in noodles 0.52.0 / noodles-sam 0.43.0.
Originally posted by @nh13 in https://github.com/zaeleus/noodles/issues/197#issuecomment-1724912818
sam::record::data::field::Tag
should have aconst fn
initializer to use in const contexts, e.g.,