extract_byte_literal() — tailwindcss Function Reference
Architecture documentation for the extract_byte_literal() function in lib.rs from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD fae00d83_31e1_2fb8_e313_50f861480787["extract_byte_literal()"] df7ccd48_268b_9495_004b_935c488749c1["parse_bytes_range_attr()"] df7ccd48_268b_9495_004b_935c488749c1 -->|calls| fae00d83_31e1_2fb8_e313_50f861480787 style fae00d83_31e1_2fb8_e313_50f861480787 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
crates/classification-macros/src/lib.rs lines 223–253
fn extract_byte_literal(expr: &Expr) -> Result<u8> {
if let Expr::Lit(ExprLit { lit, .. }) = expr {
match lit {
// Existing case: b'a'
Lit::Byte(lb) => Ok(lb.value()),
// New case: 0x80, 255, etc.
Lit::Int(li) => {
let value = li.base10_parse::<u64>()?;
if value <= 255 {
Ok(value as u8)
} else {
Err(syn::Error::new_spanned(
li,
format!("Integer literal {} out of range for a byte (0..255)", value),
))
}
}
_ => Err(syn::Error::new_spanned(
lit,
"Expected b'...' or an integer literal in range 0..=255",
)),
}
} else {
Err(syn::Error::new_spanned(
expr,
"Expected a literal expression like b'a' or 0x80",
))
}
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does extract_byte_literal() do?
extract_byte_literal() is a function in the tailwindcss codebase.
What calls extract_byte_literal()?
extract_byte_literal() is called by 1 function(s): parse_bytes_range_attr.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free