Struct protobuf::UnknownFields
source · [−]pub struct UnknownFields {
pub fields: Option<Box<HashMap<u32, UnknownValues>>>,
}
Expand description
Hold “unknown” fields in parsed message.
Field may be unknown if it they are added in newer version of .proto
.
Unknown fields are stored in UnknownFields
structure, so
protobuf message could process messages without losing data.
For example, in this operation: load from DB, modify, store to DB,
even when working with older .proto
file, new fields won’t be lost.
Fields
fields: Option<Box<HashMap<u32, UnknownValues>>>
The map.
Implementations
sourceimpl UnknownFields
impl UnknownFields
sourcepub fn new() -> UnknownFields
pub fn new() -> UnknownFields
Empty unknown fields
sourcepub fn add_fixed32(&mut self, number: u32, fixed32: u32)
pub fn add_fixed32(&mut self, number: u32, fixed32: u32)
Add unknown fixed 32-bit
sourcepub fn add_fixed64(&mut self, number: u32, fixed64: u64)
pub fn add_fixed64(&mut self, number: u32, fixed64: u64)
Add unknown fixed 64-bit
sourcepub fn add_varint(&mut self, number: u32, varint: u64)
pub fn add_varint(&mut self, number: u32, varint: u64)
Add unknown varint
sourcepub fn add_length_delimited(&mut self, number: u32, length_delimited: Vec<u8>)
pub fn add_length_delimited(&mut self, number: u32, length_delimited: Vec<u8>)
Add unknown length delimited
sourcepub fn add_value(&mut self, number: u32, value: UnknownValue)
pub fn add_value(&mut self, number: u32, value: UnknownValue)
Add unknown value
sourcepub fn iter<'s>(&'s self) -> UnknownFieldsIter<'s>ⓘNotable traits for UnknownFieldsIter<'s>impl<'s> Iterator for UnknownFieldsIter<'s> type Item = (u32, &'s UnknownValues);
pub fn iter<'s>(&'s self) -> UnknownFieldsIter<'s>ⓘNotable traits for UnknownFieldsIter<'s>impl<'s> Iterator for UnknownFieldsIter<'s> type Item = (u32, &'s UnknownValues);
Iterate over all unknowns
sourcepub fn get(&self, field_number: u32) -> Option<&UnknownValues>
pub fn get(&self, field_number: u32) -> Option<&UnknownValues>
Find unknown field by number
Trait Implementations
sourceimpl Clear for UnknownFields
impl Clear for UnknownFields
sourceimpl Clone for UnknownFields
impl Clone for UnknownFields
sourcefn clone(&self) -> UnknownFields
fn clone(&self) -> UnknownFields
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for UnknownFields
impl Debug for UnknownFields
sourceimpl Default for UnknownFields
impl Default for UnknownFields
sourcefn default() -> UnknownFields
fn default() -> UnknownFields
Returns the “default value” for a type. Read more
sourceimpl Hash for UnknownFields
impl Hash for UnknownFields
Very simple hash implementation of Hash
for UnknownFields
.
Since map is unordered, we cannot put entry hashes into hasher,
instead we summing hashes of entries.
sourceimpl<'a> IntoIterator for &'a UnknownFields
impl<'a> IntoIterator for &'a UnknownFields
type Item = (u32, &'a UnknownValues)
type Item = (u32, &'a UnknownValues)
The type of the elements being iterated over.
type IntoIter = UnknownFieldsIter<'a>
type IntoIter = UnknownFieldsIter<'a>
Which kind of iterator are we turning this into?
sourcefn into_iter(self) -> UnknownFieldsIter<'a>ⓘNotable traits for UnknownFieldsIter<'s>impl<'s> Iterator for UnknownFieldsIter<'s> type Item = (u32, &'s UnknownValues);
fn into_iter(self) -> UnknownFieldsIter<'a>ⓘNotable traits for UnknownFieldsIter<'s>impl<'s> Iterator for UnknownFieldsIter<'s> type Item = (u32, &'s UnknownValues);
Creates an iterator from a value. Read more
sourceimpl PartialEq<UnknownFields> for UnknownFields
impl PartialEq<UnknownFields> for UnknownFields
sourcefn eq(&self, other: &UnknownFields) -> bool
fn eq(&self, other: &UnknownFields) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &UnknownFields) -> bool
fn ne(&self, other: &UnknownFields) -> bool
This method tests for !=
.
impl Eq for UnknownFields
impl StructuralEq for UnknownFields
impl StructuralPartialEq for UnknownFields
Auto Trait Implementations
impl RefUnwindSafe for UnknownFields
impl Send for UnknownFields
impl Sync for UnknownFields
impl Unpin for UnknownFields
impl UnwindSafe for UnknownFields
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more