Lines Matching +full:segment +full:- +full:1 +full:a
1 // SPDX-License-Identifier: Apache-2.0 OR MIT
14 /// A path at which a named item is exported (e.g. `std::collections::HashMap`).
26 fn from(segment: T) -> Self { in from()
31 path.segments.push_value(segment.into()); in from()
37 /// Determines whether this is a path of length 1 equal to the given
42 /// - the path has no leading colon,
43 /// - the number of path segments is 1,
44 /// - the first path segment has no angle bracketed or parenthesized
46 /// - the ident of the first path segment is equal to the given one.
54 /// fn get_serde_meta_item(attr: &Attribute) -> Result<Option<&TokenStream>> {
65 pub fn is_ident<I>(&self, ident: &I) -> bool in is_ident()
76 /// If this path consists of a single ident, returns the ident.
78 /// A path is considered an ident if:
80 /// - the path has no leading colon,
81 /// - the number of path segments is 1, and
82 /// - the first path segment has no angle bracketed or parenthesized
84 pub fn get_ident(&self) -> Option<&Ident> { in get_ident()
86 && self.segments.len() == 1 in get_ident()
95 /// An error if this path is not a single ident, as defined in `get_ident`.
98 pub fn require_ident(&self) -> Result<&Ident> { in require_ident()
110 /// A segment of a path together with any path arguments on that segment.
122 fn from(ident: T) -> Self { in from()
131 /// Angle bracketed or parenthesized arguments of a path segment.
135 /// The `<'a, T>` in `std::slice::iter<'a, T>`.
139 /// The `(A, B) -> C` in `Fn(A, B) -> C`.
143 /// The `<'a, T>` in `std::slice::iter<'a, T>`.
145 /// The `(A, B) -> C` in `Fn(A, B) -> C`.
151 fn default() -> Self { in default()
157 pub fn is_empty(&self) -> bool { in is_empty()
165 pub fn is_none(&self) -> bool { in is_none()
174 /// An individual generic argument, like `'a`, `T`, or `Item = T`.
178 /// A lifetime argument.
180 /// A type argument.
182 /// A const expression. Must be inside of a block.
187 /// A binding (equality constraint) on an associated type: the `Item =
199 /// Angle bracketed arguments of a path segment: the `<K, V>` in `HashMap<K,
211 /// A binding (equality constraint) on an associated type: the `Item = u8`
246 /// Arguments of a function path segment: the `(A, B) -> C` in `Fn(A,B) ->
251 /// `(A, B)`
259 /// The explicit Self type in a qualified path: the `T` in `<T as
267 /// <Vec<T> as a::b::Trait>::AssociatedItem
312 fn parse(input: ParseStream) -> Result<Self> { in parse()
319 fn parse(input: ParseStream) -> Result<Self> { in parse()
334 && ty.path.segments.len() == 1 in parse()
341 let segment = ty.path.segments.pop().unwrap().into_value(); in parse() localVariable
342 let ident = segment.ident; in parse()
343 let generics = match segment.arguments { in parse()
367 let segment = ty.path.segments.pop().unwrap().into_value(); in parse() localVariable
369 ident: segment.ident, in parse()
370 generics: match segment.arguments { in parse()
411 pub(crate) fn const_argument(input: ParseStream) -> Result<Expr> { in const_argument()
456 pub fn parse_turbofish(input: ParseStream) -> Result<Self> { in parse_turbofish()
464 ) -> Result<Self> { in do_parse()
491 fn parse(input: ParseStream) -> Result<Self> { in parse()
499 fn parse(input: ParseStream) -> Result<Self> { in parse()
511 fn parse(input: ParseStream) -> Result<Self> { in parse()
517 fn parse_helper(input: ParseStream, expr_style: bool) -> Result<Self> { in parse_helper()
550 /// Parse a `Path` containing no path arguments on any of its segments.
558 /// // A simplified single `use` statement like:
562 /// // Note that generic parameters are not allowed in a `use` statement
565 /// // use a::<b>::c;
572 /// fn parse(input: ParseStream) -> Result<Self> {
581 pub fn parse_mod_style(input: ParseStream) -> Result<Self> { in parse_mod_style()
606 return Err(input.error("expected path segment after `::`")); in parse_mod_style()
613 pub(crate) fn parse_helper(input: ParseStream, expr_style: bool) -> Result<Self> { in parse_helper()
631 ) -> Result<()> { in parse_rest()
641 pub(crate) fn is_mod_style(&self) -> bool { in is_mod_style()
644 .all(|segment| segment.arguments.is_none()) in is_mod_style()
648 pub(crate) fn qpath(input: ParseStream, expr_style: bool) -> Result<(Option<QSelf>, Path)> { in qpath()
726 fn clone(&self) -> Self { in clone()
740 for segment in path.segments.pairs() { in print_path()
741 print_path_segment(tokens, segment.value(), style); in print_path()
742 segment.punct().to_tokens(tokens); in print_path()
753 fn print_path_segment(tokens: &mut TokenStream, segment: &PathSegment, style: PathStyle) { in print_path_segment()
754 segment.ident.to_tokens(tokens); in print_path_segment()
755 print_path_arguments(tokens, &segment.arguments, style); in print_path_segment()
923 for (i, segment) in segments.by_ref().take(pos).enumerate() { in print_qpath()
924 print_path_segment(tokens, segment.value(), PathStyle::AsWritten); in print_qpath()
925 if i + 1 == pos { in print_qpath()
928 segment.punct().to_tokens(tokens); in print_qpath()
934 for segment in segments { in print_qpath()
935 print_path_segment(tokens, segment.value(), style); in print_qpath()
936 segment.punct().to_tokens(tokens); in print_qpath()
955 fn span(&self) -> Span { in span()
956 struct QSelfDelimiters<'a>(&'a QSelf); in span()
958 impl<'a> ToTokens for QSelfDelimiters<'a> { in span()