I'm trying to get started by making a wasm library which also has demo binaries/webpages - but hit a roadblock in the basic project structure. I think I should use workspaces, so specific help for that is what I'm looking for, but any advice is appreciated.
So far I tried the following:
$ mkdir foo
$ cd foo
$ touch Cargo.toml
$ cargo new lib/bar --lib
$ cargo new examples/bar-demo --bin
The idea is that there will be more crates under lib/
and they can be demoed via separate example binaries (or web pages) under examples/
. Eventually they'll depend on eachother, but I'm having trouble getting started without dependencies so far.
I edited foo/Cargo.toml
to have the following:
[package]
name = "foo"
edition = '2018'
version = "0.0.1"
[workspace]
members = [
"lib/bar",
"examples/bar-demo",
]
However, running cargo build
results in the following error:
Caused by:
no targets specified in the manifest
either src/lib.rs, src/main.rs, a [lib] section, or [[bin]] section must be present
This is the same error whether I run it in foo/
, foo/lib/bar
, or foo/examples/bar-demo
Oddly - those files do exist, specifically foo/lib/bar/src/lib.rs
and foo/examples/bar-demo/src/main.rs
What am I doing wrong?