now, I want a way to ensure that crate server & crate client can check that they used the same version of crate msg. Is there for crate server/client to get a shasum2 of the src of the crate mst they used? (This way, if after a change, only one of the two crates is recompiled, we can easily detect a version mismatch.)
EDIT: I want something auto generated, not something programmer has to manually update, as I may forget to update after a change.
It is not obvious to me how to use any of the 3 techniques to solve the problem at hand, but I do agree with you they are in the right ballpark of "checksum-ing crate"
If you can compare the common msg crate by version number instead of source hash, then the cargo-lock crate may work. In a build script on each dependent crate, you can call Lockfile::load("Cargo.lock"), find the Package by name corresponding to msg, then store the Version of that package in a common location. (Note that Package also has a checksum field, but it only contains a value when the package is downloaded from a registry like crates.io.)
This requires manually updating the version number right? The problem here is I'm using IntelliJ, which jumps me between crates on "goto def"; so there are times where I am modifying crate msg in the flow of IntelliJ editing, and not even consciously aware of "oh, I'm in the crate msg now".