如何编辑 Cargo.toml 以便将资源文件包含在我的 Cargo 包中?
How can I edit Cargo.toml in order to include resource files in my Cargo package?
我想将纯文本格式的单词列表与我的 Cargo 包裹捆绑在一起。我可以编辑 Cargo.toml 来执行此操作吗?
如果我使用 npm,我会将其添加到我的 package.json:
"files": ["data/my_dictionary.txt"]
我试过了include
,但好像不行。
这是我的Cargo.toml
[package]
name = "chamkho"
version = "0.0.2"
authors = ["Vee Satayamas <vsatayamas@gmail.com>"]
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"
这是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
我相信 include = ["data/my_dictionary.txt"]
应该有效。
(我 opened a PR 将此添加到文档中。)
我想将纯文本格式的单词列表与我的 Cargo 包裹捆绑在一起。我可以编辑 Cargo.toml 来执行此操作吗?
如果我使用 npm,我会将其添加到我的 package.json:
"files": ["data/my_dictionary.txt"]
我试过了include
,但好像不行。
这是我的Cargo.toml
[package]
name = "chamkho"
version = "0.0.2"
authors = ["Vee Satayamas <vsatayamas@gmail.com>"]
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"
这是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
我相信 include = ["data/my_dictionary.txt"]
应该有效。
(我 opened a PR 将此添加到文档中。)