Home / Function/ parse_bytes_range_attr() — tailwindcss Function Reference

parse_bytes_range_attr() — tailwindcss Function Reference

Architecture documentation for the parse_bytes_range_attr() function in lib.rs from the tailwindcss codebase.

Function rust RustCore PreProcessors calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  df7ccd48_268b_9495_004b_935c488749c1["parse_bytes_range_attr()"]
  5696625c_468d_406d_a9d6_9a75e1d48cda["get_bytes_range_attrs()"]
  5696625c_468d_406d_a9d6_9a75e1d48cda -->|calls| df7ccd48_268b_9495_004b_935c488749c1
  fae00d83_31e1_2fb8_e313_50f861480787["extract_byte_literal()"]
  df7ccd48_268b_9495_004b_935c488749c1 -->|calls| fae00d83_31e1_2fb8_e313_50f861480787
  style df7ccd48_268b_9495_004b_935c488749c1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

crates/classification-macros/src/lib.rs lines 178–217

fn parse_bytes_range_attr(attr: &Attribute) -> Result<Vec<u8>> {
    // We'll parse each element as a syn::Expr, then see if it's an Expr::Range
    let exprs: Punctuated<Expr, Comma> = attr.parse_args_with(Punctuated::parse_terminated)?;
    let mut out = Vec::new();

    for expr in exprs {
        if let Expr::Range(ExprRange {
            start: Some(start),
            end: Some(end),
            limits,
            ..
        }) = expr
        {
            let from = extract_byte_literal(&start)?;
            let to = extract_byte_literal(&end)?;

            match limits {
                RangeLimits::Closed(_) => {
                    // b'a'..=b'z'
                    if from <= to {
                        out.extend(from..=to);
                    }
                }
                RangeLimits::HalfOpen(_) => {
                    // b'a'..b'z'  => from..(to-1)
                    if from < to {
                        out.extend(from..to);
                    }
                }
            }
        } else {
            return Err(syn::Error::new_spanned(
                expr,
                "Expected a byte range like b'a'..=b'z'",
            ));
        }
    }

    Ok(out)
}

Domain

Subdomains

Frequently Asked Questions

What does parse_bytes_range_attr() do?
parse_bytes_range_attr() is a function in the tailwindcss codebase.
What does parse_bytes_range_attr() call?
parse_bytes_range_attr() calls 1 function(s): extract_byte_literal.
What calls parse_bytes_range_attr()?
parse_bytes_range_attr() is called by 1 function(s): get_bytes_range_attrs.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free