Skip to content

Commit

Permalink
Fix remaining Rust doc examples; We now make sure examples build in P…
Browse files Browse the repository at this point in the history
…R CI
  • Loading branch information
ElykDeer committed May 10, 2024
1 parent b2ec4cc commit adde27c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion rust/src/headless.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
7 changes: 6 additions & 1 deletion rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`");
Expand Down
4 changes: 2 additions & 2 deletions rust/src/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

//! To use logging in your script, do something like:
//!
//! ```
//! ```no-test
//! use binaryninja::logger;
//! use log::{info, LevelFilter};
//!
Expand All @@ -15,7 +15,7 @@
//!
//! or
//!
//!```
//!```no-test
//! use binaryninja::logger;
//! use log::{info, LevelFilter};
//!
Expand Down

0 comments on commit adde27c

Please sign in to comment.