-
Notifications
You must be signed in to change notification settings - Fork 15
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
Removed unsafe
#20
Removed unsafe
#20
Conversation
how does this impact performance? Does it slow it down or speed it up? |
It seems to be the same, but there should be an overhead when getting the lock |
and when does that happen? |
when calling |
okay, I guess it's fine, I have 2 more questions:
|
|
|
pub const fn expect(self, msg: &str) -> T {
match self {
Some(val) => val,
None => expect_failed(msg),
}
} Either we do this in the code or call it through
|
I guess we can keep .expect() then
yeah |
Closing to make the pr in the other branch |
This pr resolves #15.
A lot of things needed to change but for the better.
First of all, I needed to add the
lazy_static
dependency, I used it to instantiate and hold all the data.Then, I implemented a
struct
containing all the data and getters for it, that struct has even a convenient function for adding things to the output code.I wrapped that struct inside a
RwLock
, if in the future the need arises (the other option wasMutex
).I created
lib.rs
that containsmod
s andmacro
s and removed thearg
macro as it is useless at this point (there's no more need forunsafe
)I added a configuration file for
clippy
because it was angry thatEnvData::set_data
had 10 arguments, 3 more of the max he tolerated.