I understand that it is used for serialization and deserialization of a struct but why does anybody want to serialize/deserialize the struct? What's the use case?
EOSLIB_SERIAlIZE is a
DataStream Seralizater , if you want to deep dive into what it does you should go to
contracts/eosiolib/serialize.hpp in your EOS directory. It basically gives the struct extra operators for the
deserialization of data to and from the
if you go deep inside this you will found that it was using
BOOST_PP_SEQ_FOR_EACH macro. If you want to know more on
Boost preprocessor + enums that is what exactly happening here you should go here and personally I would suggest you to go explore more about enums in c++.