-
Notifications
You must be signed in to change notification settings - Fork 249
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
Dynamically track the 'static-ness of record strings #344
Conversation
Logger implementations commonly need to convert a `Record` into a non-borrowed form to e.g. log it asynchronously on a separate thread. This allows them to avoid having to allocate owned `String`s for the module path and file fields, which will in practice almost always be `'static`. cc rust-lang#206
@@ -669,6 +669,22 @@ impl LevelFilter { | |||
} | |||
} | |||
|
|||
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)] |
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.
Not sure if we want equality, etc to consider staticness or not. It seems a bit weird for text to not be equal to itself depending on the lifetime, but at the same time it does affect how the Record behaves.
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.
Since this is publicly unreachable it seems ok to me. If we ever did want to expose some string-like type we could think about it then?
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.
This looks good to me!
@@ -669,6 +669,22 @@ impl LevelFilter { | |||
} | |||
} | |||
|
|||
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)] |
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.
Since this is publicly unreachable it seems ok to me. If we ever did want to expose some string-like type we could think about it then?
I'll put together another patch release, since it sounds like this could be blocking folks. |
Co-authored-by: github-actions <github-actions@github.com>
Logger implementations commonly need to convert a
Record
into anon-borrowed form to e.g. log it asynchronously on a separate thread.
This allows them to avoid having to allocate owned
String
s for themodule path and file fields, which will in practice almost always be
'static
.cc #206
r? @KodrAus