-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add azure pipeline, mergify, rustfmt, readme
- Loading branch information
1 parent
0bca76d
commit 77c993f
Showing
5 changed files
with
144 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
hard_tabs = true | ||
imports_layout = "Horizontal" | ||
merge_imports = true | ||
fn_args_layout = "Compressed" | ||
use_field_init_shorthand = true | ||
|
||
# To enable when stable | ||
# wrap_comments = true # https://github.com/rust-lang/rustfmt/issues/3347 | ||
# reorder_impl_items = true # https://github.com/rust-lang/rustfmt/issues/3363 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,21 @@ | ||
[package] | ||
name = "template" | ||
name = "template-rust" | ||
version = "0.1.0" | ||
license = "MIT OR Apache-2.0" | ||
authors = ["Alec Mocatta <alec@mocatta.net>"] | ||
categories = [] | ||
keywords = [] | ||
description = """ | ||
A template Rust library crate. | ||
""" | ||
repository = "https://github.com/alecmocatta/template-rust" | ||
homepage = "https://github.com/alecmocatta/template-rust" | ||
documentation = "https://docs.rs/template-rust/0.1.0" | ||
readme = "README.md" | ||
edition = "2018" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
[badges] | ||
azure-devops = { project = "alecmocatta/template-rust", pipeline = "tests" } | ||
maintenance = { status = "passively-maintained" } | ||
|
||
[dependencies] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# template-rust | ||
|
||
[](https://crates.io/crates/template-rust) | ||
[](#License) | ||
[](https://dev.azure.com/alecmocatta/template-rust/_build/latest?definitionId=1&branchName=master) | ||
|
||
[Docs](https://docs.rs/template-rust/0.1.0) | ||
|
||
A template Rust library crate. | ||
|
||
This is template for Rust libraries, comprising a [`hello_world()`](https://docs.rs/template-rust/0.1.0/template_rust/fn.hello_world.html) function. | ||
|
||
## Example | ||
|
||
```rust | ||
use template_rust::hello_world; | ||
|
||
hello_world(); | ||
``` | ||
|
||
## Note | ||
|
||
Caveat emptor. | ||
|
||
## License | ||
Licensed under either of | ||
|
||
* Apache License, Version 2.0, ([LICENSE-APACHE.txt](LICENSE-APACHE.txt) or http://www.apache.org/licenses/LICENSE-2.0) | ||
* MIT license ([LICENSE-MIT.txt](LICENSE-MIT.txt) or http://opensource.org/licenses/MIT) | ||
|
||
at your option. | ||
|
||
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
trigger: ["master"] | ||
pr: ["master"] | ||
|
||
resources: | ||
repositories: | ||
- repository: templates | ||
type: github | ||
name: alecmocatta/azure-pipeline-templates | ||
endpoint: alecmocatta | ||
|
||
jobs: | ||
- template: rust.yml@templates | ||
parameters: | ||
default: | ||
rust_toolchain: stable nightly | ||
rust_lint_toolchain: nightly-2019-07-19 | ||
rust_flags: '' | ||
rust_features: '' | ||
rust_target_check: '' | ||
rust_target_build: '' | ||
rust_target_run: '' | ||
matrix: | ||
windows: | ||
imageName: 'vs2017-win2016' | ||
rust_target_run: 'x86_64-pc-windows-msvc x86_64-pc-windows-gnu i686-pc-windows-msvc i686-pc-windows-gnu' | ||
mac: | ||
imageName: 'macos-10.13' | ||
rust_target_run: 'x86_64-apple-darwin i686-apple-darwin' | ||
linux: | ||
imageName: 'ubuntu-16.04' | ||
rust_target_run: 'x86_64-unknown-linux-gnu i686-unknown-linux-gnu x86_64-unknown-linux-musl i686-unknown-linux-musl' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,60 @@ | ||
//! A template Rust library crate. | ||
//! | ||
//! **[Crates.io](https://crates.io/crates/template-rust) │ [Repo](https://github.com/alecmocatta/template-rust)** | ||
//! | ||
//! This is template for Rust libraries, comprising a [`hello_world()`] function. | ||
//! | ||
//! # Example | ||
//! | ||
//! ``` | ||
//! use template_rust::hello_world; | ||
//! | ||
//! hello_world(); | ||
//! // prints: Hello, world! | ||
//! ``` | ||
//! | ||
//! # Note | ||
//! | ||
//! Caveat emptor. | ||
#![doc(html_root_url = "https://docs.rs/template-rust/0.1.0")] | ||
#![warn( | ||
missing_copy_implementations, | ||
missing_debug_implementations, | ||
missing_docs, | ||
trivial_casts, | ||
trivial_numeric_casts, | ||
unused_import_braces, | ||
unused_qualifications, | ||
unused_results, | ||
clippy::pedantic | ||
)] // from https://github.com/rust-unofficial/patterns/blob/master/anti_patterns/deny-warnings.md | ||
#![allow()] | ||
|
||
/// Print "Hello, world!". | ||
/// | ||
/// # Example | ||
/// | ||
/// ``` | ||
/// use template_rust::hello_world; | ||
/// | ||
/// hello_world(); | ||
/// // prints: Hello, world! | ||
/// ``` | ||
/// | ||
/// # Panics | ||
/// | ||
/// Will panic if printing fails. | ||
pub fn hello_world() { | ||
print!("Hello, world!"); | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
#[test] | ||
fn it_works() { | ||
assert_eq!(2 + 2, 4); | ||
} | ||
use super::hello_world; | ||
|
||
#[test] | ||
fn succeeds() { | ||
hello_world(); | ||
} | ||
} |