I'm having a hard time determining exactly what you mean, so my post might not be relevant
1) dont use a big long string. Use a struct to store in the hashmap 2) Arc the struct
So your global state is something like
struct User {
uname: String,
email: String,
}
lazy_static! {
static ref USERS: Arc<RwLock<HashMap<u64, Arc<User>>>> = create_initial_users();
static ref MESSAGES: Arc<RwLock<HashMap<u64, Vec<String>>>> = create_initial_messages();
}
The hashmap key to both would be the user_id.
Now your clones() are cheap, you don't need parsing code, and you dont need to duplicate the username, and email in the messages database.