Struct prost_reflect::SerializeOptions
source · pub struct SerializeOptions { /* private fields */ }
Expand description
Options to control serialization of messages.
Implementations§
source§impl 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§
source§impl Clone for SerializeOptions
impl Clone for SerializeOptions
source§fn clone(&self) -> SerializeOptions
fn clone(&self) -> SerializeOptions
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for SerializeOptions
impl Debug for SerializeOptions
Auto Trait Implementations§
impl Freeze for SerializeOptions
impl RefUnwindSafe for SerializeOptions
impl Send for SerializeOptions
impl Sync for SerializeOptions
impl Unpin for SerializeOptions
impl UnwindSafe for SerializeOptions
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)