rust/syn/attr.rs
Source file repositories/reference/linux-study-clean/rust/syn/attr.rs
File Facts
- System
- Linux kernel
- Corpus path
rust/syn/attr.rs- Extension
.rs- Size
- 28406 bytes
- Lines
- 839
- Domain
- Rust Kernel Layer
- Bucket
- Rust API Membrane
- Inferred role
- Rust Kernel Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
Rust-side wrappers and abstractions around kernel C APIs, ownership contracts, allocation, synchronization, and module integration.
- Rust-side wrappers and abstractions around kernel C APIs, ownership contracts, allocation, synchronization, and module integration.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
function pubfunction parse_meta_name_value_after_pathfunction Okfunction fmtfunction to_tokensfunction to_tokensfunction to_tokens
Annotated Snippet
for (i, segment) in self.0.segments.iter().enumerate() {
if i > 0 || self.0.leading_colon.is_some() {
formatter.write_str("::")?;
}
write!(formatter, "{}", segment.ident)?;
}
Ok(())
}
}
}
#[cfg(feature = "printing")]
mod printing {
use crate::attr::{AttrStyle, Attribute, Meta, MetaList, MetaNameValue};
use crate::path;
use crate::path::printing::PathStyle;
use proc_macro2::TokenStream;
use quote::ToTokens;
#[cfg_attr(docsrs, doc(cfg(feature = "printing")))]
impl ToTokens for Attribute {
fn to_tokens(&self, tokens: &mut TokenStream) {
self.pound_token.to_tokens(tokens);
if let AttrStyle::Inner(b) = &self.style {
b.to_tokens(tokens);
}
self.bracket_token.surround(tokens, |tokens| {
self.meta.to_tokens(tokens);
});
}
}
#[cfg_attr(docsrs, doc(cfg(feature = "printing")))]
impl ToTokens for Meta {
fn to_tokens(&self, tokens: &mut TokenStream) {
match self {
Meta::Path(path) => path::printing::print_path(tokens, path, PathStyle::Mod),
Meta::List(meta_list) => meta_list.to_tokens(tokens),
Meta::NameValue(meta_name_value) => meta_name_value.to_tokens(tokens),
}
}
}
#[cfg_attr(docsrs, doc(cfg(feature = "printing")))]
impl ToTokens for MetaList {
fn to_tokens(&self, tokens: &mut TokenStream) {
path::printing::print_path(tokens, &self.path, PathStyle::Mod);
self.delimiter.surround(tokens, self.tokens.clone());
}
}
#[cfg_attr(docsrs, doc(cfg(feature = "printing")))]
impl ToTokens for MetaNameValue {
fn to_tokens(&self, tokens: &mut TokenStream) {
path::printing::print_path(tokens, &self.path, PathStyle::Mod);
self.eq_token.to_tokens(tokens);
self.value.to_tokens(tokens);
}
}
}
Annotation
- Detected declarations: `function pub`, `function parse_meta_name_value_after_path`, `function Ok`, `function fmt`, `function to_tokens`, `function to_tokens`, `function to_tokens`.
- Atlas domain: Rust Kernel Layer / Rust API Membrane.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.