You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pubtraitPositioned{fnchrom(&self) -> &str;fnstart(&self) -> u64;fnstop(&self) -> u64;// extract a value from the Positioned object Fieldfnvalue(&self,f:Field) -> Result<Value,FieldError>;}/// Value can be any number of Ints, Floats, or Strings.pubenumValue{Ints(Vec<i64>),Floats(Vec<f64>),Strings(Vec<String>),}
This Field type is a runtime polymorphism, which is not very desired for performance considerations. Actually you can make a faster version of the trait (and also more generic) with the following def.
pubtraitPositioned<FieldType:Field>{fnchrom(&self) -> &str;fnstart(&self) -> u64;fnstop(&self) -> u64;// extract a value from the Positioned object Fieldfnvalue(&self) -> Result<FieldType::Output,FieldError>;}traitField{constNAME:&'static str;typeOutput;}
Thanks Hao! I'm very glad to have your feedback! This is definitely at the bounds of my understanding.
With this setup, any Field would have to be known at compile time, right? I would like to support more dynamic field access as well.
How would this work with python bindings where I'd want the user to be able to choose arbitrary fields, like "INFO.AF" ?
I think that perhaps, the value method in the Positioned trait is not needed now that we have the Position enum. Instead of relying on value calls, we can instead discover the concrete type from the enum and then choose the appropriate means of getting information out.
This
Field
type is a runtime polymorphism, which is not very desired for performance considerations. Actually you can make a faster version of the trait (and also more generic) with the following def.And then you may have things like
The text was updated successfully, but these errors were encountered: