How can I build multiple binaries with Cargo?

You can specify multiple binaries using [[bin]], as mentioned here: [[bin]] name = “daemon” path = “src/daemon/bin/main.rs” [[bin]] name = “client” path = “src/client/bin/main.rs” Tip: If you instead put these files in src/bin/daemon.rs and src/bin/client.rs, you’ll get two executables named daemon and client as Cargo compiles all files in src/bin into executables with the same … Read more

Why are Rust executables so huge?

Rust uses static linking to compile its programs, meaning that all libraries required by even the simplest Hello world! program will be compiled into your executable. This also includes the Rust runtime. To force Rust to dynamically link programs, use the command-line arguments -C prefer-dynamic; this will result in a much smaller file size but … Read more

Package with both a library and a binary?

Tok:tmp doug$ du -a 8 ./Cargo.toml 8 ./src/bin.rs 8 ./src/lib.rs 16 ./src Cargo.toml: [package] name = “mything” version = “0.0.1” authors = [“me <me@gmail.com>”] [lib] name = “mylib” path = “src/lib.rs” [[bin]] name = “mybin” path = “src/bin.rs” src/lib.rs: pub fn test() { println!(“Test”); } src/bin.rs: extern crate mylib; // not needed since Rust edition … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)