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

Cell API #11

Open
mkalte666 opened this issue Nov 8, 2022 · 2 comments
Open

Cell API #11

mkalte666 opened this issue Nov 8, 2022 · 2 comments

Comments

@mkalte666
Copy link

mkalte666 commented Nov 8, 2022

Should #10 go in, i basically have no reason to continue working on my attempt at a wrapper (which is a good thing, i don't have the time lol).

One thing i have done, which is, i think, still on the roadmap for this repo, is work out a cell API.

Here is the link: https://github.com/mkalte666/naifspice-rs/blob/main/src/naifspice/src/cell.rs
EDIT: yes i am aware of the dumb compare_some func (instead of assert_eq!(whatever.pop(), Some(what_i_expect));), though i am not sure what my brain was doing when i wrote this. woops.

If you are interested, i can instead work this into a PR for this one. I think last time i worked on it i only had some nicety functionality left to do.

It is basically a re-implementation of the whole cell struct (which is stack-allocated with macros anyway) into pure rust. Hand filling the fields for each type instead of the c macro. What i, so far, did not manage to do was implement this copy-free for strings (Because of String vs CString). However, if i didn't miss anything, these are for one time copy actions into or out of the API anyway, so this might be a ok for a first attempt anyway.

What do you think? There are two other things i have done - feature flag for the chrono crate and some more advanced error handling around the one built into spice. The former would be easy to also just PR in here, while the latter might need significant rework, but would be also really really nice.

Have a good week!

@GregoireHENRY
Copy link
Owner

Hey @mkalte666! I'm highly interested in a PR to address your issue and implement a proper wrapper for Cells. We can take inspiration on SpiceyPy for which I remember having used Cells recently and it was very convenient. Basically a Cell of integers could be iterated like a list. Looking quickly on your implementation, it looks like doing the same, which is good!

About the copying of string, it looks indeed okay for a first attempt, we can always improve that later. Maybe writing will show an issue, to me it's fine for the moment.

Let me know if you need help on this one. I'm very happy you're on that!

@GregoireHENRY
Copy link
Owner

About conversion back and forth to Chrono dates and more advanced error handling, I'm not convinced. But we can still study that. I also think this should be part of a separate issue.

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

2 participants