summaryrefslogtreecommitdiff
path: root/rust-src/bch_bindgen/src/rs.rs
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-02-26 21:38:12 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-02-27 21:45:42 -0500
commite0e06d95f899e5e83d66e94600928156a5eb3a4b (patch)
tree5de00419aeed9689125493ce6894ab90b5ea57a0 /rust-src/bch_bindgen/src/rs.rs
parent30cca2e94d0dfa8c3151daf1393f402d32bb9407 (diff)
Rust: Start of cmd_list rewrite
This is a _very_ preliminary rewrite of the cmd_list tool in rust, which is intended to be a testing ground for a safe interface in Rust to the core btree interface. This adds rust wrappers for: bch_fs: provides bch2_fs_open(), bch2_fs_stop btree_trans: provides bch2_trans_init(), bch2_trans_exit() btree_iter: provides peek, peek_and_restart, advance bch_errcode: implements Display (wraps bch2_err_str()) bpos: implements Ord (wraps bpos_cmp()) bkey_s_c: implements Display (wraps bch2_bkey_val_to_text()) and other assorted types. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'rust-src/bch_bindgen/src/rs.rs')
-rw-r--r--rust-src/bch_bindgen/src/rs.rs10
1 files changed, 1 insertions, 9 deletions
diff --git a/rust-src/bch_bindgen/src/rs.rs b/rust-src/bch_bindgen/src/rs.rs
index 17610f3a..24594ae1 100644
--- a/rust-src/bch_bindgen/src/rs.rs
+++ b/rust-src/bch_bindgen/src/rs.rs
@@ -1,15 +1,7 @@
use anyhow::anyhow;
use crate::bcachefs;
use crate::bcachefs::*;
-use std::ffi::CStr;
-use std::fmt;
-
-impl fmt::Display for bch_errcode {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- let s = unsafe { CStr::from_ptr(bch2_err_str(*self as i32)) };
- write!(f, "{:?}", s)
- }
-}
+use crate::errcode::bch_errcode;
pub fn read_super_opts(
path: &std::path::Path,