Upgrade rust/crates/protobuf to 2.18.1
Test: make
Change-Id: I5b915568dd8c388d36820424b8c7986dfd33af3b
diff --git a/src/reflect/map.rs b/src/reflect/map.rs
index 9f03123..c6aff60 100644
--- a/src/reflect/map.rs
+++ b/src/reflect/map.rs
@@ -26,7 +26,7 @@
}
trait ReflectMapIterTrait<'a> {
- fn next(&mut self) -> Option<(&'a ProtobufValue, &'a ProtobufValue)>;
+ fn next(&mut self) -> Option<(&'a dyn ProtobufValue, &'a dyn ProtobufValue)>;
}
struct ReflectMapIterImpl<'a, K: Eq + Hash + 'static, V: 'static> {
@@ -36,29 +36,29 @@
impl<'a, K: ProtobufValue + Eq + Hash + 'static, V: ProtobufValue + 'static> ReflectMapIterTrait<'a>
for ReflectMapIterImpl<'a, K, V>
{
- fn next(&mut self) -> Option<(&'a ProtobufValue, &'a ProtobufValue)> {
+ fn next(&mut self) -> Option<(&'a dyn ProtobufValue, &'a dyn ProtobufValue)> {
match self.iter.next() {
- Some((k, v)) => Some((k as &ProtobufValue, v as &ProtobufValue)),
+ Some((k, v)) => Some((k as &dyn ProtobufValue, v as &dyn ProtobufValue)),
None => None,
}
}
}
pub struct ReflectMapIter<'a> {
- imp: Box<ReflectMapIterTrait<'a> + 'a>,
+ imp: Box<dyn ReflectMapIterTrait<'a> + 'a>,
}
impl<'a> Iterator for ReflectMapIter<'a> {
- type Item = (&'a ProtobufValue, &'a ProtobufValue);
+ type Item = (&'a dyn ProtobufValue, &'a dyn ProtobufValue);
- fn next(&mut self) -> Option<(&'a ProtobufValue, &'a ProtobufValue)> {
+ fn next(&mut self) -> Option<(&'a dyn ProtobufValue, &'a dyn ProtobufValue)> {
self.imp.next()
}
}
-impl<'a> IntoIterator for &'a ReflectMap {
+impl<'a> IntoIterator for &'a dyn ReflectMap {
type IntoIter = ReflectMapIter<'a>;
- type Item = (&'a ProtobufValue, &'a ProtobufValue);
+ type Item = (&'a dyn ProtobufValue, &'a dyn ProtobufValue);
fn into_iter(self) -> Self::IntoIter {
self.reflect_iter()
diff --git a/src/reflect/optional.rs b/src/reflect/optional.rs
index ba6cbaf..f81f973 100644
--- a/src/reflect/optional.rs
+++ b/src/reflect/optional.rs
@@ -5,17 +5,17 @@
use crate::singular::*;
pub trait ReflectOptional: 'static {
- fn to_option(&self) -> Option<&ProtobufValue>;
+ fn to_option(&self) -> Option<&dyn ProtobufValue>;
- fn set_value(&mut self, value: &ProtobufValue);
+ fn set_value(&mut self, value: &dyn ProtobufValue);
}
impl<V: ProtobufValue + Clone + 'static> ReflectOptional for Option<V> {
- fn to_option(&self) -> Option<&ProtobufValue> {
- self.as_ref().map(|v| v as &ProtobufValue)
+ fn to_option(&self) -> Option<&dyn ProtobufValue> {
+ self.as_ref().map(|v| v as &dyn ProtobufValue)
}
- fn set_value(&mut self, value: &ProtobufValue) {
+ fn set_value(&mut self, value: &dyn ProtobufValue) {
match value.as_any().downcast_ref::<V>() {
Some(v) => mem::replace(self, Some(v.clone())),
None => panic!(),
@@ -24,11 +24,11 @@
}
impl<V: ProtobufValue + Clone + 'static> ReflectOptional for SingularField<V> {
- fn to_option(&self) -> Option<&ProtobufValue> {
- self.as_ref().map(|v| v as &ProtobufValue)
+ fn to_option(&self) -> Option<&dyn ProtobufValue> {
+ self.as_ref().map(|v| v as &dyn ProtobufValue)
}
- fn set_value(&mut self, value: &ProtobufValue) {
+ fn set_value(&mut self, value: &dyn ProtobufValue) {
match value.as_any().downcast_ref::<V>() {
Some(v) => mem::replace(self, SingularField::some(v.clone())),
None => panic!(),
@@ -37,11 +37,11 @@
}
impl<V: ProtobufValue + Clone + 'static> ReflectOptional for SingularPtrField<V> {
- fn to_option(&self) -> Option<&ProtobufValue> {
- self.as_ref().map(|v| v as &ProtobufValue)
+ fn to_option(&self) -> Option<&dyn ProtobufValue> {
+ self.as_ref().map(|v| v as &dyn ProtobufValue)
}
- fn set_value(&mut self, value: &ProtobufValue) {
+ fn set_value(&mut self, value: &dyn ProtobufValue) {
match value.as_any().downcast_ref::<V>() {
Some(v) => mem::replace(self, SingularPtrField::some(v.clone())),
None => panic!(),
diff --git a/src/reflect/repeated.rs b/src/reflect/repeated.rs
index 43e265d..be232f4 100644
--- a/src/reflect/repeated.rs
+++ b/src/reflect/repeated.rs
@@ -8,7 +8,7 @@
pub trait ReflectRepeated: 'static {
fn reflect_iter(&self) -> ReflectRepeatedIter;
fn len(&self) -> usize;
- fn get(&self, index: usize) -> &ProtobufValue;
+ fn get(&self, index: usize) -> &dyn ProtobufValue;
}
impl<V: ProtobufValue + 'static> ReflectRepeated for Vec<V> {
@@ -22,7 +22,7 @@
Vec::len(self)
}
- fn get(&self, index: usize) -> &ProtobufValue {
+ fn get(&self, index: usize) -> &dyn ProtobufValue {
&self[index]
}
}
@@ -39,7 +39,7 @@
<[_]>::len(self)
}
- fn get(&self, index: usize) -> &ProtobufValue {
+ fn get(&self, index: usize) -> &dyn ProtobufValue {
&self[index]
}
}
@@ -55,13 +55,13 @@
RepeatedField::len(self)
}
- fn get(&self, index: usize) -> &ProtobufValue {
+ fn get(&self, index: usize) -> &dyn ProtobufValue {
&self[index]
}
}
trait ReflectRepeatedIterTrait<'a> {
- fn next(&mut self) -> Option<&'a ProtobufValue>;
+ fn next(&mut self) -> Option<&'a dyn ProtobufValue>;
}
struct ReflectRepeatedIterImplSlice<'a, V: ProtobufValue + 'static> {
@@ -71,26 +71,26 @@
impl<'a, V: ProtobufValue + 'static> ReflectRepeatedIterTrait<'a>
for ReflectRepeatedIterImplSlice<'a, V>
{
- fn next(&mut self) -> Option<&'a ProtobufValue> {
- self.iter.next().map(|v| v as &ProtobufValue)
+ fn next(&mut self) -> Option<&'a dyn ProtobufValue> {
+ self.iter.next().map(|v| v as &dyn ProtobufValue)
}
}
pub struct ReflectRepeatedIter<'a> {
- imp: Box<ReflectRepeatedIterTrait<'a> + 'a>,
+ imp: Box<dyn ReflectRepeatedIterTrait<'a> + 'a>,
}
impl<'a> Iterator for ReflectRepeatedIter<'a> {
- type Item = &'a ProtobufValue;
+ type Item = &'a dyn ProtobufValue;
fn next(&mut self) -> Option<Self::Item> {
self.imp.next()
}
}
-impl<'a> IntoIterator for &'a ReflectRepeated {
+impl<'a> IntoIterator for &'a dyn ReflectRepeated {
type IntoIter = ReflectRepeatedIter<'a>;
- type Item = &'a ProtobufValue;
+ type Item = &'a dyn ProtobufValue;
fn into_iter(self) -> Self::IntoIter {
self.reflect_iter()
@@ -110,7 +110,7 @@
}
pub enum ReflectRepeatedRef<'a> {
- Generic(&'a ReflectRepeated),
+ Generic(&'a dyn ReflectRepeated),
U32(&'a [u32]),
U64(&'a [u64]),
I32(&'a [i32]),
@@ -120,8 +120,8 @@
Bool(&'a [bool]),
String(&'a [String]),
Bytes(&'a [Vec<u8>]),
- Enum(Box<ReflectRepeatedEnum<'a> + 'a>),
- Message(Box<ReflectRepeatedMessage<'a> + 'a>),
+ Enum(Box<dyn ReflectRepeatedEnum<'a> + 'a>),
+ Message(Box<dyn ReflectRepeatedMessage<'a> + 'a>),
}
impl<'a> ReflectRepeatedRef<'a> {
diff --git a/src/reflect/value.rs b/src/reflect/value.rs
index 2671805..16d5266 100644
--- a/src/reflect/value.rs
+++ b/src/reflect/value.rs
@@ -14,7 +14,7 @@
fn as_ref(&self) -> ReflectValueRef;
/// Convert to `Any`
- fn as_any(&self) -> &Any {
+ fn as_any(&self) -> &dyn Any {
unimplemented!()
}