Skip to content

Commit

Permalink
Do not implement both Borrow<str> and Borrow<[u8]> for owned types.
Browse files Browse the repository at this point in the history
  • Loading branch information
timothee-haudebourg committed Feb 27, 2024
1 parent fb7e811 commit 45e80e5
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -839,12 +839,6 @@ fn generate_typed<T: Token>(

let borrow_bytes = T::rust_inner_as_bytes_method().map(|as_bytes| {
quote! {
impl ::core::borrow::Borrow<[u8]> for #buffer_ident {
fn borrow(&self) -> &[u8] {
self.0.#as_bytes()
}
}

impl ::core::convert::AsRef<[u8]> for #buffer_ident {
fn as_ref(&self) -> &[u8] {
self.0.#as_bytes()
Expand All @@ -855,12 +849,6 @@ fn generate_typed<T: Token>(

let borrow_ascii = T::rust_inner_as_ascii_method_body().map(|as_ascii| {
quote! {
impl ::core::borrow::Borrow<str> for #buffer_ident {
fn borrow(&self) -> &str {
#as_ascii
}
}

impl ::core::convert::AsRef<str> for #buffer_ident {
fn as_ref(&self) -> &str {
#as_ascii
Expand Down

0 comments on commit 45e80e5

Please sign in to comment.