Here are some external web links:
Discussion at: https://fosstodon.org/@ianthetechie/114517520321760826
That's a fair question. What I found is that "types" is a bit of a scapegoat for things that have a proper place yet, similar to "utils", "shared." The types crate tends to become a dumping ground for types that don't have a fixed place yet. Code in those crates is not really "discoverable" as in: I would have to look into the crate to see what's in there and how it relates to the rest of the codebase.
For example, the standard library has a bunch of primitive types, but they all live in their own module in the core crate. The rest lives close to the supporting code, e.g. see the structs in std::process (https://doc.rust-lang.org/std/process/index.html#structs). If these structs were all in the types crate, it would make the code and the documentation a lot harder to navigate in my opinion.
| // This is an algorithm, which creates an ID for a podcast episode. | |
| // It is based on the the podcast's title, episode's title, the episode number, | |
| // the date of the episode and the episode's mp3 file name. | |
| // | |
| // All fields can change over time, but the ID should remain the same. | |
| // Think of it more like a user agent string than a unique ID: it is "unique | |
| // enough" for identifying episodes in most cases. | |
| // | |
| // It's used to identify episodes in the database. |
| [ | |
| { | |
| "data": { | |
| "search": { | |
| "userCount": 2646, | |
| "edges": [ | |
| { | |
| "node": { | |
| "login": "torvalds", | |
| "followers": { |
| fn main() { | |
| println!("{}", foo); | |
| } |
| + [pyenv:22] enable -f /usr/local/bin/../libexec/pyenv-realpath.dylib realpath | |
| + [pyenv:29] '[' -z '' ']' | |
| ++ [pyenv:31] type -p greadlink readlink | |
| ++ [pyenv:31] head -1 | |
| + [pyenv:31] READLINK=/usr/local/bin/greadlink | |
| + [pyenv:32] '[' -n /usr/local/bin/greadlink ']' | |
| + [pyenv:54] '[' -z '' ']' | |
| + [pyenv:55] PYENV_ROOT=/Users/mendler/.pyenv | |
| + [pyenv:59] export PYENV_ROOT | |
| + [pyenv:62] '[' -z '' ']' |
| #[cfg(test)] | |
| #[macro_use] | |
| extern crate proptest; | |
| extern crate chrono; | |
| use chrono::prelude::*; | |
| use std::convert::From; | |
| use std::num::ParseIntError; |
| cargo build ✘ 130 | |
| Compiling g v0.1.0 (file:///Users/mendler/Code/snippets/rust/g) | |
| Compiling gbaimg v0.1.0 (file:///Users/mendler/Code/snippets/rust/g/gbaimg) | |
| warning: unused import: `Term` | |
| --> gbaimg/src/lib.rs:8:43 | |
| | | |
| 8 | use proc_macro::{ TokenStream, TokenTree, Term }; | |
| | ^^^^ | |
| | | |
| = note: #[warn(unused_imports)] on by default |
| extern crate chrono; | |
| extern crate libc; | |
| #[macro_use] | |
| extern crate structopt; | |
| use std::fs; | |
| use std::path::PathBuf; | |
| use std::error::Error; | |
| use std::process; | |
| use std::os::unix::fs::PermissionsExt; |