Function change_user_name

Source
pub async fn change_user_name<'a>(
    virtual_file_system: &'a VirtualFileSystem<'a>,
    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 system
  • Current_name - Current username of the account
  • New_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