#[derive(Debug, Clone, Default)]
pub struct JsonCodec {
preserve_proto_field_names: bool,
always_print_fields: bool,
emit_enum_as_number: bool,
}
impl JsonCodec {
pub fn new() -> Self {
Self::default()
}
pub fn preserve_proto_field_names(mut self, yes: bool) -> Self {
self.preserve_proto_field_names = yes;
self
}
pub fn always_print_fields(mut self, yes: bool) -> Self {
self.always_print_fields = yes;
self
}
pub fn emit_enum_as_number(mut self, yes: bool) -> Self {
self.emit_enum_as_number = yes;
self
}
pub(crate) fn uses_proto_names(&self) -> bool {
self.preserve_proto_field_names
}
pub(crate) fn always_print(&self) -> bool {
self.always_print_fields
}
pub(crate) fn enum_as_number(&self) -> bool {
self.emit_enum_as_number
}
}