-
Notifications
You must be signed in to change notification settings - Fork 14
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
Conversation
pub struct UnregisterError { | ||
item_type: &'static str, | ||
renderer_id: RendererId, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
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.
match self.registry.remove(id) { | ||
Some(_) => Ok(()), | ||
None => Err(UnregisterError { | ||
item_type: self.registry_type.registry_item_name(), | ||
renderer_id: id.clone(), | ||
}), | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use .ok_or
There was a problem hiding this comment.
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(())
Closes #56