walkerlab / orcapod

MIT License
2 stars 3 forks source link

OrcaHash trait #17

Closed eywalker closed 1 month ago

eywalker commented 1 month ago
trait OrcaHash {
  fn to_yaml(&self) -> String,
  fn from_yaml(yaml: &str, annotation: &str) -> Self,
  fn compute_hash(&self) -> String {//provide default implementation}
}
Synicix commented 1 month ago

Need to add this to the current pull #6

Synicix commented 1 month ago

Okay the down side with this result is that the from_yaml func has to be in this format

from_yaml(hash& str, yaml: &str, annotation: &str) -> Result<Self, String> where Self: Sized

Which is a bit of a ugly signature and it mainly only use by the Filestore, as other storage solution, like a database for example would, it wouldn't use the from_yaml as it will read the directly from the tables and create the structs.