Skip structure field during serialization

Given the structure:

#[derive(Debug, Serialize)]
pub struct ReqMetrics {
    start: Timespec,
    pub name: String
}

How can I guarantee that Serde ignores a field startwhen serialized?

+4
source share
1 answer

The correct annotation #[serde(skip_serializing)].

+7
source

Source: https://habr.com/ru/post/1669777/


All Articles