pub enum OptionalRepr {
Hazzer,
Option,
None,
}Expand description
Representation of optional fields in the generated code
Variants§
Hazzer
Presence of optional field is tracked in a separate bitfield called a hazzer.
Default for non-boxed fields.
Option
Optional field is wrapped in Option.
Default for boxed fields.
None
Represented as a non-optional field.
The field is represented the same way as with Hazzer, but without any
presence tracking. Note that the presence of the field will always be on for the purpose of
encoding and decoding, making it different from the implicit presence used by Proto3
non-optional fields. As such, accessors will always return Some, and the take_* and
clear_* accessors won’t be generated.
Trait Implementations§
Source§impl Clone for OptionalRepr
impl Clone for OptionalRepr
Source§fn clone(&self) -> OptionalRepr
fn clone(&self) -> OptionalRepr
Returns a duplicate 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 OptionalRepr
impl Debug for OptionalRepr
Source§impl<'de> Deserialize<'de> for OptionalRepr
impl<'de> Deserialize<'de> for OptionalRepr
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for OptionalRepr
impl Serialize for OptionalRepr
impl Copy for OptionalRepr
Auto Trait Implementations§
impl Freeze for OptionalRepr
impl RefUnwindSafe for OptionalRepr
impl Send for OptionalRepr
impl Sync for OptionalRepr
impl Unpin for OptionalRepr
impl UnwindSafe for OptionalRepr
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