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

feat(encoding)!: 🧁 encoding traits do not consume encoders #240

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

cratelyn
Copy link

@cratelyn cratelyn commented Nov 18, 2024

fixes #135.

this branch updates parameter types for different encoding traits: EncodeLabel, EncodeLabelSet, EncodeMetric, Collector, and EncodeExemplarValue. rather than taking ownership of their respective encoder parameters, these now accept a &mut mutable reference.

this allows for consumers of this API to e.g. compose label sets, loosens restrictions on field order in #[derive(EncodeLabelSet)] structs, and provides a consistent signature type by following the pattern already set by EncodeLabelKey, EncodeLabelValue, EncodeGaugeValue, and other existing encoding traits.

@cratelyn
Copy link
Author

i've refrained from bumping the Cargo.toml version in the name of offering a minimal patch, but i'm happy to bump that and add an entry to CHANGELOG.md if that's helpful. 🙂

@cratelyn cratelyn marked this pull request as ready for review November 18, 2024 16:38
@cratelyn
Copy link
Author

i've also updated the benches, examples, and doctests so this should be ready for review now. 🔨

see prometheus#135.

this adjusts the parameter of `encode()` so that it only mutably borrows
the encoder.

Signed-off-by: katelyn martin <[email protected]>
see prometheus#135.

this adjusts the parameter of `encode()` so that it only mutably borrows
the encoder.

Signed-off-by: katelyn martin <[email protected]>
see prometheus#135.

this adjusts the parameter of `encode()` so that it only mutably borrows
the encoder.

Signed-off-by: katelyn martin <[email protected]>
see prometheus#135.

this adjusts the parameter of `encode()` so that it only mutably borrows
the encoder.

Signed-off-by: katelyn martin <[email protected]>
…eEncoder`

see prometheus#135.

this adjusts the parameter of `encode()` so that it only mutably borrows
the encoder.

Signed-off-by: katelyn martin <[email protected]>
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.

Allow flattening of a struct through derive(EncodeLabelSet) at any position
1 participant