Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I edit Cargo.toml in order to include resource files in my Cargo package?

I want to bundle a word list in plain text format with my Cargo package. Can I edit Cargo.toml in order to do this?

If I used npm, I would add this to my package.json:

"files": ["data/my_dictionary.txt"]

I tried include but it doesn't seem to work.

Here is my Cargo.toml

[package]

name = "chamkho"
version = "0.0.2"
authors = ["Vee Satayamas <[email protected]>"]
test = true
description = "Thai word segmentation/breaking library and command line"
documentation = "https://github.com/veer66/chamkho/blob/master/README.md"
homepage = "https://github.com/veer66/chamkho/"
repository = "https://github.com/veer66/chamkho.git"
readme = "README.md"
keywords = ["text", "nlp", "thai", "library"]
license = "BSD-2-Clause"
include = ["**/*.txt", "**/*.rs","Cargo.toml"]

[[bin]]
name = "wordcut"
path = "src/cli.rs"

This is the output of cargo package -l

Cargo.toml
src/acc.rs
src/cli.rs
src/dict.rs
src/edge.rs
src/graph.rs
src/graph_builder.rs
src/lib.rs
src/space_acc.rs
src/wordcut.rs
tests/wordcut.rs
like image 312
Vee Satayamas Avatar asked Mar 24 '15 10:03

Vee Satayamas


1 Answers

I believe include = ["data/my_dictionary.txt"] should work.

(I opened a PR adding this to the documentation.)

like image 118
huon Avatar answered Oct 16 '22 11:10

huon