This commit is contained in:
tyranron 2022-07-08 19:06:44 +00:00
parent 07238c4cde
commit 679692ed19
4 changed files with 8 additions and 14 deletions

View file

@ -1994,10 +1994,7 @@ where
.ok_or_else(|| format!("Expected `String` or `Int`, found: {}", v))
}
fn parse_token<S>(value: ScalarToken<'_>) -> ParseScalarResult<'_, S>
where
S: ScalarValue
{
fn parse_token<S: ScalarValue>(value: ScalarToken<'_>) -> ParseScalarResult<S> {
<String as ParseScalarValue<S>>::from_str(value)
.or_else(|_| <i32 as ParseScalarValue<S>>::from_str(value))
}
@ -2043,7 +2040,7 @@ impl StringOrInt {
.ok_or_else(|| format!("Expected `String` or `Int`, found: {}", v))
}
fn parse_token<S>(value: ScalarToken<'_>) -> ParseScalarResult<'_, S>
fn parse_token<S>(value: ScalarToken<'_>) -> ParseScalarResult<S>
where
S: ScalarValue,
{
@ -2090,7 +2087,7 @@ mod string_or_int {
.ok_or_else(|| format!("Expected `String` or `Int`, found: {}", v))
}
pub(super) fn parse_token<S>(value: ScalarToken<'_>) -> ParseScalarResult<'_, S>
pub(super) fn parse_token<S>(value: ScalarToken<'_>) -> ParseScalarResult<S>
where
S: ScalarValue,
{

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -310,10 +310,7 @@ where
.ok_or_else(|| format!("Expected `String` or `Int`, found: {}", v))
}
fn parse_token<S>(value: ScalarToken<'_>) -> ParseScalarResult<'_, S>
where
S: ScalarValue
{
fn parse_token<S: ScalarValue>(value: ScalarToken<'_>) -> ParseScalarResult<S> {
<String as ParseScalarValue<S>>::from_str(value)
.or_else(|_| <i32 as ParseScalarValue<S>>::from_str(value))
}
@ -359,7 +356,7 @@ impl StringOrInt {
.ok_or_else(|| format!("Expected `String` or `Int`, found: {}", v))
}
fn parse_token<S>(value: ScalarToken<'_>) -> ParseScalarResult<'_, S>
fn parse_token<S>(value: ScalarToken<'_>) -> ParseScalarResult<S>
where
S: ScalarValue,
{
@ -406,7 +403,7 @@ mod string_or_int {
.ok_or_else(|| format!("Expected `String` or `Int`, found: {}", v))
}
pub(super) fn parse_token<S>(value: ScalarToken<'_>) -> ParseScalarResult<'_, S>
pub(super) fn parse_token<S>(value: ScalarToken<'_>) -> ParseScalarResult<S>
where
S: ScalarValue,
{