Skip to content
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

use ToValue as the bound for captured values #1

Merged
merged 1 commit into from
Sep 1, 2019

Conversation

KodrAus
Copy link
Contributor

@KodrAus KodrAus commented Sep 1, 2019

Hi! 👋

This PR allows any T: ToValue to be used as the value in a captured key-value pair instead of just strings. See: rust-lang/log#353 where we should also make this change.

Description

Instead of expecting a &[(&str, &str)], we can take a &[(&str, &dyn ToValue)], which still implements the Source trait. That way values like integers can also be captured, along with more complex values if they use an adapter.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

@KodrAus KodrAus mentioned this pull request Sep 1, 2019
1 task
Copy link
Owner

@yoshuawuyts yoshuawuyts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohhhhhh, this is fantastic. Thanks so much for sharing!!

@yoshuawuyts yoshuawuyts merged commit 4d1cd07 into yoshuawuyts:master Sep 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants