Function wicrs_server::api::change_username[][src]

pub async fn change_username<S: Into<String> + Clone>(
    user: &mut User,
    new_name: S
) -> Result<String>

Changes a user’s username. Returns the user’s previous username if successful.

Arguments

  • user - User whose name is to be changed.
  • new_name - New username for the user.

Errors

This function may return an error for any of the following reasons.

  • The modified user data could not be saved for any of the reasons outlined in User::save.
  • The user’s name could not be changed for any of the reasons outlined in User::change_username.