From 57f889e86e6517b311ddbc44d2b00104316485c8 Mon Sep 17 00:00:00 2001
From: Linda_pp <rhysd@users.noreply.github.com>
Date: Tue, 5 Nov 2019 00:15:02 +0900
Subject: [PATCH] Add cargo example for Rust project (#8)

* Add cargo example

* Add hash of Cargo.lock to keys of caches

* Move Rust example to examples.md
---
 examples.md | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/examples.md b/examples.md
index 1fccc23..54c05bb 100644
--- a/examples.md
+++ b/examples.md
@@ -10,6 +10,7 @@
 - [Ruby - Gem](#ruby---gem)
 - [Go - Modules](#go---modules)
 - [Elixir - Mix](#elixir---mix)
+- [Rust - Cargo](#rust---cargo)
 
 ## Node - npm
 
@@ -119,3 +120,23 @@ uses: actions/cache@preview
     restore-keys: |
       ${{ runner.os }}-mix-
 ```
+
+## Rust - Cargo
+
+```
+- name: Cache cargo registry
+  uses: actions/cache@preview
+  with:
+    path: ~/.cargo/registry
+    key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
+- name: Cache cargo index
+  uses: actions/cache@preview
+  with:
+    path: ~/.cargo/git
+    key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
+- name: Cache cargo build
+  uses: actions/cache@preview
+  with:
+    path: target
+    key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
+```