mirror of
https://github.com/rust-lang-nursery/rust-cookbook
synced 2024-11-22 19:43:06 +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>
|
||||
## Parse command line arguments
|
||||
|
||||
[![clap-badge]][clap]
|
||||
[![clap-badge]][clap] [![cat-command-line-badge]][cat-command-line]
|
||||
|
||||
```rust
|
||||
extern crate clap;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<a name="ex-rayon-iter-mut"></a>
|
||||
## Mutate the elements of an array in parallel
|
||||
|
||||
[![rayon-badge]][rayon]
|
||||
[![rayon-badge]][rayon] [![cat-concurrency-badge]][cat-concurrency]
|
||||
|
||||
```rust
|
||||
extern crate rayon;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<a name="ex-json-value"></a>
|
||||
## 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
|
||||
JSON into a type of the caller's choice.
|
||||
|
@ -63,7 +63,7 @@ fn main() {
|
|||
<a name="ex-toml-config"></a>
|
||||
## 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
|
||||
valid TOML data.
|
||||
|
@ -93,6 +93,8 @@ fn main() {
|
|||
|
||||
Parse TOML into your own structs using Serde:
|
||||
|
||||
[![serde-json-badge]][serde-json] [![toml-badge]][toml] [![cat-encoding-badge]][cat-encoding]
|
||||
|
||||
```rust
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
|
|
|
@ -50,7 +50,7 @@ fn main() {
|
|||
<a name="ex-url-base"></a>
|
||||
## Create a base URL by removing path segments
|
||||
|
||||
[![url-badge]][url]
|
||||
[![url-badge]][url] [![cat-net-badge]][cat-net]
|
||||
|
||||
```rust
|
||||
extern crate url;
|
||||
|
@ -110,6 +110,8 @@ fn base_url(full: &str) -> Result<Url> {
|
|||
<a name="ex-url-new-from-base"></a>
|
||||
## 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.
|
||||
|
||||
```rust
|
||||
|
@ -144,6 +146,8 @@ fn build_github_url(path: &str) -> Result<Url, ParseError> {
|
|||
<a name="ex-url-origin"></a>
|
||||
## 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
|
||||
it represents.
|
||||
|
||||
|
@ -201,6 +205,8 @@ fn main() {
|
|||
<a name="ex-url-rm-frag"></a>
|
||||
## 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.
|
||||
|
||||
```rust
|
||||
|
|
Loading…
Reference in a new issue