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.

Entity Profile

Dependency Diagram

graph TD
  e63c9a61_c0eb_fc8e_2a92_ab9b1af2a4db["run_one()"]
  daea13be_da9d_f3dd_7f4f_74a78b7b3852["run()"]
  daea13be_da9d_f3dd_7f4f_74a78b7b3852 -->|calls| e63c9a61_c0eb_fc8e_2a92_ab9b1af2a4db
  83e9692c_0ef1_97e5_4b56_90182cf80c7a["generate_work()"]
  e63c9a61_c0eb_fc8e_2a92_ab9b1af2a4db -->|calls| 83e9692c_0ef1_97e5_4b56_90182cf80c7a
  a102b557_0cc7_5c4e_042f_24149898e7c2["is_symlink()"]
  e63c9a61_c0eb_fc8e_2a92_ab9b1af2a4db -->|calls| a102b557_0cc7_5c4e_042f_24149898e7c2
  e611aa38_0264_a87e_bc57_816638dacc44["add_parents()"]
  e63c9a61_c0eb_fc8e_2a92_ab9b1af2a4db -->|calls| e611aa38_0264_a87e_bc57_816638dacc44
  ad2e15fc_c5af_84a3_2d6a_26dcd054ddb3["is_quit()"]
  e63c9a61_c0eb_fc8e_2a92_ab9b1af2a4db -->|calls| ad2e15fc_c5af_84a3_2d6a_26dcd054ddb3
  900bf189_45c7_1d02_5a54_338ff13e9f9b["is_same_file_system()"]
  e63c9a61_c0eb_fc8e_2a92_ab9b1af2a4db -->|calls| 900bf189_45c7_1d02_5a54_338ff13e9f9b
  d16b5ee3_02a3_92c2_a820_d7fe222d6187["read_dir()"]
  e63c9a61_c0eb_fc8e_2a92_ab9b1af2a4db -->|calls| d16b5ee3_02a3_92c2_a820_d7fe222d6187
  c24e0682_9c1e_ec4f_1f9e_0b6964d08ad5["is_continue()"]
  e63c9a61_c0eb_fc8e_2a92_ab9b1af2a4db -->|calls| c24e0682_9c1e_ec4f_1f9e_0b6964d08ad5
  bd2e8909_e461_841f_0d61_4a0d1fd86cf5["visit()"]
  e63c9a61_c0eb_fc8e_2a92_ab9b1af2a4db -->|calls| bd2e8909_e461_841f_0d61_4a0d1fd86cf5
  ecfbe11b_c0ec_34f3_c4ec_11d8f76efb9e["depth()"]
  e63c9a61_c0eb_fc8e_2a92_ab9b1af2a4db -->|calls| ecfbe11b_c0ec_34f3_c4ec_11d8f76efb9e
  cc9ec348_9694_a24e_6a35_4ffb4c641398["is_dir()"]
  e63c9a61_c0eb_fc8e_2a92_ab9b1af2a4db -->|calls| cc9ec348_9694_a24e_6a35_4ffb4c641398
  22e554e0_3279_5bba_cd5c_45aa591685d1["path()"]
  e63c9a61_c0eb_fc8e_2a92_ab9b1af2a4db -->|calls| 22e554e0_3279_5bba_cd5c_45aa591685d1
  style e63c9a61_c0eb_fc8e_2a92_ab9b1af2a4db 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
    }

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