Home / Function/ get() — tailwindcss Function Reference

get() — tailwindcss Function Reference

Architecture documentation for the get() function in utf16.rs from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  5a977327_5735_65ab_07a9_349764828b1f["get()"]
  7a49803e_c498_1a8f_e430_3827f8691042["utf16.rs"]
  5a977327_5735_65ab_07a9_349764828b1f -->|defined in| 7a49803e_c498_1a8f_e430_3827f8691042
  99252edc_4d96_1ae5_eeef_e49071ff7a8e["test_index_converter()"]
  99252edc_4d96_1ae5_eeef_e49071ff7a8e -->|calls| 5a977327_5735_65ab_07a9_349764828b1f
  style 5a977327_5735_65ab_07a9_349764828b1f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

crates/node/src/utf16.rs lines 19–46

  pub fn get(&mut self, pos: usize) -> i64 {
    #[cfg(debug_assertions)]
    if self.curr_utf8 > self.input.len() {
      panic!("curr_utf8 points past the end of the input string");
    }

    if pos < self.curr_utf8 {
      self.curr_utf8 = 0;
      self.curr_utf16 = 0;
    }

    // SAFETY: No matter what `pos` is passed into this function `curr_utf8`
    // will only ever be incremented up to the length of the input string.
    //
    // This eliminates a "potential" panic that cannot actually happen
    let slice = unsafe { self.input.get_unchecked(self.curr_utf8..) };

    for c in slice.chars() {
      if self.curr_utf8 >= pos {
        break;
      }

      self.curr_utf8 += c.len_utf8();
      self.curr_utf16 += c.len_utf16();
    }

    self.curr_utf16 as i64
  }

Domain

Subdomains

Frequently Asked Questions

What does get() do?
get() is a function in the tailwindcss codebase, defined in crates/node/src/utf16.rs.
Where is get() defined?
get() is defined in crates/node/src/utf16.rs at line 19.
What calls get()?
get() is called by 1 function(s): test_index_converter.

Analyze Your Own Codebase

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

Try Supermodel Free