pub async fn change_user_name(
virtual_file_system: &VirtualFileSystem,
current_name: &str,
new_name: &str,
) -> Result<()>Expand description
Changes a user’s username by updating their user file.
This function reads the user’s existing data, updates the name field, and writes the modified data back to the file system.
§Arguments
Virtual_file_system- Reference to the virtual file systemCurrent_name- Current username of the accountNew_name- New username to assign
§Returns
Returns Ok(()) if the username was changed successfully,
or an appropriate error if the operation fails.
§Errors
- File system errors (opening, reading, writing user file)
- JSON parsing errors
- Path construction failures