pub struct UnknownFields { /* private fields */ }
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.
Implementations§
Source§impl UnknownFields
impl UnknownFields
Sourcepub const fn new() -> UnknownFields
pub const 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> ⓘ
pub fn iter<'s>(&'s self) -> UnknownFieldsIter<'s> ⓘ
Iterate over all unknowns
Sourcepub fn get(&self, field_number: u32) -> Option<UnknownValueRef<'_>>
pub fn get(&self, field_number: u32) -> Option<UnknownValueRef<'_>>
Get any value for unknown fields.
Trait Implementations§
Source§impl Clone for UnknownFields
impl Clone for UnknownFields
Source§fn clone(&self) -> UnknownFields
fn clone(&self) -> UnknownFields
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for UnknownFields
impl Debug for UnknownFields
Source§impl Default for UnknownFields
impl Default for UnknownFields
Source§fn default() -> UnknownFields
fn default() -> UnknownFields
Returns the “default value” for a type. Read more
Source§impl 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.
Source§impl<'a> IntoIterator for &'a UnknownFields
impl<'a> IntoIterator for &'a UnknownFields
Source§type Item = (u32, UnknownValueRef<'a>)
type Item = (u32, UnknownValueRef<'a>)
The type of the elements being iterated over.
Source§type IntoIter = UnknownFieldsIter<'a>
type IntoIter = UnknownFieldsIter<'a>
Which kind of iterator are we turning this into?
Source§impl PartialEq for UnknownFields
impl PartialEq for UnknownFields
impl Eq for UnknownFields
impl StructuralPartialEq for UnknownFields
Auto Trait Implementations§
impl Freeze for UnknownFields
impl RefUnwindSafe for UnknownFields
impl Send for UnknownFields
impl Sync for UnknownFields
impl Unpin for UnknownFields
impl UnwindSafe for UnknownFields
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more