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

Implement unregistering renderers #140

Merged
merged 1 commit into from
Sep 11, 2023
Merged

Conversation

wkozyra95
Copy link
Member

@wkozyra95 wkozyra95 commented Sep 8, 2023

Closes #56

Comment on lines +16 to +19
pub struct UnregisterError {
item_type: &'static str,
renderer_id: RendererId,
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub struct UnregisterError {
item_type: &'static str,
renderer_id: RendererId,
}
pub struct UnregisterItemNotFoundError {
item_type: &'static str,
renderer_id: RendererId,
}

There are a lot of other unregister errors

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to leave it like this for consistency with RegisterError.

Comment on lines +69 to +75
match self.registry.remove(id) {
Some(_) => Ok(()),
None => Err(UnregisterError {
item_type: self.registry_type.registry_item_name(),
renderer_id: id.clone(),
}),
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use .ok_or

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok_or maps None to Err, but here I need both map None to Err and Some(value) to Ok(())

@wkozyra95 wkozyra95 merged commit 290cc6f into master Sep 11, 2023
1 check passed
@wkozyra95 wkozyra95 deleted the @wkozyra95/unregister-renderers branch September 11, 2023 09:18
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.

API for unregistering inputs/outputs/transformations
2 participants