pub struct GithubHandle(/* private fields */);github only.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 moreSource§impl CursorType for GithubHandle
Available on crate feature async-graphql only.
impl CursorType for GithubHandle
async-graphql only.Source§type Error = ParseHandleError
type Error = ParseHandleError
decode_cursor.Source§fn decode_cursor(
input: &str,
) -> Result<GithubHandle, <GithubHandle as CursorType>::Error>
fn decode_cursor( input: &str, ) -> Result<GithubHandle, <GithubHandle as CursorType>::Error>
Source§fn encode_cursor(&self) -> String
fn encode_cursor(&self) -> String
Source§impl Debug for GithubHandle
impl Debug for GithubHandle
Source§impl<'r, DB> Decode<'r, DB> for GithubHandle
Available on crate feature sqlx only.
impl<'r, DB> Decode<'r, DB> for GithubHandle
sqlx only.Source§impl<'de> Deserialize<'de> for GithubHandle
Available on crate feature serde only.
impl<'de> Deserialize<'de> for GithubHandle
serde only.Source§fn deserialize<D>(
deserializer: D,
) -> Result<GithubHandle, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<GithubHandle, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl Display for GithubHandle
impl Display for GithubHandle
Source§impl<'q, DB> Encode<'q, DB> for GithubHandle
Available on crate feature sqlx only.
impl<'q, DB> Encode<'q, DB> for GithubHandle
sqlx only.impl Eq for GithubHandle
Source§impl From<GithubHandle> for SocialHandle
impl From<GithubHandle> for SocialHandle
Source§fn from(value: GithubHandle) -> Self
fn from(value: GithubHandle) -> Self
Source§impl FromStr for GithubHandle
impl FromStr for GithubHandle
Source§type Err = ParseHandleError
type Err = ParseHandleError
Source§fn from_str(input: &str) -> Result<GithubHandle, <GithubHandle as FromStr>::Err>
fn from_str(input: &str) -> Result<GithubHandle, <GithubHandle as FromStr>::Err>
s to return a value of this type. Read moreSource§impl Hash for GithubHandle
impl Hash for GithubHandle
Source§impl InputType for GithubHandle
impl InputType for GithubHandle
Source§type RawValueType = GithubHandle
type RawValueType = GithubHandle
Source§fn create_type_info(registry: &mut Registry) -> String
fn create_type_info(registry: &mut Registry) -> String
Source§fn parse(
value: Option<ConstValue>,
) -> Result<GithubHandle, InputValueError<GithubHandle>>
fn parse( value: Option<ConstValue>, ) -> Result<GithubHandle, InputValueError<GithubHandle>>
Value. None represents undefined.Source§fn to_value(&self) -> ConstValue
fn to_value(&self) -> ConstValue
Value for introspection.Source§fn as_raw_value(&self) -> Option<&<GithubHandle as InputType>::RawValueType>
fn as_raw_value(&self) -> Option<&<GithubHandle as InputType>::RawValueType>
Source§fn qualified_type_name() -> String
fn qualified_type_name() -> String
Source§impl Ord for GithubHandle
impl Ord for GithubHandle
Source§fn cmp(&self, other: &GithubHandle) -> Ordering
fn cmp(&self, other: &GithubHandle) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl OutputType for GithubHandle
impl OutputType for GithubHandle
Source§fn create_type_info(registry: &mut Registry) -> String
fn create_type_info(registry: &mut Registry) -> String
Source§async fn resolve(
&self,
_: &ContextBase<'_, &Positioned<SelectionSet>>,
_field: &Positioned<Field>,
) -> Result<ConstValue, ServerError>
async fn resolve( &self, _: &ContextBase<'_, &Positioned<SelectionSet>>, _field: &Positioned<Field>, ) -> Result<ConstValue, ServerError>
boxed-trait only.async_graphql::Value.Source§fn qualified_type_name() -> String
fn qualified_type_name() -> String
Source§impl PartialEq for GithubHandle
impl PartialEq for GithubHandle
Source§impl PartialOrd for GithubHandle
impl PartialOrd for GithubHandle
Source§impl ScalarType for GithubHandle
impl ScalarType for GithubHandle
Source§fn parse(
value: ConstValue,
) -> Result<GithubHandle, InputValueError<GithubHandle>>
fn parse( value: ConstValue, ) -> Result<GithubHandle, InputValueError<GithubHandle>>
Source§fn to_value(&self) -> ConstValue
fn to_value(&self) -> ConstValue
Value.Source§impl Serialize for GithubHandle
Available on crate feature serde only.
impl Serialize for GithubHandle
serde only.Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Source§impl TryFrom<&str> for GithubHandle
impl TryFrom<&str> for GithubHandle
Source§type Error = ParseHandleError
type Error = ParseHandleError
Source§fn try_from(
input: &str,
) -> Result<GithubHandle, <GithubHandle as TryFrom<&str>>::Error>
fn try_from( input: &str, ) -> Result<GithubHandle, <GithubHandle as TryFrom<&str>>::Error>
Source§impl TryFrom<String> for GithubHandle
impl TryFrom<String> for GithubHandle
Source§type Error = ParseHandleError
type Error = ParseHandleError
Source§fn try_from(
input: String,
) -> Result<GithubHandle, <GithubHandle as TryFrom<String>>::Error>
fn try_from( input: String, ) -> Result<GithubHandle, <GithubHandle as TryFrom<String>>::Error>
Source§impl<DB> Type<DB> for GithubHandle
Available on crate feature sqlx only.
impl<DB> Type<DB> for GithubHandle
sqlx only.Auto Trait Implementations§
impl Freeze for GithubHandle
impl RefUnwindSafe for GithubHandle
impl Send for GithubHandle
impl Sync for GithubHandle
impl Unpin for GithubHandle
impl UnsafeUnpin for GithubHandle
impl UnwindSafe for GithubHandle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> RpcMessage for T
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.