Lines Matching refs:path
37 /// Every attribute has a `path` that indicates the intended interpretation
38 /// of the rest of the attribute's contents. The path and the optional
43 /// path, for example the `#[test]` attribute.
46 /// path, surrounded by a delimiter (parenthesis, bracket, or brace). For
49 /// - Meta::NameValue — attributes with an `=` sign after the path,
50 /// followed by a Rust expression. For example `#[path =
53 /// All doc comments are represented in the NameValue style with a path of
62 /// #[path = "sys/windows.rs"]
90 /// // #[path = "s.tmpl"]
118 /// TokenStream`. Macros are expected to check the `path` of the attribute,
174 /// Returns the path that identifies the interpretation of this attribute.
177 /// `#[derive(Copy)]`, and the `path` in `#[path = "sys/windows.rs"]`.
178 pub fn path(&self) -> &Path {
179 self.meta.path()
206 /// if attr.path().is_ident("precondition") {
239 Meta::Path(path) => Err(crate::error::new2(
240 path.segments.first().unwrap().ident.span(),
241 path.segments.last().unwrap().ident.span(),
245 parsing::DisplayPath(path),
253 parsing::DisplayPath(&meta.path),
288 /// if attr.path().is_ident("repr") {
291 /// if meta.path.is_ident("C") {
297 /// if meta.path.is_ident("transparent") {
303 /// if meta.path.is_ident("align") {
313 /// if meta.path.is_ident("packed") {
354 /// if attr.path().is_ident("repr") {
359 /// Meta::Path(path) if path.is_ident("C") => {
364 /// Meta::List(meta) if meta.path.is_ident("align") => {
448 /// A meta path is like the `test` in `#[test]`.
456 /// A name-value meta is like the `path = "..."` in `#[path =
480 pub path: Path,
490 pub path: Path,
497 /// Returns the path that begins this structured meta item.
500 /// `#[derive(Copy)]`, and the `path` in `#[path = "sys/windows.rs"]`.
501 pub fn path(&self) -> &Path {
503 Meta::Path(path) => path,
504 Meta::List(meta) => &meta.path,
505 Meta::NameValue(meta) => &meta.path,
514 Meta::Path(path) => return Ok(path),
527 Meta::Path(path) => Err(crate::error::new2(
528 path.segments.first().unwrap().ident.span(),
529 path.segments.last().unwrap().ident.span(),
532 parsing::DisplayPath(path),
545 Meta::Path(path) => Err(crate::error::new2(
546 path.segments.first().unwrap().ident.span(),
547 path.segments.last().unwrap().ident.span(),
550 parsing::DisplayPath(path),
653 let path = input.call(Path::parse_mod_style)?;
654 parse_meta_after_path(path, input)
661 let path = input.call(Path::parse_mod_style)?;
662 parse_meta_list_after_path(path, input)
669 let path = input.call(Path::parse_mod_style)?;
670 parse_meta_name_value_after_path(path, input)
674 pub(crate) fn parse_meta_after_path(path: Path, input: ParseStream) -> Result<Meta> {
676 parse_meta_list_after_path(path, input).map(Meta::List)
678 parse_meta_name_value_after_path(path, input).map(Meta::NameValue)
680 Ok(Meta::Path(path))
684 fn parse_meta_list_after_path(path: Path, input: ParseStream) -> Result<MetaList> {
687 path,
693 fn parse_meta_name_value_after_path(path: Path, input: ParseStream) -> Result<MetaNameValue> {
709 path,
763 self.path.to_tokens(tokens);
771 self.path.to_tokens(tokens);