bracket_stack.rs — tailwindcss Source File
Architecture documentation for bracket_stack.rs, a rust file in the tailwindcss codebase.
Entity Profile
Relationship Graph
Source Code
const SIZE: usize = 32;
#[repr(C)]
#[derive(Debug, Default)]
pub struct BracketStack {
/// Bracket stack to ensure properly balanced brackets.
bracket_stack: [u8; SIZE],
bracket_stack_len: usize,
}
impl BracketStack {
#[inline(always)]
pub fn is_empty(&self) -> bool {
self.bracket_stack_len == 0
}
#[inline(always)]
pub fn push(&mut self, bracket: u8) -> bool {
if self.bracket_stack_len >= SIZE {
return false;
}
unsafe {
*self.bracket_stack.get_unchecked_mut(self.bracket_stack_len) = match bracket {
b'(' => b')',
b'[' => b']',
b'{' => b'}',
_ => std::hint::unreachable_unchecked(),
};
}
self.bracket_stack_len += 1;
true
}
#[inline(always)]
pub fn pop(&mut self, bracket: u8) -> bool {
if self.bracket_stack_len == 0 {
return false;
}
self.bracket_stack_len -= 1;
unsafe {
if *self.bracket_stack.get_unchecked(self.bracket_stack_len) != bracket {
return false;
}
}
true
}
#[inline(always)]
pub fn reset(&mut self) {
self.bracket_stack_len = 0;
}
}
Domain
Subdomains
Functions
Source
Frequently Asked Questions
What does bracket_stack.rs do?
bracket_stack.rs is a source file in the tailwindcss codebase, written in rust. It belongs to the OxideEngine domain, Extractor subdomain.
What functions are defined in bracket_stack.rs?
bracket_stack.rs defines 4 function(s): is_empty, pop, push, reset.
Where is bracket_stack.rs in the architecture?
bracket_stack.rs is located at crates/oxide/src/extractor/bracket_stack.rs (domain: OxideEngine, subdomain: Extractor, directory: crates/oxide/src/extractor).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free