diff options
| author | KyleMiles <krm504@nyu.edu> | 2024-05-10 11:50:07 -0400 |
|---|---|---|
| committer | KyleMiles <krm504@nyu.edu> | 2024-05-10 12:00:56 -0400 |
| commit | adde27cfa50f7ef70821cecb71967d538962f7b3 (patch) | |
| tree | 5378167c1b3aaa1d36f8b8098e12b25241488025 | |
| parent | b2ec4cc4bb2e5535769928b561f1c1932a66dcc8 (diff) | |
Fix remaining Rust doc examples; We now make sure examples build in PR CI
| -rw-r--r-- | .github/workflows/rust.yml | 4 | ||||
| -rw-r--r-- | rust/src/headless.rs | 7 | ||||
| -rw-r--r-- | rust/src/lib.rs | 7 | ||||
| -rw-r--r-- | rust/src/logger.rs | 4 |
4 files changed, 18 insertions, 4 deletions
diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index c0967cac..3e78ce0f 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -33,6 +33,10 @@ jobs: working-directory: ./rust run: cargo check --workspace --all-features + - name: cargo doc test + working-directory: ./rust + run: cargo test --doc -- --show-output + - name: cargo clippy working-directory: ./rust run: cargo clippy -- -D warnings diff --git a/rust/src/headless.rs b/rust/src/headless.rs index 740c3dc6..15754aba 100644 --- a/rust/src/headless.rs +++ b/rust/src/headless.rs @@ -135,7 +135,12 @@ impl Session { } /// ```no_run - /// let settings = [("analysis.linearSweep.autorun", false)].into(); + /// use binaryninja::{metadata::Metadata, rc::Ref}; + /// use std::collections::HashMap; + /// + /// let settings: Ref<Metadata> = HashMap::from([ + /// ("analysis.linearSweep.autorun", false.into()), + /// ]).into(); /// let headless_session = binaryninja::headless::Session::new(); /// /// let bv = headless_session.load_with_options("/bin/cat", true, Some(settings)) diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 8a51a7d8..d2894b20 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -218,7 +218,12 @@ pub fn load<S: BnStrCompatible>(filename: S) -> Option<rc::Ref<binaryview::Binar /// The main way to open and load files (with options) into Binary Ninja. Make sure you've properly initialized the core before calling this function. See [`crate::headless::init()`] /// /// ```no_run -/// let settings = [("analysis.linearSweep.autorun", false)].into(); +/// use binaryninja::{metadata::Metadata, rc::Ref}; +/// use std::collections::HashMap; +/// +/// let settings: Ref<Metadata> = HashMap::from([ +/// ("analysis.linearSweep.autorun", false.into()), +/// ]).into(); /// /// let bv = binaryninja::load_with_options("/bin/cat", true, Some(settings)) /// .expect("Couldn't open `/bin/cat`"); diff --git a/rust/src/logger.rs b/rust/src/logger.rs index 43423900..6e0b1887 100644 --- a/rust/src/logger.rs +++ b/rust/src/logger.rs @@ -2,7 +2,7 @@ //! To use logging in your script, do something like: //! -//! ``` +//! ```no-test //! use binaryninja::logger; //! use log::{info, LevelFilter}; //! @@ -15,7 +15,7 @@ //! //! or //! -//!``` +//!```no-test //! use binaryninja::logger; //! use log::{info, LevelFilter}; //! |
