Pass an owned value to log's methods?
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 2.5k
- Forks
- 289
- Avg merge
- 55m
- Merged PRs (30d)
- 1
Description
Hi @KodrAus @Thomasdezeeuw,
According to the following code:
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?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/__private_api.rs at the linked lines and review the Log trait signatures for enabled and log. Trace how Record and Metadata are passed from the caller, then document the compatibility and ownership implications of changing those parameters; done means reaching a justified API decision.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend-api-design, observability
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100