Home / File/ walk.rs — tailwindcss Source File

walk.rs — tailwindcss Source File

Architecture documentation for walk.rs, a rust file in the tailwindcss codebase. 2 imports, 0 dependents.

File rust OxideEngine PreProcessors 2 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  56be66cb_5590_b90e_770f_a1ed468a4478["walk.rs"]
  148a0379_62c6_86e3_d9b3_de1fdebd7cfb["std::"]
  56be66cb_5590_b90e_770f_a1ed468a4478 --> 148a0379_62c6_86e3_d9b3_de1fdebd7cfb
  6dc6ce2c_e641_2a89_70ea_1ea20ff3ba5f["ignore::WalkState::*"]
  56be66cb_5590_b90e_770f_a1ed468a4478 --> 6dc6ce2c_e641_2a89_70ea_1ea20ff3ba5f
  style 56be66cb_5590_b90e_770f_a1ed468a4478 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

use std::{env, io::Write, path::Path};

use {bstr::ByteVec, ignore::WalkBuilder, walkdir::WalkDir};

fn main() {
    let mut path = env::args().nth(1).unwrap();
    let mut parallel = false;
    let mut simple = false;
    let (tx, rx) = crossbeam_channel::bounded::<DirEntry>(100);
    if path == "parallel" {
        path = env::args().nth(2).unwrap();
        parallel = true;
    } else if path == "walkdir" {
        path = env::args().nth(2).unwrap();
        simple = true;
    }

    let stdout_thread = std::thread::spawn(move || {
        let mut stdout = std::io::BufWriter::new(std::io::stdout());
        for dent in rx {
            stdout
                .write_all(&Vec::from_path_lossy(dent.path()))
                .unwrap();
            stdout.write_all(b"\n").unwrap();
        }
    });

    if parallel {
        let walker = WalkBuilder::new(path).threads(6).build_parallel();
        walker.run(|| {
            let tx = tx.clone();
            Box::new(move |result| {
                use ignore::WalkState::*;

                tx.send(DirEntry::Y(result.unwrap())).unwrap();
                Continue
            })
        });
    } else if simple {
        let walker = WalkDir::new(path);
        for result in walker {
            tx.send(DirEntry::X(result.unwrap())).unwrap();
        }
    } else {
        let walker = WalkBuilder::new(path).build();
        for result in walker {
            tx.send(DirEntry::Y(result.unwrap())).unwrap();
        }
    }
    drop(tx);
    stdout_thread.join().unwrap();
}

enum DirEntry {
    X(walkdir::DirEntry),
    Y(ignore::DirEntry),
}

impl DirEntry {
    fn path(&self) -> &Path {
        match *self {
            DirEntry::X(ref x) => x.path(),
            DirEntry::Y(ref y) => y.path(),
        }
    }
}

Domain

Subdomains

Functions

Dependencies

  • ignore::WalkState::*
  • std::

Frequently Asked Questions

What does walk.rs do?
walk.rs is a source file in the tailwindcss codebase, written in rust. It belongs to the OxideEngine domain, PreProcessors subdomain.
What functions are defined in walk.rs?
walk.rs defines 2 function(s): main, path.
What does walk.rs depend on?
walk.rs imports 2 module(s): ignore::WalkState::*, std::.
Where is walk.rs in the architecture?
walk.rs is located at crates/ignore/examples/walk.rs (domain: OxideEngine, subdomain: PreProcessors, directory: crates/ignore/examples).

Analyze Your Own Codebase

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

Try Supermodel Free