Home / Function/ run_one() — tailwindcss Function Reference

run_one() — tailwindcss Function Reference

Architecture documentation for the run_one() function in walk.rs from the tailwindcss codebase.

Function rust RustCore FileScanner calls 11 called by 1

Entity Profile

Dependency Diagram

graph TD
  cd9c919e_b7b4_e9fa_afba_bda77720d4a4["run_one()"]
  6cbc30c7_baf4_49d4_18b1_08a16e4fe724["run()"]
  6cbc30c7_baf4_49d4_18b1_08a16e4fe724 -->|calls| cd9c919e_b7b4_e9fa_afba_bda77720d4a4
  2d1043b4_619e_f9a7_faf3_ee4e1cdbb69f["generate_work()"]
  cd9c919e_b7b4_e9fa_afba_bda77720d4a4 -->|calls| 2d1043b4_619e_f9a7_faf3_ee4e1cdbb69f
  6635a1ff_d67d_40df_1cc3_51c7debc3b01["is_symlink()"]
  cd9c919e_b7b4_e9fa_afba_bda77720d4a4 -->|calls| 6635a1ff_d67d_40df_1cc3_51c7debc3b01
  53c4c04f_8ea8_89d6_9869_cc927b86c4b9["add_parents()"]
  cd9c919e_b7b4_e9fa_afba_bda77720d4a4 -->|calls| 53c4c04f_8ea8_89d6_9869_cc927b86c4b9
  96663802_3a52_10d7_ed0f_14b4a337d307["is_quit()"]
  cd9c919e_b7b4_e9fa_afba_bda77720d4a4 -->|calls| 96663802_3a52_10d7_ed0f_14b4a337d307
  9327d1c5_ea61_7af1_f09f_802c01900770["is_same_file_system()"]
  cd9c919e_b7b4_e9fa_afba_bda77720d4a4 -->|calls| 9327d1c5_ea61_7af1_f09f_802c01900770
  711131a2_def6_b05a_eec6_7d8ffa512bd3["read_dir()"]
  cd9c919e_b7b4_e9fa_afba_bda77720d4a4 -->|calls| 711131a2_def6_b05a_eec6_7d8ffa512bd3
  b8d22d7e_26f7_39f3_dace_fa5816b57694["is_continue()"]
  cd9c919e_b7b4_e9fa_afba_bda77720d4a4 -->|calls| b8d22d7e_26f7_39f3_dace_fa5816b57694
  8e317b24_544c_86ea_6c34_a553bcd66719["visit()"]
  cd9c919e_b7b4_e9fa_afba_bda77720d4a4 -->|calls| 8e317b24_544c_86ea_6c34_a553bcd66719
  8dcded00_73b5_510f_35e9_d6a8a17b3f61["depth()"]
  cd9c919e_b7b4_e9fa_afba_bda77720d4a4 -->|calls| 8dcded00_73b5_510f_35e9_d6a8a17b3f61
  80ab0f00_c359_5714_9ef3_3d3b7412e1d6["is_dir()"]
  cd9c919e_b7b4_e9fa_afba_bda77720d4a4 -->|calls| 80ab0f00_c359_5714_9ef3_3d3b7412e1d6
  afe9c39f_a243_0367_bdf6_a556fadd6383["path()"]
  cd9c919e_b7b4_e9fa_afba_bda77720d4a4 -->|calls| afe9c39f_a243_0367_bdf6_a556fadd6383
  style cd9c919e_b7b4_e9fa_afba_bda77720d4a4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

crates/ignore/src/walk.rs lines 1627–1700

    fn run_one(&mut self, mut work: Work) -> WalkState {
        let should_visit = self
            .min_depth
            .map(|min_depth| work.dent.depth() >= min_depth)
            .unwrap_or(true);

        // If the work is not a directory, then we can just execute the
        // caller's callback immediately and move on.
        if work.is_symlink() || !work.is_dir() {
            return if should_visit {
                self.visitor.visit(Ok(work.dent))
            } else {
                WalkState::Continue
            };
        }
        if let Some(err) = work.add_parents() {
            let state = self.visitor.visit(Err(err));
            if state.is_quit() {
                return state;
            }
        }

        let descend = if let Some(root_device) = work.root_device {
            match is_same_file_system(root_device, work.dent.path()) {
                Ok(true) => true,
                Ok(false) => false,
                Err(err) => {
                    let state = self.visitor.visit(Err(err));
                    if state.is_quit() {
                        return state;
                    }
                    false
                }
            }
        } else {
            true
        };

        // Try to read the directory first before we transfer ownership
        // to the provided closure. Do not unwrap it immediately, though,
        // as we may receive an `Err` value e.g. in the case when we do not
        // have sufficient read permissions to list the directory.
        // In that case we still want to provide the closure with a valid
        // entry before passing the error value.
        let readdir = work.read_dir();
        let depth = work.dent.depth();
        if should_visit {
            let state = self.visitor.visit(Ok(work.dent));
            if !state.is_continue() {
                return state;
            }
        }
        if !descend {
            return WalkState::Skip;
        }

        let readdir = match readdir {
            Ok(readdir) => readdir,
            Err(err) => {
                return self.visitor.visit(Err(err));
            }
        };

        if self.max_depth.map_or(false, |max| depth >= max) {
            return WalkState::Skip;
        }
        for result in readdir {
            let state = self.generate_work(&work.ignore, depth + 1, work.root_device, result);
            if state.is_quit() {
                return state;
            }
        }
        WalkState::Continue
    }

Domain

Subdomains

Called By

Frequently Asked Questions

What does run_one() do?
run_one() is a function in the tailwindcss codebase.
What does run_one() call?
run_one() calls 11 function(s): add_parents, depth, generate_work, is_continue, is_dir, is_quit, is_same_file_system, is_symlink, and 3 more.
What calls run_one()?
run_one() is called by 1 function(s): run.

Analyze Your Own Codebase

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

Try Supermodel Free