hello_exercism 0.3.4

how to create an own crate
docs.rs failed to build hello_exercism-0.3.4
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: hello_exercism-0.5.5

How to Create an Own Crate

I. develop the crate

Step 1: create the default crate

mkdir lib-hello && cd lib-hello
# this is Crate Root Path
cargo init --name hello_exercism --lib

Step 2: develop the crate source and test codes

  • Go to Crate Root Path
vi Cargo.toml
vi src/lib.rs
mkdir tests
touch tests/hello.rs
vi tests/hello.rs
cargo test

Step 3: develop the example codes

  • Go to Crate Root Path
mkdir examples
touch examples/hello.rs
vi examples/hello.rs
cargo run --example hello

II. use the crate 'hello_exercism'

Step 1: create the default Bin

mkdir bin-hello && cd bin-hello
# this is Bin Root Path
cargo init --name bin-hello --bin

Step 2: configure the file Cargo.toml

  • Go to Bin Root Path
echo 'hello_exercism = "0.3.1"' >> Cargo.toml

Step 3: edit the rust file main.rs

  • Go to Bin Root Path
// vi src/main.rs
use hello_exercism;

fn main () {
    println!("{}",hello_exercism::hello());
    assert_eq!("Hello, World!", hello_exercism::hello());
}

Step 4: run the Bin program

  • Go to Bin Root Path
cargo run main

III. create the crate 'hello_exercism' doc in local version

  • Go to Crate Root Path
cargo doc --open --package hello_exercism

IV. create the crate 'hello_exercism' doc in server version

  • github.com >> >> Setting >> Options >> GitHub Pages >> (INFO...)
  • Go to Crate Root Path
mkdir <REPOSITORY>/docs/<PROJECT_NAME>
cargo doc
cp -rf target/doc/.  <REPOSITORY>/docs/<PROJECT_NAME>/.
  • Example:
  • Go to Crate Root Path
mkdir -p ../../docs/hello-world
cargo doc
cp -rf target/doc/. ../../docs/hello-world/