/// A response with json-serialized data indicating success.
///
/// # Note
/// If the provided `response` cannot fit into the message, an error will be returned instead.
A response with json-serialized data indicating success.
A response with json - serialized data indicating success .
pub fn data(response: impl Serialize) -> Self {
        let data = match serde_json_core::to_string(&response) {
            Ok(data) => data,
            Err(_) => return Self::custom(-2, "Response too large"),
        };
        Self { code: 0, data }
    }
pub fn data ( response : impl Serialize ) -> Self { let data = match serde_json_core :: to_string ( & response ) { Ok ( data ) => data , Err ( _ ) => return Self :: custom ( - 2 , " " ) , } ; Self { code : 0 , data } }
A response with json-serialized data indicating success.
A response with json - serialized data indicating success .
response
impl Serialize
note
If the provided `response` cannot fit into the message, an error will be returned instead.
If the provided ` response ` cannot fit into the message an error will be returned instead .