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
  ca7a86b9_1431_6b15_137c_178b800f1d57["get()"]
  e3dc7dae_8cb5_88b3_3e47_bdb509bef87d["utf16.rs"]
  ca7a86b9_1431_6b15_137c_178b800f1d57 -->|defined in| e3dc7dae_8cb5_88b3_3e47_bdb509bef87d
  3fc05603_16be_e9c7_d377_418686dbcde0["test_index_converter()"]
  3fc05603_16be_e9c7_d377_418686dbcde0 -->|calls| ca7a86b9_1431_6b15_137c_178b800f1d57
  style ca7a86b9_1431_6b15_137c_178b800f1d57 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