-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A way to use VersionOf and AnyVersion given reference to a struct #10
Comments
I'm not sure I understand. Could you explain a little more? Maybe provide some code you'd like to work that doesn't? |
My original problem is to detect the fact that configuration file need to be updated. In order to do that I need to visit each node of the tree and collect versions of the struct involved. It has been a challenge because obake doesn't support types with generics which means container types are not working Here is some code showing the configuration structure
I wanted to write a helper function for each struct which would return the greatest version
The code above fails
pub fn vsn(&self) -> Version {
// p in map function bellow has type &Profile_v0_0_1
let profiles_vsn = self.profiles.first().map(|p|{
let v: obake::AnyVersion<Profile> = p.into();
Version::parse(v.version_str)
});
} The above fails with
The above fails
As you can see there is no easy way to get the version. The following works
|
Currently it doesn't seem to be possible to determine current version of a struct given a reference to a struct (clone() is not an option for the struct I have).
The text was updated successfully, but these errors were encountered: