Parsing metadata help

I'm new to the compiler process of rust. Currently, I'm working on .rlib file and want to know some details about the metadata included in the rlib file. I have extracted the rmeta file from the rlib file, however, I found out it is also a binary file. I have tried to decode it and got some information but it is not clear enough. I wonder if there is any reliable way to parse the rmeta file giving me a clear picture of metadata.

B.T.W. I'm also confusing about the meaning of the creation of .rlib file. Because it seems that rust can also work with other format libraries like .dylib, .so, .a. tks

Rustc encodes the metadata in an unstable format. A while ago I made a program to show some of the data in a human readable format: https://github.com/bjorn3/rust_read_rlib. I haven't updated it for about a year, so it very likely won't compile anymore. For dylibs, the metadata is stored compressed in the .rustc section. For staticlibs, cdylibs and executables, there is no metadata saved. If you want to know how it is encoded, you can find the source at src/librustc_metadata of the https://github.com/rust-lang/rust repo.