Skip to content

Use mdbook #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Deploy
on:
push:
branches:
- master

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install mdbook
run: |
mkdir mdbook
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.21/mdbook-v0.4.21-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook
echo `pwd`/mdbook >> $GITHUB_PATH
- name: Deploy GitHub Pages
run: |
# This assumes your book is in the root of your repository.
# Just add a `cd` here if you need to change to another directory.
mdbook build
git worktree add gh-pages
git config user.name "Deploy from CI"
git config user.email ""
cd gh-pages
# Delete the ref to avoid keeping history.
git update-ref -d refs/heads/gh-pages
rm -rf *
mv ../book/* .
git add .
git commit -m "Deploy $GITHUB_SHA to gh-pages"
git push --force --set-upstream origin gh-pages
6 changes: 1 addition & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
book
_book
target
Cargo.lock
*.pdf
book
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Compiling and Linking in More Detail

## Your main\(\) entry point
## Your main() entry point

Rust has a main function just like C/C++ which is usually called `main()`. [^1]

Expand Down Expand Up @@ -253,4 +253,3 @@ Also note that once we build, cargo creates a `Cargo.lock` file in our root dire
This file is made so that if `cargo build` is invoked again it has an exact list of what packages need to be pulled and compiled. It stops situations where the code under our feet \(so to speak\) moves and suddenly our project no longer builds. So if the lock file exists, the same dependency configuration can be reproduced even from a clean. If you want to force the cargo to rebuild a new lock file, e.g. after changing `Cargo.toml`, you can type `cargo update`.

[^1]: You can change the main entry point using a special `#[start]` directive if you want on another function but the default is main\(\)

1 change: 0 additions & 1 deletion 07_namespacing_with_modules/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,3 @@ TODO
## External crates

TODO

2 changes: 1 addition & 1 deletion SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* [Compiling and Linking in More Detail](05_compiling_and_linking/index.md)
* [Source Layout and Other General Points](06_source_layout/index.md)
* [Namespacing With Modules](07_namespacing_with_modules/index.md)
* [Porting Code](08_porting-code/index.md)
* [Porting Code](08_porting_code/index.md)
* [Features of Rust compared with C++](09_features_compared/index.md)
* [Types](09_features_compared/types.md)
* [Strings](09_features_compared/strings.md)
Expand Down
6 changes: 0 additions & 6 deletions book.json

This file was deleted.

7 changes: 7 additions & 0 deletions book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[book]
authors = ["Adam Lock"]
language = "en"
multilingual = false
src = "."
title = "A Guide to Porting C/C++ to Rust"
description = "A book that explains how to port code from C++ to Rust."
2 changes: 1 addition & 1 deletion foreword.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Foreword

**BEGIN DRAFT BOOK DISCLAIMER **
**BEGIN DRAFT BOOK DISCLAIMER**

* Some of the samples will not compile or may not have been syntax checked
* C and Rust code snippets are not distinguished very well yet (styling)
Expand Down
3 changes: 0 additions & 3 deletions styles/website.css

This file was deleted.