5 ms·
`cargo tree` output: tere v1.0.0 ├── clap v3.0.10 │ ├── bitflags v1.3.2 │ ├── indexmap v1.8.0 │ │ └── hashbrown v0.11.2 │ │ [build-depe
by chrismorgan 4y ago
`cargo tree` output:
tere v1.0.0
├── clap v3.0.10
│ ├── bitflags v1.3.2
│ ├── indexmap v1.8.0
│ │ └── hashbrown v0.11.2
│ │ [build-dependencies]
│ │ └── autocfg v1.1.0
│ ├── os_str_bytes v6.0.0
│ │ └── memchr v2.4.1
│ ├── strsim v0.10.0
│ ├── terminal_size v0.1.17
│ │ └── libc v0.2.126
│ └── textwrap v0.14.2
│ ├── smawk v0.3.1
│ ├── terminal_size v0.1.17 (*)
│ ├── unicode-linebreak v0.1.2
│ │ [build-dependencies]
│ │ └── regex v1.5.4
│ │ ├── aho-corasick v0.7.18
│ │ │ └── memchr v2.4.1
│ │ ├── memchr v2.4.1
│ │ └── regex-syntax v0.6.25
│ └── unicode-width v0.1.9
├── crossterm v0.24.0
│ ├── bitflags v1.3.2
│ ├── libc v0.2.126
│ ├── mio v0.8.4
│ │ ├── libc v0.2.126
│ │ └── log v0.4.14
│ │ └── cfg-if v1.0.0
│ ├── parking_lot v0.12.1
│ │ ├── lock_api v0.4.7
│ │ │ └── scopeguard v1.1.0
│ │ │ [build-dependencies]
│ │ │ └── autocfg v1.1.0
│ │ └── parking_lot_core v0.9.3
│ │ ├── cfg-if v1.0.0
│ │ ├── libc v0.2.126
│ │ └── smallvec v1.8.0
│ ├── signal-hook v0.3.13
│ │ ├── libc v0.2.126
│ │ └── signal-hook-registry v1.4.0
│ │ └── libc v0.2.126
│ └── signal-hook-mio v0.2.3
│ ├── libc v0.2.126
│ ├── mio v0.8.4 (*)
│ └── signal-hook v0.3.13 (*)
├── dirs v4.0.0
│ └── dirs-sys v0.3.6
│ └── libc v0.2.126
├── regex v1.5.4 (*)
├── serde v1.0.134
├── serde_json v1.0.75
│ ├── itoa v1.0.1
│ ├── ryu v1.0.9
│ └── serde v1.0.134
├── textwrap v0.14.2 (*)
└── unicode-segmentation v1.8.0
I can easily look at each one of these and understand why it’s there, save only a few: most of crossterm’s recursive dependencies, which are fairly involved but the immediate dependencies at least are clearly explained in its README (and you could probably remove one or two of them at minor performance or similar costs); mio’s use of log, which I believe should be optional and I would say not enabled by default, but I’d rather use it with log than miss out on it, where it’s useful; uses of autocfg, which are build-time implementation detail for taking advantage of rustc features where available and readily understood on analysis; and I was going to say cfg-if, which I have a minor personal vendetta against due to extensive unnecessary use, but after looking at parking_lot_core’s src/thread_parker/mod.rs I will begrudgingly admit this is one of the rare cases where it is fairly well-justified. All up, none of the dependencies are in any way unreasonable.
Having over fifty dependencies for something like this is not in any way terrifying—you’re just starting with a different set of expectations and understandings of how things are done. It’s a natural and reasonable outworking of (a) using the right tools for the job, (b) doing things properly rather than half-heartedly (most obviously where terminal interactions are involved), and (c) Rust’s deliberately thin standard library.
- reaperducer 4y agohashbrown, smawk, corasick, parking_lot, itoa, ryu Writing in Rust looks like casting spells in an Infocom game. Gnusto rezrov!
- mynameisvlad 4y agoReally? itoa is one of your "magic incantations"? https://en.m.wikibooks.org/wiki/C_Programming/stdlib.h/itoa https://en.m.wikibooks.org/wiki/C_Programming/stdlib.h/itoa I get the others, but that ones a pretty standard type converter, the opposite of the C standard atoi
- mgunyho 4y agoAlso, aho-corasick comes from the name of this algorithm that is named after its inventors https://en.wikipedia.org/wiki/Aho%E2%80%93Corasick_algorithm https://en.wikipedia.org/wiki/Aho%E2%80%93Corasick_algorithm
- enriquto 4y agoWhat is the point of this function? In rust, there's no equivalent to sprintf?
- mynameisvlad 4y agohttps://doc.rust-lang.org/std/fmt/ https://doc.rust-lang.org/std/fmt/ Different tools for the same job. One is explicitly integer to string conversion the other is sting formatting. You can technically use the latter, but some prefer a function which explicitly does one thing and one thing only.
- pie_flavor 4y agoMore accurately, some prefer a function that is statically dispatched and does not talk to std::fmt::Formatter.
- MichaelCollins 4y ago