init travis ci support

This commit is contained in:
KaiserY 2018-01-11 10:27:53 +08:00
parent a3b9254db2
commit 5e2b246777
7 changed files with 90 additions and 43 deletions

21
.travis.yml Normal file
View File

@ -0,0 +1,21 @@
sudo: false
dist: trusty
language: rust
cache: cargo
rust:
- nightly
branches:
only:
- master
before_script:
- (cargo install mdbook --vers 0.0.26 --force || true)
script:
- mdbook build
deploy:
provider: pages
local-dir: mdbook
skip-cleanup: true
github-token: $GITHUB_TOKEN
keep-history: false
on:
branch: master

View File

@ -9,7 +9,7 @@
- [猜猜看教程](ch02-00-guessing-game-tutorial.md) - [猜猜看教程](ch02-00-guessing-game-tutorial.md)
- [通用编程概念](ch03-00-common-programming-concepts.md) - [通用编程概念](ch03-00-common-programming-concepts.md)
- [变量可变性](ch03-01-variables-and-mutability.md) - [变量可变性](ch03-01-variables-and-mutability.md)
- [数据类型](ch03-02-data-types.md) - [数据类型](ch03-02-data-types.md)
- [函数如何工作](ch03-03-how-functions-work.md) - [函数如何工作](ch03-03-how-functions-work.md)
- [注释](ch03-04-comments.md) - [注释](ch03-04-comments.md)
@ -17,25 +17,25 @@
- [认识所有权](ch04-00-understanding-ownership.md) - [认识所有权](ch04-00-understanding-ownership.md)
- [什么是所有权](ch04-01-what-is-ownership.md) - [什么是所有权](ch04-01-what-is-ownership.md)
- [引用 & 借用](ch04-02-references-and-borrowing.md) - [引用借用](ch04-02-references-and-borrowing.md)
- [Slices](ch04-03-slices.md) - [Slices](ch04-03-slices.md)
- [使用结构体组织相关联的数据](ch05-00-structs.md) - [使用结构体组织相关联的数据](ch05-00-structs.md)
- [定义并实例化结构体](ch05-01-defining-structs.md) - [定义并实例化结构体](ch05-01-defining-structs.md)
- [一个使用结构体的示例程序](ch05-02-example-structs.md) - [一个使用结构体的示例程序](ch05-02-example-structs.md)
- [方法语法](ch05-03-method-syntax.md) - [方法语法](ch05-03-method-syntax.md)
- [枚举模式匹配](ch06-00-enums.md) - [枚举模式匹配](ch06-00-enums.md)
- [定义枚举](ch06-01-defining-an-enum.md) - [定义枚举](ch06-01-defining-an-enum.md)
- [`match` 控制流运算符](ch06-02-match.md) - [`match` 控制流运算符](ch06-02-match.md)
- [`if let` 简控制流](ch06-03-if-let.md) - [`if let` 简控制流](ch06-03-if-let.md)
## 基本 Rust 技能 ## 基本 Rust 技能
- [模块](ch07-00-modules.md) - [模块](ch07-00-modules.md)
- [`mod`文件系统](ch07-01-mod-and-the-filesystem.md) - [`mod`文件系统](ch07-01-mod-and-the-filesystem.md)
- [使用 `pub` 控制可见性](ch07-02-controlling-visibility-with-pub.md) - [使用 `pub` 控制可见性](ch07-02-controlling-visibility-with-pub.md)
- [使用`use`导入命名](ch07-03-importing-names-with-use.md) - [在不同的模块中引用命名](ch07-03-importing-names-with-use.md)
- [通用集合类型](ch08-00-common-collections.md) - [通用集合类型](ch08-00-common-collections.md)
- [vector](ch08-01-vectors.md) - [vector](ch08-01-vectors.md)
@ -47,7 +47,7 @@
- [`Result` 与可恢复的错误](ch09-02-recoverable-errors-with-result.md) - [`Result` 与可恢复的错误](ch09-02-recoverable-errors-with-result.md)
- [`panic!` 还是不 `panic!`](ch09-03-to-panic-or-not-to-panic.md) - [`panic!` 还是不 `panic!`](ch09-03-to-panic-or-not-to-panic.md)
- [泛型、trait 生命周期](ch10-00-generics.md) - [泛型、trait 生命周期](ch10-00-generics.md)
- [泛型数据类型](ch10-01-syntax.md) - [泛型数据类型](ch10-01-syntax.md)
- [trait定义共享的行为](ch10-02-traits.md) - [trait定义共享的行为](ch10-02-traits.md)
- [生命周期与引用有效性](ch10-03-lifetime-syntax.md) - [生命周期与引用有效性](ch10-03-lifetime-syntax.md)
@ -57,31 +57,31 @@
- [运行测试](ch11-02-running-tests.md) - [运行测试](ch11-02-running-tests.md)
- [测试的组织结构](ch11-03-test-organization.md) - [测试的组织结构](ch11-03-test-organization.md)
- [一个 I/O 项目](ch12-00-an-io-project.md) - [一个 I/O 项目:构建命令行程序](ch12-00-an-io-project.md)
- [接受命令行参数](ch12-01-accepting-command-line-arguments.md) - [接受命令行参数](ch12-01-accepting-command-line-arguments.md)
- [读取文件](ch12-02-reading-a-file.md) - [读取文件](ch12-02-reading-a-file.md)
- [增强错误处理和模块化](ch12-03-improving-error-handling-and-modularity.md) - [重构以改进模块化与错误处理](ch12-03-improving-error-handling-and-modularity.md)
- [测试库的功能](ch12-04-testing-the-librarys-functionality.md) - [采用测试驱动开发完善库的功能](ch12-04-testing-the-librarys-functionality.md)
- [处理环境变量](ch12-05-working-with-environment-variables.md) - [处理环境变量](ch12-05-working-with-environment-variables.md)
- [输出到`stderr`而不是`stdout`](ch12-06-writing-to-stderr-instead-of-stdout.md) - [将错误信息输出到标准错误而不是标准输出](ch12-06-writing-to-stderr-instead-of-stdout.md)
## Rust 编程思想 ## Rust 编程思想
- [Rust 中的函数式语言功能](ch13-00-functional-features.md) - [Rust 中的函数式语言功能:迭代器与闭包](ch13-00-functional-features.md)
- [闭包](ch13-01-closures.md) - [闭包:可以捕获其环境的匿名函数](ch13-01-closures.md)
- [迭代器](ch13-02-iterators.md) - [使用迭代器处理元素序列](ch13-02-iterators.md)
- [改进 I/O 项目](ch13-03-improving-our-io-project.md) - [改进之前的 I/O 项目](ch13-03-improving-our-io-project.md)
- [性能](ch13-04-performance.md) - [性能比较:循环对迭代器](ch13-04-performance.md)
- [更多关于 Cargo 和 Crates.io](ch14-00-more-about-cargo.md) - [更多关于 Cargo 和 Crates.io 的内容](ch14-00-more-about-cargo.md)
- [发布配置](ch14-01-release-profiles.md) - [采用发布配置自定义构建](ch14-01-release-profiles.md)
- [将 crate 发布到 Crates.io](ch14-02-publishing-to-crates-io.md) - [将 crate 发布到 Crates.io](ch14-02-publishing-to-crates-io.md)
- [Cargo 工作空间](ch14-03-cargo-workspaces.md) - [Cargo 工作空间](ch14-03-cargo-workspaces.md)
- [使用`cargo install`从 Crates.io 安装文件](ch14-04-installing-binaries.md) - [使用 `cargo install` 从 Crates.io 安装二进制文件](ch14-04-installing-binaries.md)
- [Cargo 自定义扩展命令](ch14-05-extending-cargo.md) - [Cargo 自定义扩展命令](ch14-05-extending-cargo.md)
- [智能指针](ch15-00-smart-pointers.md) - [智能指针](ch15-00-smart-pointers.md)
- [`Box<T>`Box<T>在堆上存储数据,并且可确定大小](ch15-01-box.md) - [`Box<T>` 在堆上存储数据,并且可确定大小](ch15-01-box.md)
- [`Deref` Trait 允许通过引用访问数据](ch15-02-deref.md) - [`Deref` Trait 允许通过引用访问数据](ch15-02-deref.md)
- [`Drop` Trait 运行清理代码](ch15-03-drop.md) - [`Drop` Trait 运行清理代码](ch15-03-drop.md)
- [`Rc<T>` 引用计数智能指针](ch15-04-rc.md) - [`Rc<T>` 引用计数智能指针](ch15-04-rc.md)
@ -94,7 +94,7 @@
- [共享状态](ch16-03-shared-state.md) - [共享状态](ch16-03-shared-state.md)
- [可扩展的并发:`Sync`和`Send`](ch16-04-extensible-concurrency-sync-and-send.md) - [可扩展的并发:`Sync`和`Send`](ch16-04-extensible-concurrency-sync-and-send.md)
- [面向对象](ch17-00-oop.md) - [Rust 是面向对象语言吗?](ch17-00-oop.md)
- [什么是面向对象?](ch17-01-what-is-oo.md) - [什么是面向对象?](ch17-01-what-is-oo.md)
- [为使用不同类型的值而设计的 trait 对象](ch17-02-trait-objects.md) - [为使用不同类型的值而设计的 trait 对象](ch17-02-trait-objects.md)
- [面向对象设计模式的实现](ch17-03-oo-design-patterns.md) - [面向对象设计模式的实现](ch17-03-oo-design-patterns.md)
@ -103,7 +103,7 @@
- [模式用来匹配值的结构](ch18-00-patterns.md) - [模式用来匹配值的结构](ch18-00-patterns.md)
- [所有可能会用到模式的位置](ch18-01-all-the-places-for-patterns.md) - [所有可能会用到模式的位置](ch18-01-all-the-places-for-patterns.md)
- [refutable:何时模式可能会匹配失败](ch18-02-refutability.md) - [Refutability:何时模式可能会匹配失败](ch18-02-refutability.md)
- [模式的全部语法](ch18-03-pattern-syntax.md) - [模式的全部语法](ch18-03-pattern-syntax.md)
- [高级特征](ch19-00-advanced-features.md) - [高级特征](ch19-00-advanced-features.md)
@ -123,9 +123,8 @@
- [附录](appendix-00.md) - [附录](appendix-00.md)
- [A - 关键字](appendix-01-keywords.md) - [A - 关键字](appendix-01-keywords.md)
- [B - 运算符](appendix-02-operators.md) - [B - 运算符与符号](appendix-02-operators.md)
- [C - 可导出的 trait]() - [C - 可导出的 trait](appendix-03-derivable-traits.md)
- [D - Rust 开发版]() - [D - 宏](appendix-04-macros.md)
- [E - 宏]() - [E - 本书翻译](appendix-05-translation.md)
- [F - 本书翻译]() - [F - 最新功能](appendix-06-newest-features.md)
- [G - 最新功能](appendix-07-newest-features.md)

