pub struct GithubHandle(/* private fields */);Expand description
A GitHub handle (aka username).
Contains 1–39 ASCII letters, digits, or single interior hyphens. Enterprise
Managed Users may additionally have an _ followed by a 3–8 character
alphanumeric enterprise shortcode. GitHub’s current and legacy-compatible
ceiling is 39 characters (30 for some data-residency managed users).
Parsing drops one optional @ and preserves spelling; equality, ordering,
and hashing ignore ASCII case.
use known_types_github::GithubHandle;
let managed: GithubHandle = "@The-Octocat_octo".parse()?;
assert_eq!(managed.as_str(), "The-Octocat_octo");
assert!("octo--cat".parse::<GithubHandle>().is_err());See the shared handle contract for conversion and
integration behavior. With async-graphql, the scalar is named GithubHandle.
Implementations§
Source§impl GithubHandle
impl GithubHandle
Sourcepub const MIN_LENGTH: usize = 1
pub const MIN_LENGTH: usize = 1
Minimum length of the normalized handle, in Unicode scalar values.
Sourcepub const MAX_LENGTH: usize = 39
pub const MAX_LENGTH: usize = 39
Maximum representational length, in Unicode scalar values.
This is the widest known current or historical upstream bound, not necessarily the current registration limit.
Sourcepub fn into_string(self) -> String
pub fn into_string(self) -> String
Consume the handle and return its stored spelling.
Trait Implementations§
Source§impl AsRef<String> for GithubHandle
impl AsRef<String> for GithubHandle
Source§impl AsRef<str> for GithubHandle
impl AsRef<str> for GithubHandle
Source§impl Clone for GithubHandle
impl Clone for GithubHandle
Source§fn clone(&self) -> GithubHandle
fn clone(&self) -> GithubHandle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more