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

Simplify definitions and impls of Vertex-containing types #314

Merged
merged 1 commit into from
Jun 12, 2023

Conversation

nvzqz
Copy link
Contributor

@nvzqz nvzqz commented Jun 12, 2023

By not requiring so many bounds on Vertex at type definition time, it becomes easier to modify this code.

By not requiring so many bounds on `Vertex` at type definition time, it
becomes easier to modify this code.
@obi1kenobi obi1kenobi merged commit 7b36bfa into obi1kenobi:main Jun 12, 2023
16 checks passed
@nvzqz nvzqz deleted the pr/simplify-vertex-structs branch June 12, 2023 16:47
@obi1kenobi
Copy link
Owner

Thanks! Although I am worried about worse compile errors now that it's possible for someone to pass a Vertex that is not Debug or Clone, and for some impls to not be available on DataContext as a result.

@nvzqz
Copy link
Contributor Author

nvzqz commented Jun 12, 2023

I kept the trait bounds on DataContext::new, so that shouldn't be an issue 🙂

impl<Vertex: Clone + Debug> DataContext<Vertex> {
pub fn new(vertex: Option<Vertex>) -> DataContext<Vertex> {
DataContext {
active_vertex: vertex,
piggyback: None,
vertices: Default::default(),
values: Default::default(),
suspended_vertices: Default::default(),
folded_contexts: Default::default(),
folded_values: Default::default(),
imported_tags: Default::default(),
}
}

@obi1kenobi
Copy link
Owner

Nice!

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.

None yet

2 participants