View File

@ -0,0 +1 @@
# C - 可导出的 trait

View File

@ -0,0 +1 @@
# D - 宏

View File

@ -0,0 +1 @@
# E - 本书翻译

View File

@ -0,0 +1 @@
# F - 最新功能

View File

@ -121,18 +121,19 @@
{{#each additional_js}} {{#each additional_js}}
<script type="text/javascript" src="{{this}}"></script> <script type="text/javascript" src="{{this}}"></script>
{{/each}} {{/each}}
</head> </head>
<body class="light"> <body class="light">
<!-- Set the theme before any content is loaded, prevents flash --> <!-- Set the theme before any content is loaded, prevents flash -->
<script type="text/javascript"> <script type="text/javascript">
var theme = localStorage.getItem('theme'); var theme = store.get('mdbook-theme');
if (theme == null) { theme = 'light'; } if (theme === null || theme === undefined) { theme = 'light'; }
$('body').removeClass().addClass(theme); $('body').removeClass().addClass(theme);
</script> </script>
<!-- Hide / unhide sidebar before it is displayed --> <!-- Hide / unhide sidebar before it is displayed -->
<script type="text/javascript"> <script type="text/javascript">
var sidebar = localStorage.getItem('sidebar'); var sidebar = store.get('mdbook-sidebar');
if (sidebar === "hidden") { $("html").addClass("sidebar-hidden") } if (sidebar === "hidden") { $("html").addClass("sidebar-hidden") }
else if (sidebar === "visible") { $("html").addClass("sidebar-visible") } else if (sidebar === "visible") { $("html").addClass("sidebar-visible") }
</script> </script>
@ -143,35 +144,37 @@
<div id="page-wrapper" class="page-wrapper has-warning"> <div id="page-wrapper" class="page-wrapper has-warning">
<div class="page"> <div class="page" tabindex="-1">
{{!-- <header><p class="warning">You are reading a <strong>draft</strong> of the next edition of TRPL. For more, go <a href="../index.html">here</a>.</p></header> --}} {{!-- <header><p class="warning">You are reading a <strong>draft</strong> of the next edition of TRPL. For more, go <a href="../index.html">here</a>.</p></header> --}}
<header></header>
<div id="menu-bar" class="menu-bar"> <div id="menu-bar" class="menu-bar">
<div class="left-buttons"> <div class="left-buttons">
<i id="sidebar-toggle" class="fa fa-bars"></i> <i id="sidebar-toggle" class="fa fa-bars"></i>
<i id="theme-toggle" class="fa fa-paint-brush"></i> <i id="theme-toggle" class="fa fa-paint-brush"></i>
</div> </div>
<h1 class="menu-title">{{ title }}</h1> <h1 class="menu-title">{{ book_title }}</h1>
<div class="right-buttons"> <div class="right-buttons">
<a href="print.html">
<i id="print-button" class="fa fa-print" title="Print this book"></i> <i id="print-button" class="fa fa-print" title="Print this book"></i>
</a>
</div> </div>
</div> </div>
<div id="content" class="content"> <div id="content" class="content">
{{{ content }}} {{{ content }}}
</div> </div>
<!-- Mobile navigation buttons --> <!-- Mobile navigation buttons -->
{{#previous}} {{#previous}}
<a href="{{link}}" class="mobile-nav-chapters previous"> <a rel="prev" href="{{link}}" class="mobile-nav-chapters previous">
<i class="fa fa-angle-left"></i> <i class="fa fa-angle-left"></i>
</a> </a>
{{/previous}} {{/previous}}
{{#next}} {{#next}}
<a href="{{link}}" class="mobile-nav-chapters next"> <a rel="next" href="{{link}}" class="mobile-nav-chapters next">
<i class="fa fa-angle-right"></i> <i class="fa fa-angle-right"></i>
</a> </a>
{{/next}} {{/next}}
@ -203,6 +206,18 @@
<!-- Livereload script (if served using the cli tool) --> <!-- Livereload script (if served using the cli tool) -->
{{{livereload}}} {{{livereload}}}
{{#if google_analytics}}
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', '{{google_analytics}}', 'auto');
ga('send', 'pageview');
</script>
{{/if}}
{{#if playpens_editable}} {{#if playpens_editable}}
<script src="{{ ace_js }}" type="text/javascript" charset="utf-8"></script> <script src="{{ ace_js }}" type="text/javascript" charset="utf-8"></script>
<script src="{{ editor_js }}" type="text/javascript" charset="utf-8"></script> <script src="{{ editor_js }}" type="text/javascript" charset="utf-8"></script>
@ -211,6 +226,14 @@
<script src="{{ theme_tomorrow_night_js }}" type="text/javascript" charset="utf-8"></script> <script src="{{ theme_tomorrow_night_js }}" type="text/javascript" charset="utf-8"></script>
{{/if}} {{/if}}
{{#if is_print}}
<script>
$(document).ready(function() {
window.print();
})
</script>
{{/if}}
<script src="highlight.js"></script> <script src="highlight.js"></script>
<script src="book.js"></script> <script src="book.js"></script>
</body> </body>