Is there some kind module exist?


I try to read a xml from a file .that is easy .
then I will use TCPstream to send the xml .but before that , I need to deal with the xml, first count out the length of the xml and make it into four bytes before the xml content.
the struct is something like {:4b}{string:b}.
I checked the but it is really hard for me to give the key word to find the proper module to use.
anybody give a sugguestion? thank you .


Can’t you just read the XML document into a Vec<u8> and then insert the length at the beginning as a 32-bit integer?

The only hard part would be encoding the length with the right endianness, you can use the byteorder crate for that.