What is the best way to implment the `CandidType` for this struct?

I want to impl CandidType for this struct without AtomicBool supporting by candid crate:

#[derive(Debug, Clone, Serialize, Deserialize)]
struct InnerSegmentMeta {
    segment_id: SegmentId,
    max_doc: u32,
    deletes: Option<DeleteMeta>,
    /// If you want to avoid the SegmentComponent::TempStore file to be covered by
    /// garbage collection and deleted, set this to true. This is used during merge.
    #[serde(default = "default_temp_store")]
    pub(crate) include_temp_doc_store: Arc<AtomicBool>,

So i need to describe all of type details of the field of the struct in _ty() function. But this way have a lot of duplications as segment_id field, max_doc field and deletes field already had CandidType implmentation:

impl candid::CandidType for InnerSegmentMeta {
    fn _ty() -> candid::types::Type {
        use candid::field;
        use candid::types::{Field, TypeInner};
        let segment_id_field = field! {segment_id: TypeInner::Text.into()};
        let max_doc_field = field! {max_doc: TypeInner::Nat32.into()};
        let deletes_field = field!{deletes: TypeInner::Opt(TypeInner::Vec(()))}
        // let records = TypeInner::Record(vec![Field])

    fn idl_serialize<S>(&self, serializer: S) -> Result<(), S::Error>
    where S: candid::types::Serializer {

The only field i need to implment is AtomicBool. What is the best way to do this in rust? Thx in advance.

Also, can i using something such as #[serde(skip)] to skip the serialize of this field for the CandidType?

TypeInner::Record(vec![field!{segment_id: SegmentId::ty()}, field!{max_dic: u32::ty()}, field!{deletes: Option<DeleteMeta>::ty()}, field!{include_temp_doc_store: bool::ty()} ])

Maybe I need to add a record! macro as well.

#[serde(skip)] is currently not supported, but if it’s an option type, it can be automatically skipped if it’s not provided.

Appreciate it. I have forgot that a type implement a trait will implement all of its function. So all type implemented CandidType will have ty() function returning the type I need. I got a deeper understanding of rust. And a struct macro is useful!