Skip to content

Conversation

@npmccallum
Copy link
Contributor

Redesigned the extension trait interface to support more flexible ownership patterns and use cases. The trait is renamed from AsExtension to ToExtension and now consumes values by default, with implementations for references and tuples like (OID, bool, &T) to allow direct control over criticality and OID. This makes the API more ergonomic for common scenarios while enabling advanced use cases that weren't previously possible.

BREAKING CHANGE: The AsExtension trait has been renamed to ToExtension, and to_extension now takes self by value. Users must update trait bounds from AsExtension to ToExtension and may need to adjust how extensions are passed to add_extension methods.

@npmccallum
Copy link
Contributor Author

@tarcieri This resolves your complaint about the interface being named AsExtension.

@npmccallum
Copy link
Contributor Author

I don't think my code is the cause of the test breakage. It looks like cargo-hack installation is failing.

Redesigned the extension trait interface to support more flexible
ownership patterns and use cases. The trait is renamed from
AsExtension to ToExtension and now consumes values by default, with
implementations for references and tuples like (OID, bool, &T) to
allow direct control over criticality and OID. This makes the API
more ergonomic for common scenarios while enabling advanced use cases
that weren't previously possible.

BREAKING CHANGE: The AsExtension trait has been renamed to
ToExtension, and to_extension now takes self by value. Users must
update trait bounds from AsExtension to ToExtension and may need to
adjust how extensions are passed to add_extension methods.
@npmccallum
Copy link
Contributor Author

Tests all pass after the transient test breakage has resolved.

Comment on lines +106 to +112
pub trait ToExtension {
/// The error type returned when encoding the extension.
type Error;

/// Returns the Extension with the content encoded.
fn to_extension(
&self,
self,
Copy link
Member

Choose a reason for hiding this comment

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

As it were, the convention for methods that consume self is into_*:

https://rust-lang.github.io/api-guidelines/naming.html#ad-hoc-conversions-follow-as_-to_-into_-conventions-c-conv

So how about IntoExtension::into_extension?

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.

3 participants