pub(crate) fn as_non_empty_string<S: Serializer>(string: &str, ser: S) -> Result<S::Ok, S::Error> {
    // Take the opportunity to trim as well.
    let string = string.trim();

    if string.is_empty() {
        // Serialize as a single whitespace if provided string is empty.
        ser.serialize_str(" ")
    } else {
        ser.serialize_str(string)
    }
}
/// Serialize an empty string as a single whitespace string.
Serialize an empty string as a single whitespace string.
Serialize an empty string as a single whitespace string .
pub(crate) fn as_non_empty_string<S: Serializer>(string: &str, ser: S) -> Result<S::Ok, S::Error> {
    // Take the opportunity to trim as well.
    let string = string.trim();
    if string.is_empty() {
        // Serialize as a single whitespace if provided string is empty.
        ser.serialize_str(" ")
    } else {
        ser.serialize_str(string)
    }
}
pub ( crate ) fn as_non_empty_string < S : Serializer > ( string : & str , ser : S ) -> Result < S :: Ok , S :: Error > { // Take the opportunity to trim as well. let string = string . trim ( ) ; if string . is_empty ( ) { // Serialize as a single whitespace if provided string is empty. ser . serialize_str ( " " ) } else { ser . serialize_str ( string ) } }
Serialize an empty string as a single whitespace string.
Serialize an empty string as a single whitespace string .
string
&str
ser
S
string
&str
ser
S