-
Notifications
You must be signed in to change notification settings - Fork 6
Share Kind within crate and create OrcaError from Kind
#38
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
Conversation
Synicix
left a comment
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.
Looks good
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 believe there might be a problem with the handling of the Result<T> alias?
| }; | ||
| /// Shorthand for a Result that returns an `OrcaError`. | ||
| pub type Result<T> = result::Result<T, OrcaError>; | ||
| pub(crate) type Result<T> = result::Result<T, OrcaError>; |
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.
Given we will have methods that will actually return this Result, wouldn't the unavailability of this type definition make the code uncompilable the moment those methods using Result return types are used outside of our crate? Does it act differently if this is a type alias?
| use std::{collections::BTreeMap, fs, ops::Deref, path::PathBuf, result}; | ||
| use tempfile::tempdir; | ||
|
|
||
| pub type Result<T> = result::Result<T, OrcaError>; |
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.
Given users might also want to use our alias for Result if they work a lot with OrcaError, we might as well treat it as publicly facing interface?
|
After further digging, I learned that it is not necessary for type def to be shared publicly even if used as a return type for a public method as it is just a convenience alias available within the crate (if you so choose). So the concern over the code not compiling was not well founded - sorry! That being said, should we still consider making the alias publicly available? I see it's fairly common to make it public. |
No description provided.