twilight_validate::request

Function username

source
pub fn username(value: impl AsRef<str>) -> Result<(), ValidationError>
Expand description

Ensure that a username is correct.

The length must be at least USERNAME_LIMIT_MIN and at most USERNAME_LIMIT_MAX. It must also be free of certain substrings. This is based on this documentation entry.

ยงErrors

Returns an error of type Username if the length is invalid.