Skip to content

Commit 390a069

Browse files
committed
Fix compilation with feature bytes
1 parent f9875d9 commit 390a069

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

protobuf/src/chars.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use std::str;
77
use bytes::Bytes;
88

99
use crate::clear::Clear;
10+
use std::borrow::Borrow;
1011

1112
/// Thin wrapper around `Bytes` which guarantees that bytes are valid UTF-8 string.
1213
/// Should be API-compatible to `String`.
@@ -71,6 +72,12 @@ impl Deref for Chars {
7172
}
7273
}
7374

75+
impl Borrow<str> for Chars {
76+
fn borrow(&self) -> &str {
77+
&*self
78+
}
79+
}
80+
7481
impl Clear for Chars {
7582
fn clear(&mut self) {
7683
self.0.clear();

protobuf/src/reflect/dynamic/map.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
use crate::reflect::map::ReflectMapIter;
21
use crate::reflect::map::ReflectMap;
2+
use crate::reflect::map::ReflectMapIter;
33
use crate::reflect::map::ReflectMapIterTrait;
44
use crate::reflect::runtime_types::RuntimeType;
5-
use crate::reflect::ReflectValueRef;
6-
use crate::reflect::RuntimeTypeBox;
75
use crate::reflect::ProtobufValue;
86
use crate::reflect::ReflectValueBox;
7+
use crate::reflect::ReflectValueRef;
8+
use crate::reflect::RuntimeTypeBox;
99
use std::collections::hash_map;
1010
use std::collections::HashMap;
1111
use std::hash::Hash;

protobuf/src/reflect/runtime_types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ impl RuntimeTypeWithDeref for RuntimeTypeCarllercheChars {
672672
}
673673
#[cfg(feature = "bytes")]
674674
impl RuntimeTypeHashable for RuntimeTypeCarllercheChars {
675-
fn hash_map_get<'a, V>(map: &'a HashMap<String, V>, key: ReflectValueRef) -> Option<&'a V> {
675+
fn hash_map_get<'a, V>(map: &'a HashMap<Chars, V>, key: ReflectValueRef) -> Option<&'a V> {
676676
match key {
677677
ReflectValueRef::String(s) => map.get(&*s),
678678
_ => None,

0 commit comments

Comments
 (0)