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

Add an API to get and remove prefixes registered directly on an element #73

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

danieldulaney
Copy link
Contributor

@danieldulaney danieldulaney commented Jun 1, 2019

This PR is the beginning of a resolution of #72. It adds an API to fetch the namespace registrations for a single element and an API to remove a namespace registration from a single element.

This API is different from other similar APIs because it returns an impl Iterator rather than a Vec. I like this method because it lets the consumer decide whether or not the iterator needs to be collected, but it is a different approach. I'm very open to modifying registered_namespaces to return a Vec instead (which would be an easy change).

Also, this required a remove_entry method on LazyHashMap, a thin wrapper over the underlying HashMap.

Future work:

  • Integrate this into the writer module

Daniel Dulaney added 5 commits June 1, 2019 13:26
- New Element::registered_namespaces method
- New failing tests
- Changed the API to return an impl Iterator (allows the consumer to
iterate efficiently or convert to a Vec at their option)
- Changed the tests from the previous commit to match the new API
- Added an implementation in raw::Connections
Just a thin wrapper over std's HashMap::remove_entry
- Added a new raw::Storage::element_unregister_prefix private method
@danieldulaney danieldulaney changed the title Add an API to get prefixes registered directly on an element Add an API to get and remove prefixes registered directly on an element Jun 1, 2019
@danieldulaney
Copy link
Contributor Author

One question: Is there any way to remove strings from the StringPool? It looks like right now any string that is completely unused is leaked, though I don't see an easy way to fix it. I don't think it's a huge issue, but it's worth noting.

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

Successfully merging this pull request may close these issues.

1 participant