Struct prost_reflect::SerializeOptions
source · [−]pub struct SerializeOptions { /* private fields */ }serde only.Expand description
Options to control serialization of messages.
Implementations
sourceimpl SerializeOptions
impl SerializeOptions
sourcepub const fn new() -> Self
pub const fn new() -> Self
Creates a new instance of SerializeOptions, with the default options chosen to conform to
the standard JSON mapping.
sourcepub const fn stringify_64_bit_integers(self, yes: bool) -> Self
pub const fn stringify_64_bit_integers(self, yes: bool) -> Self
Whether to encode 64-bit integral types as strings.
The spec requires encoding 64-bit integers as strings, to prevent loss of precision in JSON when the value cannot be represented exactly by a double. If this option is disabled, all numbers will be serialized as their corresponding serde types instead.
The default value is true.
sourcepub const fn use_enum_numbers(self, yes: bool) -> Self
pub const fn use_enum_numbers(self, yes: bool) -> Self
Whether to encode enum values as their numeric value.
If true, enum values will be serialized as their integer values. Otherwise, they will be
serialized as the string value specified in the proto file.
The default value is false.
sourcepub const fn use_proto_field_name(self, yes: bool) -> Self
pub const fn use_proto_field_name(self, yes: bool) -> Self
Whether to use the proto field name instead of the lowerCamelCase name in JSON field names.
The default value is false.
sourcepub const fn skip_default_fields(self, yes: bool) -> Self
pub const fn skip_default_fields(self, yes: bool) -> Self
Whether to skip fields which have their default value.
If true, any fields for which has_field returns false will
not be serialized. If false, they will be serialized with their default value.
The default value is true.
Trait Implementations
sourceimpl Clone for SerializeOptions
impl Clone for SerializeOptions
sourcefn clone(&self) -> SerializeOptions
fn clone(&self) -> SerializeOptions
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 SerializeOptions
impl Debug for SerializeOptions
Auto Trait Implementations
impl RefUnwindSafe for SerializeOptions
impl Send for SerializeOptions
impl Sync for SerializeOptions
impl Unpin for SerializeOptions
impl UnwindSafe for SerializeOptions
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more