Trait SerdeConfig

Source
pub trait SerdeConfig {
    // Provided methods
    fn body_name(&self) -> Cow<'static, str> { ... }
    fn err_msg_name(&self) -> Cow<'static, str> { ... }
    fn fixed_field(&self) -> bool { ... }
    fn signed_status(&self) -> Option<StatusSign> { ... }
    fn extra_message(&self) -> Option<Cow<'static, str>> { ... }
}
Expand description

the config information of serialize

Provided Methods§

Source

fn body_name(&self) -> Cow<'static, str>

the name of body field, the field will be available when the RespResult is Success(_)

§Default

the default field name is body

Source

fn err_msg_name(&self) -> Cow<'static, str>

the name of error_message field, this field will be available when RespResult is Err(_)

§Default

the default field name is error-message

Source

fn fixed_field(&self) -> bool

fixed field size,

  • if return true, will also serialize not available field with null
§Default

the default value is true

Source

fn signed_status(&self) -> Option<StatusSign>

sign the status of response

  • Some(_) enable this sign
  • None disable this sign
§Default

default enable this sign using bool

  • true -> Success
  • false -> Err
Source

fn extra_message(&self) -> Option<Cow<'static, str>>

extra error message

  • Some(_) enable extra error message
  • None disable extra error message extra-error
§Default

default enable with field name extra-msg

Implementors§