We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The current trait definition of Visit, is blocking visitors from being implemented without copying string in safe Rust, the tracing-log contains an example for it, see https://github.com/tokio-rs/tracing/blob/master/tracing-log/src/lib.rs#L525C1-L540C6
Visit
Fixing this issue, unfortunately, requires breaking change.
To make it possible to achieve the goal, the definition of the trait must ensure the visitor itself cannot outlives fields.
As the result, the lifetime of functions in Visit from tracing-core should be explicit annotated, taking record_str as example,
tracing-core
record_str
pub trait Visit { //... fn record_str(&mut self, field: &Field, value: &str); }
should be modified to
pub trait Visit<'a> { //... fn record_str<'f>(&mut self, field: &'f Field, value: &'f str) where 'f: 'a; }
Here is a snippets to prove that it should work.
https://godbolt.org/z/6s8P6Tv14
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Feature Request
Motivation
The current trait definition of
Visit
, is blocking visitors from being implemented without copying string in safe Rust, the tracing-log contains an example for it, see https://github.com/tokio-rs/tracing/blob/master/tracing-log/src/lib.rs#L525C1-L540C6Proposal
Fixing this issue, unfortunately, requires breaking change.
To make it possible to achieve the goal, the definition of the trait must ensure the visitor itself cannot outlives fields.
As the result, the lifetime of functions in
Visit
fromtracing-core
should be explicit annotated, takingrecord_str
as example,should be modified to
Here is a snippets to prove that it should work.
https://godbolt.org/z/6s8P6Tv14
The text was updated successfully, but these errors were encountered: