log
log copied to clipboard
Pass an owned value to log's methods?
Hi @KodrAus @Thomasdezeeuw,
According to the following code:
https://github.com/rust-lang/log/blob/6e1735597bb21c5d979a077395df85e1d633e077/src/__private_api.rs#L81
https://github.com/rust-lang/log/blob/6e1735597bb21c5d979a077395df85e1d633e077/src/__private_api.rs#L103-L105
Given that Record<'a> and Metadata<'a> already conatins all refs in their fields, and we have an owned value at the caller side, I'd like to know why we pass a ref &Record and &Metadata instead of Record<'a> and Metadata<'a>, to the log and enabled method.
I mean, is it possible to change (despite it's a breaking change, just think of it technically):
pub trait Log: Sync + Send {
fn enabled(&self, metadata: &Metadata) -> bool;
fn log(&self, record: &Record);
fn flush(&self);
}
into
pub trait Log: Sync + Send {
fn enabled(&self, metadata: Metadata<'_>) -> bool;
fn log(&self, record: Record<'_>);
fn flush(&self);
}
Any downside?