Skip to content
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

Support for DSTs? #225

Open
Berrysoft opened this issue Jan 13, 2023 · 6 comments
Open

Support for DSTs? #225

Berrysoft opened this issue Jan 13, 2023 · 6 comments

Comments

@Berrysoft
Copy link
Contributor

I recently need to write some DST (dynamically sized type) data to HDF5. The size of a DST struct is dynamically known, and also fixed because once determined, it won't change anymore. However, I know that DST in rust is not that easy to use, and I don't ask for many changes.

I would just suggest that changing H5Type::type_descriptor() to H5Type::type_descriptor(&self). As the size of a DST struct is dynamically known, we can get the size with &self, and therefore can construct an instance of TypeDescriptor.

Although this is a small suggestion, it may require a lot changes (I haven't tried). Would you consider such change? If you like it, I'd like to open a PR and try to implement it.

@mulimoen
Copy link
Collaborator

I have a gut feeling this would be a major change, but you should prototype this to find out. Could be some other approach to dynamic types would be preferable instead of trying to fit this into the existing API

@Berrysoft
Copy link
Contributor Author

DST cannot impl H5Type now because it is !Sized, and all generic APIs need the type implement H5Type. Another approach is to provide some unsafe APIs enable users passing TypeDescriptor and raw pointer (DST reference is fat pointer) themselves.

@Berrysoft
Copy link
Contributor Author

I'm working on extending the APIs: https://github.com/Berrysoft/hdf5-ext/tree/master/hdf5-dst

@watsaig
Copy link
Contributor

watsaig commented Feb 9, 2024

@Berrysoft I know this issue is a little dated, but I was wondering how well your approach worked? This feature would be very useful for me, and I might be able to contribute some time to it if any more work is needed to integrate it.

@Berrysoft
Copy link
Contributor Author

@watsaig You can try the repo (hdf5-ext) I linked above. I use it in production:)

However I forgot to publish them, and the docs are not complete. Will publish them ASAP. If you would like my approach, we can discuss in my repo:)

@watsaig
Copy link
Contributor

watsaig commented Feb 9, 2024

Great to hear, and thanks for the quick reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants