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
  b4753452_877e_045a_5e9b_0da9561dcac2["get()"]
  c2b05b39_1e20_1ddb_5798_731d42025ea5["get_candidates_with_positions()"]
  c2b05b39_1e20_1ddb_5798_731d42025ea5 -->|calls| b4753452_877e_045a_5e9b_0da9561dcac2
  0822fa3b_6259_ceef_ed75_0bf76e6f3126["test_index_converter()"]
  0822fa3b_6259_ceef_ed75_0bf76e6f3126 -->|calls| b4753452_877e_045a_5e9b_0da9561dcac2
  style b4753452_877e_045a_5e9b_0da9561dcac2 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.
What calls get()?
get() is called by 2 function(s): get_candidates_with_positions, test_index_converter.

Analyze Your Own Codebase

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

Try Supermodel Free