Lines Matching +full:path +full:- +full:parse
12 /// [syntax tree enum]: Expr#syntax-tree-enums
19 /// A bare function type: `fn(usize) -> bool`.
41 /// A path like `std::slice::Iter`, optionally qualified with a
42 /// self-type as in `<Vec<T> as SomeTrait>::Associated`.
43 Path(TypePath),
95 /// A bare function type: `fn(usize) -> bool`.
162 /// A path like `std::slice::Iter`, optionally qualified with a
163 /// self-type as in `<Vec<T> as SomeTrait>::Associated`.
167 pub path: Path,
231 /// An argument in a function type: the `usize` in `fn(usize) -> bool`.
260 Type(Token![->], Box<Type>),
268 use crate::parse::{Parse, ParseStream, Result};
269 use crate::path;
273 impl Parse for Type {
274 fn parse(input: ParseStream) -> Result<Self> { in parse() method
288 pub fn without_plus(input: ParseStream) -> Result<Self> { in without_plus()
299 ) -> Result<Type> { in ambig_ty()
303 let mut group: TypeGroup = input.parse()?; in ambig_ty()
305 if let Type::Path(mut ty) = *group.elem { in ambig_ty()
306 Path::parse_rest(input, &mut ty.path, false)?; in ambig_ty()
307 return Ok(Type::Path(ty)); in ambig_ty()
309 return Ok(Type::Path(TypePath { in ambig_ty()
317 path: Path::parse_helper(input, false)?, in ambig_ty()
323 if let Type::Path(mut ty) = *group.elem { in ambig_ty()
324 let arguments = &mut ty.path.segments.last_mut().unwrap().arguments; in ambig_ty()
326 *arguments = PathArguments::AngleBracketed(input.parse()?); in ambig_ty()
327 Path::parse_rest(input, &mut ty.path, false)?; in ambig_ty()
328 return Ok(Type::Path(ty)); in ambig_ty()
330 group.elem = Box::new(Type::Path(ty)); in ambig_ty()
340 lifetimes = input.parse()?; in ambig_ty()
368 elem: Box::new(Type::TraitObject(content.parse()?)), in ambig_ty()
378 ..content.parse()? in ambig_ty()
380 while let Some(plus) = input.parse()? { in ambig_ty()
382 bounds.push_value(input.parse()?); in ambig_ty()
388 let mut first: Type = content.parse()?; in ambig_ty()
395 elems.push_punct(content.parse()?); in ambig_ty()
397 elems.push_value(content.parse()?); in ambig_ty()
401 elems.push_punct(content.parse()?); in ambig_ty()
410 Type::Path(TypePath { qself: None, path }) => { in ambig_ty()
415 path, in ambig_ty()
447 while let Some(plus) = input.parse()? { in ambig_ty()
449 bounds.push_value(input.parse()?); in ambig_ty()
464 let mut bare_fn: TypeBareFn = input.parse()?; in ambig_ty()
475 let ty: TypePath = input.parse()?; in ambig_ty()
477 return Ok(Type::Path(ty)); in ambig_ty()
480 if input.peek(Token![!]) && !input.peek(Token![!=]) && ty.path.is_mod_style() { in ambig_ty()
481 let bang_token: Token![!] = input.parse()?; in ambig_ty()
485 path: ty.path, in ambig_ty()
499 path: ty.path, in ambig_ty()
503 bounds.push_punct(input.parse()?); in ambig_ty()
512 bounds.push_value(input.parse()?); in ambig_ty()
521 Ok(Type::Path(ty)) in ambig_ty()
523 let dyn_token: Token![dyn] = input.parse()?; in ambig_ty()
525 let star_token: Option<Token![*]> = input.parse()?; in ambig_ty()
538 let elem: Type = content.parse()?; in ambig_ty()
543 semi_token: content.parse()?, in ambig_ty()
544 len: content.parse()?, in ambig_ty()
553 input.parse().map(Type::Ptr) in ambig_ty()
555 input.parse().map(Type::Reference) in ambig_ty()
557 input.parse().map(Type::Never) in ambig_ty()
559 TypeImplTrait::parse(input, allow_plus).map(Type::ImplTrait) in ambig_ty()
561 input.parse().map(Type::Infer) in ambig_ty()
563 input.parse().map(Type::TraitObject) in ambig_ty()
570 impl Parse for TypeSlice {
571 fn parse(input: ParseStream) -> Result<Self> { in parse() method
575 elem: content.parse()?, in parse()
581 impl Parse for TypeArray {
582 fn parse(input: ParseStream) -> Result<Self> { in parse() method
586 elem: content.parse()?, in parse()
587 semi_token: content.parse()?, in parse()
588 len: content.parse()?, in parse()
594 impl Parse for TypePtr {
595 fn parse(input: ParseStream) -> Result<Self> { in parse() method
596 let star_token: Token![*] = input.parse()?; in parse()
600 (Some(input.parse()?), None) in parse()
602 (None, Some(input.parse()?)) in parse()
617 impl Parse for TypeReference {
618 fn parse(input: ParseStream) -> Result<Self> { in parse() method
620 and_token: input.parse()?, in parse()
621 lifetime: input.parse()?, in parse()
622 mutability: input.parse()?, in parse()
630 impl Parse for TypeBareFn {
631 fn parse(input: ParseStream) -> Result<Self> { in parse() method
636 lifetimes: input.parse()?, in parse()
637 unsafety: input.parse()?, in parse()
638 abi: input.parse()?, in parse()
639 fn_token: input.parse()?, in parse()
664 let comma = args.parse()?; in parse()
677 impl Parse for TypeNever {
678 fn parse(input: ParseStream) -> Result<Self> { in parse() method
680 bang_token: input.parse()?, in parse()
686 impl Parse for TypeInfer {
687 fn parse(input: ParseStream) -> Result<Self> { in parse() method
689 underscore_token: input.parse()?, in parse()
695 impl Parse for TypeTuple {
696 fn parse(input: ParseStream) -> Result<Self> { in parse() method
707 let first: Type = content.parse()?; in parse()
713 elems.push_punct(content.parse()?); in parse()
715 elems.push_value(content.parse()?); in parse()
719 elems.push_punct(content.parse()?); in parse()
728 impl Parse for TypeMacro {
729 fn parse(input: ParseStream) -> Result<Self> { in parse() method
731 mac: input.parse()?, in parse()
737 impl Parse for TypePath {
738 fn parse(input: ParseStream) -> Result<Self> { in parse() method
740 let (qself, path) = path::parsing::qpath(input, expr_style)?; in parse()
741 Ok(TypePath { qself, path }) in parse()
747 pub fn without_plus(input: ParseStream) -> Result<Self> { in without_plus()
749 Self::parse(input, allow_plus) in without_plus()
752 pub(crate) fn parse(input: ParseStream, allow_plus: bool) -> Result<Self> { in parse() method
753 if input.peek(Token![->]) { in parse()
754 let arrow = input.parse()?; in parse()
765 impl Parse for ReturnType {
766 fn parse(input: ParseStream) -> Result<Self> { in parse() method
768 Self::parse(input, allow_plus) in parse()
773 impl Parse for TypeTraitObject {
774 fn parse(input: ParseStream) -> Result<Self> { in parse() method
776 Self::parse(input, allow_plus) in parse()
782 pub fn without_plus(input: ParseStream) -> Result<Self> { in without_plus()
784 Self::parse(input, allow_plus) in without_plus()
788 pub(crate) fn parse(input: ParseStream, allow_plus: bool) -> Result<Self> { in parse() method
789 let dyn_token: Option<Token![dyn]> = input.parse()?; in parse()
802 ) -> Result<Punctuated<TypeParamBound, Token![+]>> { in parse_bounds()
827 impl Parse for TypeImplTrait {
828 fn parse(input: ParseStream) -> Result<Self> { in parse() method
830 Self::parse(input, allow_plus) in parse()
836 pub fn without_plus(input: ParseStream) -> Result<Self> { in without_plus()
838 Self::parse(input, allow_plus) in without_plus()
841 pub(crate) fn parse(input: ParseStream, allow_plus: bool) -> Result<Self> { in parse() method
842 let impl_token: Token![impl] = input.parse()?; in parse()
870 impl Parse for TypeGroup {
871 fn parse(input: ParseStream) -> Result<Self> { in parse() method
875 elem: group.content.parse()?, in parse()
881 impl Parse for TypeParen {
882 fn parse(input: ParseStream) -> Result<Self> { in parse() method
884 Self::parse(input, allow_plus) in parse()
889 fn parse(input: ParseStream, allow_plus: bool) -> Result<Self> { in parse() method
902 impl Parse for BareFnArg {
903 fn parse(input: ParseStream) -> Result<Self> { in parse() method
909 fn parse_bare_fn_arg(input: ParseStream, allow_self: bool) -> Result<BareFnArg> { in parse_bare_fn_arg()
916 input.parse::<Token![mut]>()?; in parse_bare_fn_arg()
927 let colon: Token![:] = input.parse()?; in parse_bare_fn_arg()
936 input.parse::<Token![mut]>()?; in parse_bare_fn_arg()
937 input.parse::<Token![self]>()?; in parse_bare_fn_arg()
940 input.parse::<Token![self]>()?; in parse_bare_fn_arg()
943 Some(input.parse()?) in parse_bare_fn_arg()
957 fn parse_bare_variadic(input: ParseStream, attrs: Vec<Attribute>) -> Result<BareVariadic> { in parse_bare_variadic()
962 let colon: Token![:] = input.parse()?; in parse_bare_variadic()
967 dots: input.parse()?, in parse_bare_variadic()
968 comma: input.parse()?, in parse_bare_variadic()
973 impl Parse for Abi {
974 fn parse(input: ParseStream) -> Result<Self> { in parse() method
976 extern_token: input.parse()?, in parse()
977 name: input.parse()?, in parse()
983 impl Parse for Option<Abi> {
984 fn parse(input: ParseStream) -> Result<Self> { in parse() method
986 input.parse().map(Some) in parse()
1091 path::printing::print_path(tokens, &self.qself, &self.path); in to_tokens()