identifiers: Implement AsRef<[u8]> for owned ID types

This commit is contained in:
Jonas Platte 2023-03-07 11:18:14 +01:00
parent 5aa0f29935
commit 01acabe8a6
No known key found for this signature in database
GPG Key ID: AAA7A61F696C3E0C

View File

@ -276,7 +276,14 @@ fn expand_owned_id(input: &ItemStruct) -> TokenStream {
#[automatically_derived]
impl #impl_generics AsRef<str> for #owned_ty {
fn as_ref(&self) -> &str {
(*self.inner).as_ref()
self.inner.as_str()
}
}
#[automatically_derived]
impl #impl_generics AsRef<[u8]> for #owned_ty {
fn as_ref(&self) -> &[u8] {
self.inner.as_bytes()
}
}