diff --git a/.rusty-hook.toml b/.rusty-hook.toml
new file mode 100644
index 0000000000000000000000000000000000000000..aaeaea8c57b9a36836038c7be05a3c8a27418960
--- /dev/null
+++ b/.rusty-hook.toml
@@ -0,0 +1,5 @@
+[hooks]
+pre-commit = "cargo fmt -- --check && flutter format --set-exit-if-changed lib packages/dubp_rs/lib/dubp.dart"
+
+[logging]
+verbose = true
diff --git a/Cargo.lock b/Cargo.lock
index d7a684373e7d3483c38cca2404083b1d8ec4e34b..fcdb077c0a5fe61b31c4397211a3ae99bf617290 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -84,6 +84,12 @@ dependencies = [
  "winapi",
 ]
 
+[[package]]
+name = "autocfg"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
+
 [[package]]
 name = "base64"
 version = "0.13.0"
@@ -165,6 +171,15 @@ version = "1.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
 
+[[package]]
+name = "ci_info"
+version = "0.10.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "24f638c70e8c5753795cc9a8c07c44da91554a09e4cf11a7326e8161b0a3c45e"
+dependencies = [
+ "envmnt",
+]
+
 [[package]]
 name = "cipher"
 version = "0.2.5"
@@ -263,6 +278,7 @@ dependencies = [
  "fast-threadpool",
  "once_cell",
  "parking_lot",
+ "rusty-hook",
  "thiserror",
 ]
 
@@ -298,6 +314,16 @@ dependencies = [
  "cryptoxide",
 ]
 
+[[package]]
+name = "envmnt"
+version = "0.8.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a2d328fc287c61314c4a61af7cfdcbd7e678e39778488c7cb13ec133ce0f4059"
+dependencies = [
+ "fsio",
+ "indexmap",
+]
+
 [[package]]
 name = "fast-threadpool"
 version = "0.3.0"
@@ -318,6 +344,12 @@ dependencies = [
  "spinning_top",
 ]
 
+[[package]]
+name = "fsio"
+version = "0.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c1fd087255f739f4f1aeea69f11b72f8080e9c2e7645cd06955dad4a178a49e3"
+
 [[package]]
 name = "futures-micro"
 version = "0.3.1"
@@ -334,6 +366,15 @@ dependencies = [
  "version_check",
 ]
 
+[[package]]
+name = "getopts"
+version = "0.2.21"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5"
+dependencies = [
+ "unicode-width",
+]
+
 [[package]]
 name = "getrandom"
 version = "0.2.2"
@@ -351,6 +392,12 @@ version = "0.3.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
 
+[[package]]
+name = "hashbrown"
+version = "0.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04"
+
 [[package]]
 name = "heck"
 version = "0.3.2"
@@ -369,6 +416,16 @@ dependencies = [
  "libc",
 ]
 
+[[package]]
+name = "indexmap"
+version = "1.6.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3"
+dependencies = [
+ "autocfg",
+ "hashbrown",
+]
+
 [[package]]
 name = "instant"
 version = "0.1.9"
@@ -423,6 +480,12 @@ dependencies = [
  "cfg-if 0.1.10",
 ]
 
+[[package]]
+name = "nias"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ab250442c86f1850815b5d268639dff018c0627022bc1940eb2d642ca1ce12f0"
+
 [[package]]
 name = "num_cpus"
 version = "1.13.0"
@@ -567,6 +630,18 @@ dependencies = [
  "winapi",
 ]
 
+[[package]]
+name = "rusty-hook"
+version = "0.11.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "96cee9be61be7e1cbadd851e58ed7449c29c620f00b23df937cb9cbc04ac21a3"
+dependencies = [
+ "ci_info",
+ "getopts",
+ "nias",
+ "toml",
+]
+
 [[package]]
 name = "ryu"
 version = "1.0.5"
diff --git a/native/dubp_rs/Cargo.toml b/native/dubp_rs/Cargo.toml
index 05ba6373a8515d25ee82f183d08e814bd3c09051..180f0c5460bc89d421bd318ec95d23e220769c7d 100644
--- a/native/dubp_rs/Cargo.toml
+++ b/native/dubp_rs/Cargo.toml
@@ -23,3 +23,4 @@ dart-bindgen = "0.1.7"
 
 [dev-dependencies]
 assert_matches = "1.5.0"
+rusty-hook = "^0.11.2"
\ No newline at end of file