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 OxideEngine PreProcessors calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  18f30421_7610_6ae0_6a56_553dc8898b5a["parse_bytes_range_attr()"]
  8866d709_3b59_d730_edfc_80aef369b653["lib.rs"]
  18f30421_7610_6ae0_6a56_553dc8898b5a -->|defined in| 8866d709_3b59_d730_edfc_80aef369b653
  07ac266e_f8b4_f731_cd1b_5199f8df45fe["get_bytes_range_attrs()"]
  07ac266e_f8b4_f731_cd1b_5199f8df45fe -->|calls| 18f30421_7610_6ae0_6a56_553dc8898b5a
  58347e2c_ad9f_c27f_d1a3_2cfee8346de2["extract_byte_literal()"]
  18f30421_7610_6ae0_6a56_553dc8898b5a -->|calls| 58347e2c_ad9f_c27f_d1a3_2cfee8346de2
  style 18f30421_7610_6ae0_6a56_553dc8898b5a 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, defined in crates/classification-macros/src/lib.rs.
Where is parse_bytes_range_attr() defined?
parse_bytes_range_attr() is defined in crates/classification-macros/src/lib.rs at line 178.
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