The mem::size_of function measures a very specific thing, which is the size that a variable of that type would take up on the stack; or the offset (in memory, in bytes) between subsequent elements of the type in an array/vector.
This notion of “size” ignores anything behind any nonzero level of indirection. It is not meant for any informative purpose on overall RAM usage associated with some data, instead mem::size_of serves very simple technical purposes: one example would be implementing the low-level implementation details of a vector-like type, where you’d need to calculate the correct offset in bytes for the Nth element.
If you are interested in some more “informative function returning overall RAM usage associated with some data”, take a look at crates like get-size or deepsize.
size_of() returns the size of the very type you give it. A Vec doesn't store its elements inline, it heap-allocates a buffer, so the Vec struct itself always has the same size: a pointer and two usizes for the capacity and length.
size_of_val simply returns the size of the type of the passed value. Its return value only depends on the value itself in the case of dynamically-sized types such as slices and trait objects. Vec is not a DST.