mirror of
https://github.com/rust-lang-nursery/rust-cookbook
synced 2025-02-17 04:38:28 +00:00
Added missing badges to examples
This commit is contained in:
parent
9a3b9f43a9
commit
a27629e6b3
4 changed files with 13 additions and 5 deletions
|
@ -8,7 +8,7 @@
|
||||||
<a name="ex-clap-basic"></a>
|
<a name="ex-clap-basic"></a>
|
||||||
## Parse command line arguments
|
## Parse command line arguments
|
||||||
|
|
||||||
[![clap-badge]][clap]
|
[![clap-badge]][clap] [![cat-command-line-badge]][cat-command-line]
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
extern crate clap;
|
extern crate clap;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<a name="ex-rayon-iter-mut"></a>
|
<a name="ex-rayon-iter-mut"></a>
|
||||||
## Mutate the elements of an array in parallel
|
## Mutate the elements of an array in parallel
|
||||||
|
|
||||||
[![rayon-badge]][rayon]
|
[![rayon-badge]][rayon] [![cat-concurrency-badge]][cat-concurrency]
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
extern crate rayon;
|
extern crate rayon;
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<a name="ex-json-value"></a>
|
<a name="ex-json-value"></a>
|
||||||
## Serialize and deserialize unstructured JSON
|
## Serialize and deserialize unstructured JSON
|
||||||
|
|
||||||
[![serde-json-badge]][serde-json]
|
[![serde-json-badge]][serde-json] [![cat-encoding-badge]][cat-encoding]
|
||||||
|
|
||||||
The [`serde_json`] crate provides a [`from_str`] function to parse a `&str` of
|
The [`serde_json`] crate provides a [`from_str`] function to parse a `&str` of
|
||||||
JSON into a type of the caller's choice.
|
JSON into a type of the caller's choice.
|
||||||
|
@ -63,7 +63,7 @@ fn main() {
|
||||||
<a name="ex-toml-config"></a>
|
<a name="ex-toml-config"></a>
|
||||||
## Deserialize a TOML configuration file
|
## Deserialize a TOML configuration file
|
||||||
|
|
||||||
[![toml-badge]][toml]
|
[![toml-badge]][toml] [![cat-encoding-badge]][cat-encoding]
|
||||||
|
|
||||||
Parse some TOML into a universal `toml::Value` that is able to represent any
|
Parse some TOML into a universal `toml::Value` that is able to represent any
|
||||||
valid TOML data.
|
valid TOML data.
|
||||||
|
@ -93,6 +93,8 @@ fn main() {
|
||||||
|
|
||||||
Parse TOML into your own structs using Serde:
|
Parse TOML into your own structs using Serde:
|
||||||
|
|
||||||
|
[![serde-json-badge]][serde-json] [![toml-badge]][toml] [![cat-encoding-badge]][cat-encoding]
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate serde_derive;
|
extern crate serde_derive;
|
||||||
|
|
|
@ -50,7 +50,7 @@ fn main() {
|
||||||
<a name="ex-url-base"></a>
|
<a name="ex-url-base"></a>
|
||||||
## Create a base URL by removing path segments
|
## Create a base URL by removing path segments
|
||||||
|
|
||||||
[![url-badge]][url]
|
[![url-badge]][url] [![cat-net-badge]][cat-net]
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
extern crate url;
|
extern crate url;
|
||||||
|
@ -110,6 +110,8 @@ fn base_url(full: &str) -> Result<Url> {
|
||||||
<a name="ex-url-new-from-base"></a>
|
<a name="ex-url-new-from-base"></a>
|
||||||
## Create new URLs from a base URL
|
## Create new URLs from a base URL
|
||||||
|
|
||||||
|
[![url-badge]][url] [![cat-net-badge]][cat-net]
|
||||||
|
|
||||||
The [`join`] method creates a new URL from a base and relative path.
|
The [`join`] method creates a new URL from a base and relative path.
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
@ -144,6 +146,8 @@ fn build_github_url(path: &str) -> Result<Url, ParseError> {
|
||||||
<a name="ex-url-origin"></a>
|
<a name="ex-url-origin"></a>
|
||||||
## Extract the URL origin (scheme / host / port)
|
## Extract the URL origin (scheme / host / port)
|
||||||
|
|
||||||
|
[![url-badge]][url] [![cat-net-badge]][cat-net]
|
||||||
|
|
||||||
The [`Url`] struct exposes various methods to extract information about the URL
|
The [`Url`] struct exposes various methods to extract information about the URL
|
||||||
it represents.
|
it represents.
|
||||||
|
|
||||||
|
@ -201,6 +205,8 @@ fn main() {
|
||||||
<a name="ex-url-rm-frag"></a>
|
<a name="ex-url-rm-frag"></a>
|
||||||
## Remove fragment identifiers and query pairs from a URL
|
## Remove fragment identifiers and query pairs from a URL
|
||||||
|
|
||||||
|
[![url-badge]][url] [![cat-net-badge]][cat-net]
|
||||||
|
|
||||||
Once [`Url`] is parsed it can be sliced with [`url::Position`] to strip unneded URL parts.
|
Once [`Url`] is parsed it can be sliced with [`url::Position`] to strip unneded URL parts.
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
|
Loading…
Add table
Reference in a new issue