### Documentation Search Syntax Examples Source: https://docs.rs/scraper/0.23.1/scraper/serde/1.0.17/i686-unknown-linux-gnu/serde/macro.forward_to_deserialize_any Examples illustrating how to use type prefixes to narrow down search results and how to search for functions by their type signatures. ```Search Syntax fn: ``` ```Search Syntax mod: ``` ```Search Syntax struct: ``` ```Search Syntax enum: ``` ```Search Syntax trait: ``` ```Search Syntax type: ``` ```Search Syntax macro: ``` ```Search Syntax const: ``` ```Search Syntax vec -> usize ``` ```Search Syntax * -> vec ``` -------------------------------- ### Mockall Debug Trait Derivation Source: https://docs.rs/scraper/0.23.1/scraper/crate/mockall/0.13.1/target-redirect/x86_64-unknown-linux-gnu/mockall/index Example of manually deriving the `Debug` trait for a mock struct using the `mock!` macro. ```Rust mock! { #[derive(Debug)] pub Foo {} } ``` -------------------------------- ### Mockall Context Checkpoint Panic Example Source: https://docs.rs/scraper/0.23.1/scraper/crate/mockall/0.13.1/target-redirect/x86_64-unknown-linux-gnu/mockall/index Demonstrates how `checkpoint` on a context object panics if expectations are not met, specifically for non-static methods. ```Rust #[automock] pub trait A { fn foo() -> u32; } let ctx = MockA::foo_context(); ctx.expect() .times(1) .returning(|| 99); ctx.checkpoint(); // Panics! ``` -------------------------------- ### Documentation Navigation and Search Help Source: https://docs.rs/scraper/0.23.1/scraper/serde/1.0.1/i686-unknown-linux-gnu/serde/index Instructions for navigating the documentation using keyboard shortcuts and advanced search techniques, including type-specific searches. ```APIDOC Keyboard Shortcuts: ?: Show this help dialog S: Focus the search field ⇤: Move up in search results ⇥: Move down in search results ⏎: Go to active search result +: Collapse/expand all sections Search Tricks: Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type. Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`. Search functions by type signature (e.g. `vec -> usize` or `* -> vec`) ``` -------------------------------- ### Documentation Navigation and Search Help Source: https://docs.rs/scraper/0.23.1/scraper/serde/1.0.27/serde Instructions for navigating the documentation using keyboard shortcuts and advanced search techniques, including type-specific searches. ```APIDOC Keyboard Shortcuts: ?: Show this help dialog S: Focus the search field ⇤: Move up in search results ⇥: Move down in search results ⏎: Go to active search result +: Collapse/expand all sections Search Tricks: Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type. Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`. Search functions by type signature (e.g. `vec -> usize` or `* -> vec`) ``` -------------------------------- ### Mockall Module Mocking Example Source: https://docs.rs/scraper/0.23.1/scraper/crate/mockall/0.13.1/target-redirect/x86_64-unknown-linux-gnu/mockall/index Shows how Mockall can derive mocks for entire Rust modules, generating a 'mock_xxx' module and using `#[double]` for selective import. ```Rust mod outer { use mockall::automock; #[automock()] pub(super) mod inner { pub fn bar(x: u32) -> i64 { // ... } } } #[double] use outer::inner; #[cfg(test)] mod t { use super::*; #[test] fn test_foo_bar() { let ctx = inner::bar_context(); ctx.expect() .returning(|x| i64::from(x + 1)); assert_eq!(5, inner::bar(4)); } } ``` -------------------------------- ### Documentation Navigation and Search Help Source: https://docs.rs/scraper/0.23.1/scraper/serde/1.0.15/i686-unknown-linux-gnu/serde/index Keyboard shortcuts and search tips for navigating and finding information within the Serde documentation. ```APIDOC Keyboard Shortcuts: ?: Show this help dialog S: Focus the search field ⇤: Move up in search results ⇥: Move down in search results ⏎: Go to active search result +: Collapse/expand all sections Search Tricks: Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type. Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`. Search functions by type signature (e.g. `vec -> usize` or `* -> vec`). ``` -------------------------------- ### Mocking Rust Static Methods Source: https://docs.rs/scraper/0.23.1/scraper/crate/mockall/0.13.1/target-redirect/x86_64-unknown-linux-gnu/mockall/index Mockall supports mocking static methods, but their expectations are global and require a `Context` object for setup. A common pattern is to mock a constructor method to return a configured mock object. ```Rust #[automock] pub trait A { fn foo() -> u32; } let ctx = MockA::foo_context(); ctx.expect().returning(|| 99); assert_eq!(99, MockA::foo()); ``` ```Rust struct Foo{} #[automock] impl Foo { fn from_i32(x: i32) -> Self { // ... } fn foo(&self) -> i32 { // ... } } let ctx = MockFoo::from_i32_context(); ctx.expect() .returning(|x| { let mut mock = MockFoo::default(); mock.expect_foo() .return_const(x); mock }); let foo = MockFoo::from_i32(42); assert_eq!(42, foo.foo()); ``` -------------------------------- ### mockall::PredicateBoxExt Trait Definition Source: https://docs.rs/scraper/0.23.1/scraper/crate/mockall/0.13.1/target-redirect/x86_64-unknown-linux-gnu/mockall/index `Predicate` extension for boxing a `Predicate`. ```APIDOC trait mockall::PredicateBoxExt ``` -------------------------------- ### APIDOC: Keyboard Shortcuts for Documentation Navigation Source: https://docs.rs/scraper/0.23.1/scraper/serde/1.0.4/x86_64-pc-windows-gnu/src/serde/lib.rs This API documentation outlines keyboard shortcuts available for navigating the documentation interface. It provides quick access commands for common actions such as displaying the help dialog, focusing the search bar, and moving through search results. ```APIDOC ? : Show this help dialog S : Focus the search field ⇤ : Move up in search results ⇥ : Move down in search results ⏎ : Go to active search result + : Collapse/expand all sections ``` -------------------------------- ### Mockall Structs API Source: https://docs.rs/scraper/0.23.1/scraper/crate/mockall/0.13.1/target-redirect/x86_64-unknown-linux-gnu/mockall/index Overview of top-level structs provided by Mockall. ```APIDOC Sequence: Description: Used to enforce that mock calls must happen in the sequence specified. ``` -------------------------------- ### Documentation System Keyboard Shortcuts and Search Tricks Source: https://docs.rs/scraper/0.23.1/scraper/serde/1.0.100/x86_64-apple-darwin/src/serde/lib.rs This API documentation describes the keyboard shortcuts available for navigating the documentation interface and provides tips for effective searching, including type-specific prefixes and multi-query searches. ```APIDOC Keyboard Shortcuts: ?: Show this help dialog S: Focus the search field ↑: Move up in search results ↓: Move down in search results ↹: Switch tab ⏎: Go to active search result +: Expand all sections -: Collapse all sections Search Tricks: Prefix searches with a type followed by a colon (e.g., `fn:`) to restrict the search to a given type. Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`. Search functions by type signature (e.g., `vec -> usize` or `* -> vec`) Search multiple things at once by splitting your query with comma (e.g., `str,u8` or `String,struct:Vec,test`) ``` -------------------------------- ### Mockall Macros API Source: https://docs.rs/scraper/0.23.1/scraper/crate/mockall/0.13.1/target-redirect/x86_64-unknown-linux-gnu/mockall/index Overview of top-level macros provided by Mockall. ```APIDOC mock: Description: Manually mock a structure. ``` -------------------------------- ### Documentation User Guide and Search Tips Source: https://docs.rs/scraper/0.23.1/scraper/serde/1.0.16/i686-pc-windows-msvc/src/serde/lib.rs This section outlines keyboard shortcuts for efficient navigation within the documentation and provides advanced search techniques to filter results by specific item types. ```APIDOC Keyboard Shortcuts: ?: Show this help dialog S: Focus the search field ⇤: Move up in search results ⇥: Move down in search results ⏎: Go to active search result +: Collapse/expand all sections Search Tricks: Prefix searches with a type followed by a colon (e.g. fn:) to restrict the search to a given type. Accepted types are: fn, mod, struct, enum, trait, type, macro, and const. Search functions by type signature (e.g. vec -> usize or * -> vec) ``` -------------------------------- ### Mockall Modules API Source: https://docs.rs/scraper/0.23.1/scraper/crate/mockall/0.13.1/target-redirect/x86_64-unknown-linux-gnu/mockall/index Overview of top-level modules provided by Mockall. ```APIDOC examples: Description: Examples of Mockall’s generated code predicate: Description: Predicate factories ``` -------------------------------- ### Documentation Navigation and Search Help Source: https://docs.rs/scraper/0.23.1/scraper/serde/0.9.10/x86_64-apple-darwin/serde/ser/index Provides a guide to keyboard shortcuts for navigating the documentation and advanced search tricks, including type-specific search prefixes and signature-based searches. ```APIDOC Keyboard Shortcuts: ?: Show this help dialog S: Focus the search field ⇤: Move up in search results ⇥: Move down in search results ⏎: Go to active search result +: Collapse/expand all sections Search Tricks: Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type. Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`. Search functions by type signature (e.g. `vec -> usize` or `* -> vec`) ``` -------------------------------- ### Minimal Rust clap Application Source: https://docs.rs/scraper/0.23.1/scraper/crate/clap/0.9 A basic Rust `src/main.rs` example demonstrating the simplest `clap` application setup, initializing an `App` and getting matches without defining arguments. ```Rust extern crate clap; use clap::App; fn main() { let _ = App::new("fake").version("v1.0-beta").get_matches(); } ``` -------------------------------- ### Documentation Help: Keyboard Shortcuts Source: https://docs.rs/scraper/0.23.1/scraper/serde/1.0.30/i686-unknown-linux-gnu/serde/de/index Provides a list of keyboard shortcuts for navigating and interacting with the documentation. ```APIDOC Keyboard Shortcuts: ?: Show this help dialog S: Focus the search field ↑: Move up in search results ↓: Move down in search results ↹: Switch tab ⏎: Go to active search result +: Expand all sections -: Collapse all sections ``` -------------------------------- ### Documentation Search Syntax Examples Source: https://docs.rs/scraper/0.23.1/scraper/serde/1.0.63/i686-apple-darwin/serde/macro.forward_to_deserialize_any Examples demonstrating how to use type-prefixed searches to filter results by specific item types (e.g., functions, modules, structs) and how to search for functions based on their input and output type signatures. ```Search Syntax fn: ``` ```Search Syntax mod: ``` ```Search Syntax struct: ``` ```Search Syntax enum: ``` ```Search Syntax trait: ``` ```Search Syntax type: ``` ```Search Syntax macro: ``` ```Search Syntax const: ``` ```Search Syntax vec -> usize ``` ```Search Syntax * -> vec ``` -------------------------------- ### mockall::PredicateStrExt Trait Definition Source: https://docs.rs/scraper/0.23.1/scraper/crate/mockall/0.13.1/target-redirect/x86_64-unknown-linux-gnu/mockall/index `Predicate` extension adapting a `str` Predicate. ```APIDOC trait mockall::PredicateStrExt ``` -------------------------------- ### mockall::PredicateFileContentExt Trait Definition Source: https://docs.rs/scraper/0.23.1/scraper/crate/mockall/0.13.1/target-redirect/x86_64-unknown-linux-gnu/mockall/index `Predicate` extension adapting a `slice` Predicate. ```APIDOC trait mockall::PredicateFileContentExt ``` -------------------------------- ### Documentation Search and Navigation Help Source: https://docs.rs/scraper/0.23.1/scraper/serde/0.6.10/x86_64-unknown-linux-gnu/serde/ser/trait.Serialize Provides a comprehensive guide to keyboard shortcuts and search functionalities within the documentation interface. It details how to display help, focus search fields, navigate results, expand/collapse sections, and use type-prefixed search queries. ```APIDOC Keyboard Shortcuts ? : Show this help dialog S : Focus the search field ⇤ : Move up in search results ⇥ : Move down in search results ⏎ : Go to active search result + : Collapse/expand all sections Search Tricks Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type. Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`. Search functions by type signature (e.g. `vec -> usize` or `* -> vec`) ``` -------------------------------- ### mockall::PredicateBooleanExt Trait Definition Source: https://docs.rs/scraper/0.23.1/scraper/crate/mockall/0.13.1/target-redirect/x86_64-unknown-linux-gnu/mockall/index `Predicate` extension that adds boolean logic. ```APIDOC trait mockall::PredicateBooleanExt ``` -------------------------------- ### Documentation Search Tricks Source: https://docs.rs/scraper/0.23.1/scraper/serde/1.0.30/i686-apple-darwin/serde/index Tips and tricks for effectively searching the Serde documentation, including type-specific prefixes. ```APIDOC Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type. Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`. Search functions by type signature (e.g. `vec -> usize` or `* -> vec`). ``` -------------------------------- ### mockall::automock Attribute Macro Definition Source: https://docs.rs/scraper/0.23.1/scraper/crate/mockall/0.13.1/target-redirect/x86_64-unknown-linux-gnu/mockall/index Automatically generate mock types for structs and traits. ```APIDOC #[mockall::automock] ``` -------------------------------- ### Documentation Viewer Search Tricks Source: https://docs.rs/scraper/0.23.1/scraper/serde/1.0.70/x86_64-apple-darwin/serde/index Tips and tricks for performing advanced searches within the documentation viewer, including type-specific and multi-query searches. ```APIDOC Search Trick: Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type. Accepted types: fn, mod, struct, enum, trait, type, macro, const. Search Trick: Search functions by type signature (e.g. `vec -> usize` or `* -> vec`). Search Trick: Search multiple things at once by splitting your query with comma (e.g. `str,u8` or `String,struct:Vec,test`). ``` -------------------------------- ### Serde Documentation Navigation and Search Help Source: https://docs.rs/scraper/0.23.1/scraper/serde/1.0.70/i686-apple-darwin/serde/index Provides keyboard shortcuts for navigating the documentation and tips for effective search queries. ```APIDOC Help: Keyboard Shortcuts: ?: Show this help dialog S: Focus the search field ↑: Move up in search results ↓: Move down in search results ↹: Switch tab ⏎: Go to active search result +: Expand all sections -: Collapse all sections Search Tricks: Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type. Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`. Search functions by type signature (e.g. `vec -> usize` or `* -> vec`) Search multiple things at once by splitting your query with comma (e.g. `str,u8` or `String,struct:Vec,test`) ``` -------------------------------- ### Install cutler using the official Bash script Source: https://docs.rs/scraper/0.23.1/scraper/crate/cutler/0.7 This command downloads and executes the official installation script for cutler directly from GitHub, providing a quick way to get started. ```Bash $ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/hitblast/cutler/main/install.sh)" ``` -------------------------------- ### mockall::Predicate Trait Definition Source: https://docs.rs/scraper/0.23.1/scraper/crate/mockall/0.13.1/target-redirect/x86_64-unknown-linux-gnu/mockall/index Trait for generically evaluating a type against a dynamically created predicate function. ```APIDOC trait mockall::Predicate ``` -------------------------------- ### Docs.rs Navigation and Search Help Source: https://docs.rs/scraper/0.23.1/scraper/crate/serde/0.7.15/target-redirect/i686-unknown-linux-gnu/serde/index Details the keyboard shortcuts available for navigating docs.rs and provides tips for using the search functionality effectively, including type-specific searches. ```Documentation Keyboard Shortcuts: ?: Show this help dialog S: Focus the search field ⇤: Move up in search results ⇥: Move down in search results ⏎: Go to active search result +: Collapse/expand all sections Search Tricks: Prefix searches with a type followed by a colon (e.g. fn:) to restrict the search to a given type. Accepted types are: fn, mod, struct, enum, trait, type, macro, and const. Search functions by type signature (e.g. vec -> usize or * -> vec) ``` -------------------------------- ### Create Basic Clap Application in Rust Source: https://docs.rs/scraper/0.23.1/scraper/crate/clap/1.3 Example `main.rs` code demonstrating the minimal setup for a `clap` application. It initializes a new `App` instance and retrieves matches, providing a starting point for custom CLI tools. ```Rust extern crate clap; use clap::App; fn main() { let _ = App::new("fake").version("v1.0-beta").get_matches(); } ``` -------------------------------- ### Documentation Search Tricks Source: https://docs.rs/scraper/0.23.1/scraper/serde/1.0.16/i686-apple-darwin/serde/index Tips for more effective searching within the documentation, including prefixing searches by type signature and listing accepted type prefixes. ```APIDOC Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type. Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`. Search functions by type signature (e.g. `vec -> usize` or `* -> vec`). ``` -------------------------------- ### Documentation Interface Keyboard Shortcuts and Search Syntax Source: https://docs.rs/scraper/0.23.1/scraper/serde/1.0.58/i686-unknown-linux-gnu/src/serde/lib.rs This section outlines keyboard shortcuts for navigating the documentation interface and provides advanced search query syntax for filtering results by type or signature, enhancing user interaction with the documentation. ```APIDOC Keyboard Shortcuts: ?: Show this help dialog S: Focus the search field ↑: Move up in search results ↓: Move down in search results ↹: Switch tab ⏎: Go to active search result +: Expand all sections -: Collapse all sections Search Tricks: Prefix searches with a type followed by a colon (e.g. fn:) to restrict the search to a given type. Accepted types: fn, mod, struct, enum, trait, type, macro, and const. Search functions by type signature (e.g. vec -> usize or * -> vec) ``` -------------------------------- ### Clone and Install `rebar` Benchmarking Tool Source: https://docs.rs/scraper/0.23.1/scraper/crate/regex/^1.10 These commands guide you through cloning the `rebar` repository from GitHub and installing it as a command-line tool using Cargo. `rebar` is used for extensive benchmarking of regex engines. ```Shell $ git clone https://github.com/BurntSushi/rebar $ cd rebar $ cargo install --path ./ ``` -------------------------------- ### Example: Starting Runtime with Time Paused using `#[tokio::main]` Source: https://docs.rs/scraper/0.23.1/scraper/crate/tokio/1.45.1/target-redirect/i686-unknown-linux-gnu/tokio/attr.main This example demonstrates how to configure the `#[tokio::main]` macro to start the `current_thread` runtime with time paused using `start_paused = true`. This feature requires the `test-util` feature flag to be enabled. The equivalent `tokio::runtime::Builder` setup is also shown. ```Rust #[tokio::main(flavor = "current_thread", start_paused = true)] async fn main() { println!("Hello world"); } ``` ```Rust fn main() { tokio::runtime::Builder::new_current_thread() .enable_all() .start_paused(true) .build() .unwrap() .block_on(async { println!("Hello world"); }) } ``` -------------------------------- ### Serde Documentation Navigation and Search Help Source: https://docs.rs/scraper/0.23.1/scraper/serde/1.0.21/i686-pc-windows-msvc/serde/index Provides instructions for navigating the Serde documentation, including keyboard shortcuts for help, search, and result navigation, along with search tricks for filtering by type signature. ```APIDOC Documentation Help: Keyboard Shortcuts: - ?: Show this help dialog - S: Focus the search field - ⇤: Move up in search results - ⇥: Move down in search results - ⏎: Go to active search result - +: Collapse/expand all sections Search Tricks: - Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type. - Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`. - Search functions by type signature (e.g. `vec -> usize` or `* -> vec`) ``` -------------------------------- ### Documentation Search Tips Source: https://docs.rs/scraper/0.23.1/scraper/serde/1.0.11/x86_64-unknown-linux-gnu/serde/index Tips for effectively using the documentation search feature, including prefixing searches by type to narrow down results. ```APIDOC Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type. Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`. Search functions by type signature (e.g. `vec -> usize` or `* -> vec`). ``` -------------------------------- ### Mockall Compatibility with Async Traits Source: https://docs.rs/scraper/0.23.1/scraper/crate/mockall/0.13.1/target-redirect/x86_64-unknown-linux-gnu/mockall/index Illustrates how Mockall works with `async_trait` crate, showing usage with both `#[automock]` and `mock!` macros for async traits. ```Rust // async_trait works with both #[automock] #[automock] #[async_trait] pub trait Foo { async fn foo(&self) -> u32; } // and mock! mock! { pub Bar {} #[async_trait] impl Foo for Bar { async fn foo(&self) -> u32; } } ``` -------------------------------- ### mockall::concretize Attribute Macro Definition Source: https://docs.rs/scraper/0.23.1/scraper/crate/mockall/0.13.1/target-redirect/x86_64-unknown-linux-gnu/mockall/index Decorates a method or function to tell Mockall to treat its generic arguments as trait objects when creating expectations. ```APIDOC #[mockall::concretize] ``` -------------------------------- ### Documentation Navigation and Search Help Source: https://docs.rs/scraper/0.23.1/scraper/serde/1.0.28/x86_64-apple-darwin/src/serde/lib.rs This section provides a guide to keyboard shortcuts for navigating the documentation and tips for using the search functionality, including type-specific search prefixes. ```APIDOC Keyboard Shortcuts: ?: Show this help dialog S: Focus the search field ↑: Move up in search results ↓: Move down in search results ↹: Switch tab ⏎: Go to active search result +: Expand all sections -: Collapse all sections Search Tricks: Prefix searches with a type followed by a colon (e.g. fn:) to restrict the search to a given type. Accepted types are: fn, mod, struct, enum, trait, type, macro, and const. Search functions by type signature (e.g. vec -> usize or * -> vec) ``` -------------------------------- ### Rust Rand Crate Quick Start Example Source: https://docs.rs/scraper/0.23.1/scraper/rand/^0 This example demonstrates basic usage of the `rand` crate in Rust. It shows how to get a random number generator, generate random characters, sample from distributions, shuffle a vector, and choose a random element from a sequence. ```Rust // The prelude import enables methods we use below, specifically // Rng::random, Rng::sample, SliceRandom::shuffle and IndexedRandom::choose. use rand::prelude::*; // Get an RNG: let mut rng = rand::rng(); // Try printing a random unicode code point (probably a bad idea)! println!("char: '{}'", rng.random::()); // Try printing a random alphanumeric value instead! println!("alpha: '{}'", rng.sample(rand::distr::Alphanumeric) as char); // Generate and shuffle a sequence: let mut nums: Vec = (1..100).collect(); nums.shuffle(&mut rng); // And take a random pick (yes, we didn't need to shuffle first!): let _ = nums.choose(&mut rng); ``` -------------------------------- ### Documentation Search Syntax Examples Source: https://docs.rs/scraper/0.23.1/scraper/serde/1.0.20/x86_64-apple-darwin/serde/macro.forward_to_deserialize_any Examples of search syntax for the documentation system. This includes prefixing searches with a type (e.g., 'fn:') to narrow results, and searching functions by their type signatures (e.g., 'vec -> usize'). ```APIDOC fn: mod struct enum trait type macro const vec -> usize * -> vec ``` -------------------------------- ### Documentation Viewer Keyboard Shortcuts and Search Tricks Source: https://docs.rs/scraper/0.23.1/scraper/serde/0.9.7/i686-pc-windows-msvc/src/serde/lib.rs Provides a reference for keyboard shortcuts to navigate the documentation viewer and tips for effective search queries, including type-specific prefixes. ```APIDOC Keyboard Shortcuts: ? Show this help dialog S Focus the search field ⇤ Move up in search results ⇥ Move down in search results ⏎ Go to active search result + Collapse/expand all sections Search Tricks: Prefix searches with a type followed by a colon (e.g. fn:) to restrict the search to a given type. Accepted types are: fn, mod, struct, enum, trait, type, macro, and const. Search functions by type signature (e.g. vec -> usize or * -> vec) ``` -------------------------------- ### Mockall Mocking Foreign Functions (FFI) Source: https://docs.rs/scraper/0.23.1/scraper/crate/mockall/0.13.1/target-redirect/x86_64-unknown-linux-gnu/mockall/index Demonstrates mocking foreign functions within modules using Mockall, highlighting that expectations are global for FFI functions. ```Rust mod outer { #[automock] pub mod ffi { extern "C" { pub fn foo(x: u32) -> i64; } } } #[double] use outer::ffi; fn do_stuff() -> i64 { unsafe{ ffi::foo(42) } } #[cfg(test)] mod t { use super::*; #[test] fn test_foo() { let ctx = ffi::foo_context(); ctx.expect() .returning(|x| i64::from(x + 1)); assert_eq!(43, do_stuff()); } } ``` -------------------------------- ### Mocking Structs with #[automock] and mockall_double Source: https://docs.rs/scraper/0.23.1/scraper/crate/mockall/0.13.1/target-redirect/x86_64-pc-windows-msvc/mockall/index Demonstrates how to mock structs using `#[automock]` and the `mockall_double` crate to handle namespace issues. Shows a complete example with a test case. ```Rust use mockall_double::double; mod thing { use mockall::automock; pub struct Thing{} #[automock] impl Thing { pub fn foo(&self) -> u32 { // ... } } } #[double] use thing::Thing; fn do_stuff(thing: &Thing) -> u32 { thing.foo() } #[cfg(test)] mod t { use super::*; #[test] fn test_foo() { let mut mock = Thing::default(); mock.expect_foo().returning(|| 42); do_stuff(&mock); } } ``` -------------------------------- ### Docs.rs Documentation Search and Navigation Help Source: https://docs.rs/scraper/0.23.1/scraper/html5ever/0.25.0/i686-pc-windows-msvc/html5ever/constant.ATOM_LOCALNAME__6F_6E_6D_6F_75_73_65_64_6F_77_6E This section provides a guide to keyboard shortcuts for navigating and searching within the docs.rs documentation interface. It lists common shortcuts for showing help, focusing search, moving through results, switching tabs, and expanding/collapsing sections. Additionally, it details search tricks, including type-prefixed searches and signature-based searches, to refine query results. ```APIDOC Keyboard Shortcuts: ?: Show this help dialog S: Focus the search field ↑: Move up in search results ↓: Move down in search results ↹: Switch tab ⏎: Go to active search result +: Expand all sections -: Collapse all sections Search Tricks: Prefix searches with a type followed by a colon (e.g., `fn:`) to restrict the search to a given type. Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`. Search functions by type signature (e.g., `vec -> usize` or `* -> vec`) Search multiple things at once by splitting your query with comma (e.g., `str,u8` or `String,struct:Vec,test`) ``` -------------------------------- ### Docs.rs Documentation Platform Keyboard Shortcuts and Search Tricks Source: https://docs.rs/scraper/0.23.1/scraper/crate/serde/0.6.15/target-redirect/x86_64-apple-darwin/serde/index Provides a guide to keyboard shortcuts and search functionalities available on the docs.rs platform for navigating documentation. ```APIDOC Keyboard Shortcuts: ?: Show this help dialog S: Focus the search field ⇤: Move up in search results ⇥: Move down in search results ⏎: Go to active search result +: Collapse/expand all sections Search Tricks: Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type. Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`. Search functions by type signature (e.g. `vec -> usize` or `* -> vec`) ``` -------------------------------- ### Example Console Output from a Criterion.rs Benchmark Run Source: https://docs.rs/scraper/0.23.1/scraper/crate/criterion/^0.5 Illustrative output from running `cargo bench` with Criterion.rs, showing the measured time range for the benchmark, and details on detected outliers. ```Text Running target/release/deps/example-423eedc43b2b3a93 fib 20 time: [26.029 us 26.251 us 26.505 us] Found 11 outliers among 99 measurements (11.11%) 6 (6.06%) high mild 5 (5.05%) high severe ``` -------------------------------- ### Serde Documentation Navigation and Search Help Source: https://docs.rs/scraper/0.23.1/scraper/serde/1.0.8/i686-unknown-linux-gnu/serde/index Instructions for navigating the Serde documentation, including keyboard shortcuts for quick actions and advanced search functionalities to filter results by type signature or specific item types like functions, modules, or traits. ```APIDOC Keyboard Shortcuts: ?: Show this help dialog S: Focus the search field ⇤: Move up in search results ⇥: Move down in search results ⏎: Go to active search result +: Collapse/expand all sections Search Tricks: Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type. Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`. Search functions by type signature (e.g. `vec -> usize` or `* -> vec`). ``` -------------------------------- ### Minimal Clap Application in Rust Source: https://docs.rs/scraper/0.23.1/scraper/crate/clap/2.21 A minimal Rust program demonstrating the basic setup for a `clap` application, initializing a new `App` instance with a name and version, and immediately getting matches. ```Rust extern crate clap; use clap::App; fn main() { App::new("fake").version("v1.0-beta").get_matches(); } ``` -------------------------------- ### Serde Documentation Search Functionality Source: https://docs.rs/scraper/0.23.1/scraper/serde/1.0.39/x86_64-apple-darwin/serde/index Explains how to use type prefixes to refine search queries within the Serde documentation, listing accepted search types and signature search examples. ```APIDOC Prefix searches with a type followed by a colon (e.g. fn:) to restrict the search to a given type. Accepted types are: fn, mod, struct, enum, trait, type, macro, and const. Search functions by type signature (e.g. vec -> usize or * -> vec) ``` -------------------------------- ### Mockall Context Checkpoint for Static Methods Source: https://docs.rs/scraper/0.23.1/scraper/crate/mockall/0.13.1/target-redirect/x86_64-unknown-linux-gnu/mockall/index Illustrates that a mock object's `checkpoint` method does not apply to static methods, useful when using multiple mock objects. ```Rust #[automock] pub trait A { fn build() -> Self; fn bar(&self) -> i32; } let ctx = MockA::build_context(); ctx.expect() .times(2) .returning(|| MockA::default()); let mut mock0 = MockA::build(); mock0.expect_bar().return_const(4); mock0.bar(); mock0.checkpoint(); // Does not checkpoint the build method let mock1 = MockA::build(); ``` -------------------------------- ### Documentation Interface: Keyboard Shortcuts Source: https://docs.rs/scraper/0.23.1/scraper/serde/0.9.7/i686-apple-darwin/src/serde/lib.rs This API documentation describes the keyboard shortcuts available for navigating and interacting with the online documentation. It lists keys for showing help, focusing search, moving through results, and collapsing/expanding sections. ```APIDOC ? : Show this help dialog S : Focus the search field ⇤ : Move up in search results ⇥ : Move down in search results ⏎ : Go to active search result + : Collapse/expand all sections ``` -------------------------------- ### Git Workflow for Contributing to Clap-rs Source: https://docs.rs/scraper/0.23.1/scraper/crate/clap/1.3 Provides a step-by-step guide using common Git commands for contributing to the clap-rs project, covering initial setup, making changes, and preparing for a pull request. ```shell git clone https://github.com/$YOUR_USERNAME/clap-rs && cd clap-rs git checkout -b new-branch git commit -am "your message" git rebase -i HEAD~NUM git push origin $your-branch ``` -------------------------------- ### Mockall Nightly Feature: Default Return Values Source: https://docs.rs/scraper/0.23.1/scraper/crate/mockall/0.13.1/target-redirect/x86_64-unknown-linux-gnu/mockall/index Demonstrates the 'nightly' feature where methods with `Default` return types automatically return default values without explicit setting. ```Rust #[automock] trait Foo { fn foo(&self) -> Vec; } let mut mock = MockFoo::new(); mock.expect_foo(); assert!(mock.foo().is_empty()); ``` -------------------------------- ### Documentation Search Tricks Source: https://docs.rs/scraper/0.23.1/scraper/serde/1.0.27/i686-apple-darwin/serde/index Tips and tricks for more effective searching within the documentation, including type-specific prefixes and signature searches. ```APIDOC - Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type. - Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`. - Search functions by type signature (e.g. `vec -> usize` or `* -> vec`). ``` -------------------------------- ### Mocking Rust Traits with Associated Types Source: https://docs.rs/scraper/0.23.1/scraper/crate/mockall/0.13.1/target-redirect/x86_64-unknown-linux-gnu/mockall/index Traits with associated types can be mocked by specifying the associated types as metaitems to the `#[automock]` attribute, rather than making the mock struct generic. ```Rust #[automock(type Key=u16; type Value=i32;)] pub trait A { type Key; type Value; fn foo(&self, k: Self::Key) -> Self::Value; } let mut mock = MockA::new(); mock.expect_foo() .returning(|x: u16| i32::from(x)); assert_eq!(4, mock.foo(4)); ``` -------------------------------- ### Documentation Search Syntax Examples Source: https://docs.rs/scraper/0.23.1/scraper/serde/1.0.31/x86_64-apple-darwin/serde/macro.forward_to_deserialize_any Illustrates various search patterns for the documentation system, including prefixing searches by type and searching by type signatures. ```Search Syntax fn: ``` ```Search Syntax vec -> usize ``` ```Search Syntax * -> vec ``` -------------------------------- ### Mockall: Verify Fixed Call Counts (Rust) Source: https://docs.rs/scraper/0.23.1/scraper/crate/mockall/0.13.1/target-redirect/x86_64-unknown-linux-gnu/mockall/index Shows how to use `times()` to verify that an expectation was called a fixed number of times. By default, expectations are allowed unlimited calls. ```Rust #[automock] trait Foo { fn foo(&self, x: u32); } let mut mock = MockFoo::new(); mock.expect_foo() .times(1) .return_const(()); mock.foo(0); // Ok mock.foo(1); // Panics! ``` -------------------------------- ### Rustdoc Search Tricks and Syntax Source: https://docs.rs/scraper/0.23.1/scraper/serde/1.0.89/x86_64-apple-darwin/settings Guidelines and examples for using advanced search functionalities within the docs.rs documentation, including type-specific prefixes and multi-query searches. ```APIDOC Prefix searches with a type followed by a colon (e.g., `fn:`) to restrict the search to a given type. Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`. Search functions by type signature (e.g., `vec -> usize` or `* -> vec`) Search multiple things at once by splitting your query with comma (e.g., `str,u8` or `String,struct:Vec,test`) ``` -------------------------------- ### Mocking Methods Returning impl Trait (Working Example) Source: https://docs.rs/scraper/0.23.1/scraper/crate/mockall/0.13.1/target-redirect/x86_64-pc-windows-msvc/mockall/index Demonstrates how Mockall handles methods returning `impl Trait`, internally transforming the expectation's return type to `Box` without altering the mock method's signature. Shows a working example with `impl Debug`. ```Rust struct Foo {} #[automock] impl Foo { fn foo(&self) -> impl Debug { // ... } } let mut mock = MockFoo::new(); mock.expect_foo() .returning(|| Box::new(String::from("Hello, World!"))); println!("{:?}", mock.foo()); ``` -------------------------------- ### Documentation Search Tricks Source: https://docs.rs/scraper/0.23.1/scraper/serde/1.0.34/x86_64-apple-darwin/serde/index Tips for refining search queries within the documentation, including type-specific prefixes and signature searches. ```APIDOC Prefix searches with a type followed by a colon (e.g. `fn:`): to restrict the search to a given type. Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`. Search functions by type signature (e.g. `vec -> usize` or `* -> vec`): Example type signature searches. ``` -------------------------------- ### Mocking Generic Rust Static Methods Source: https://docs.rs/scraper/0.23.1/scraper/crate/mockall/0.13.1/target-redirect/x86_64-unknown-linux-gnu/mockall/index Mocking static methods of generic structs or traits, regardless of whether the methods themselves are generic, functions seamlessly provided the generic parameter is `'static`. ```Rust #[automock] trait Foo { fn new(t: T) -> MockFoo; } let ctx = MockFoo::::new_context(); ctx.expect() .returning(|_| MockFoo::default()); let mock = MockFoo::::new(42u32); ``` -------------------------------- ### Documentation Viewer Keyboard Shortcuts and Search Tricks Source: https://docs.rs/scraper/0.23.1/scraper/serde/1.0.8/x86_64-pc-windows-gnu/src/serde/lib.rs This section provides a user guide for navigating the documentation viewer. It lists keyboard shortcuts for common actions like showing help, focusing search, and moving through results, along with search syntax tips for filtering by type and signature. ```APIDOC Keyboard Shortcuts ? : Show this help dialog S : Focus the search field ⇤ : Move up in search results ⇥ : Move down in search results ⏎ : Go to active search result + : Collapse/expand all sections Search Tricks Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type. Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`. Search functions by type signature (e.g. `vec -> usize` or `* -> vec`) ``` -------------------------------- ### Documentation Navigation Keyboard Shortcuts Source: https://docs.rs/scraper/0.23.1/scraper/serde/1.0.59/i686-apple-darwin/serde/ser/index Provides a list of keyboard shortcuts for navigating and interacting with the documentation, including showing help, focusing search, moving through results, switching tabs, and expanding/collapsing sections. ```APIDOC ?: Show this help dialog S: Focus the search field ↑: Move up in search results ↓: Move down in search results ↹: Switch tab ⏎: Go to active search result +: Expand all sections -: Collapse all sections ``` -------------------------------- ### Mocking External Rust Traits Source: https://docs.rs/scraper/0.23.1/scraper/crate/mockall/0.13.1/target-redirect/x86_64-unknown-linux-gnu/mockall/index Mockall can mock traits and structs defined in external crates that are beyond direct control. This requires using the `mock!` macro instead of the `#[automock]` attribute. ```Rust mock! { MyStruct {} // Name of the mock struct, less the "Mock" prefix impl Clone for MyStruct { // specification of the trait to mock fn clone(&self) -> Self; } } let mut mock1 = MockMyStruct::new(); let mock2 = MockMyStruct::new(); mock1.expect_clone() .return_once(move || mock2); let cloned = mock1.clone(); ``` -------------------------------- ### Documentation Viewer Keyboard Shortcuts Source: https://docs.rs/scraper/0.23.1/scraper/serde/1.0.70/x86_64-apple-darwin/serde/index Keyboard shortcuts for navigating and interacting with the documentation viewer interface. ```APIDOC Key: ? Action: Show this help dialog Key: S Action: Focus the search field Key: ↑ Action: Move up in search results Key: ↓ Action: Move down in search results Key: ↹ Action: Switch tab Key: ⏎ Action: Go to active search result Key: + Action: Expand all sections Key: - Action: Collapse all sections ``` -------------------------------- ### Mockall: Mock Methods with Reference Arguments (Rust) Source: https://docs.rs/scraper/0.23.1/scraper/crate/mockall/0.13.1/target-redirect/x86_64-unknown-linux-gnu/mockall/index Shows how Mockall handles methods with reference arguments. The `Predicate` matcher will take reference arguments by value, not by reference, which is demonstrated with `withf`. ```Rust #[automock] trait Foo { fn foo(&self, x: &u32) -> u32; } let mut mock = MockFoo::new(); let e = mock.expect_foo() // Note that x is a &u32, not a &&u32 .withf(|x: &u32| *x == 5) .returning(|x: &u32| *x + 1); assert_eq!(6, mock.foo(&5)); ``` -------------------------------- ### Mockall: Enforce Call Order with Sequences (Rust) Source: https://docs.rs/scraper/0.23.1/scraper/crate/mockall/0.13.1/target-redirect/x86_64-unknown-linux-gnu/mockall/index Explains how to use `Sequence` to specify the order in which expectations must be matched. Expectations added to the same sequence must be called in the order they were defined. ```Rust #[automock] trait Foo { fn foo(&self); } let mut seq = Sequence::new(); let mut mock1 = MockFoo::new(); mock1.expect_foo() .times(1) .in_sequence(&mut seq) .returning(|| ()); let mut mock2 = MockFoo::new(); mock2.expect_foo() .times(1) .in_sequence(&mut seq) .returning(|| ()); mock2.foo(); // Panics! mock1.foo should've been called first. ``` -------------------------------- ### Rustdoc Keyboard Shortcuts Reference Source: https://docs.rs/scraper/0.23.1/scraper/serde/1.0.89/i686-apple-darwin/settings A comprehensive list of keyboard shortcuts available in the Rustdoc interface for efficient navigation and interaction. ```APIDOC Keyboard Shortcuts: ?: Show this help dialog S: Focus the search field ↑: Move up in search results ↓: Move down in search results ↹: Switch tab ⏎: Go to active search result +: Expand all sections -: Collapse all sections ``` -------------------------------- ### Serde Core Modules Overview Source: https://docs.rs/scraper/0.23.1/scraper/crate/serde/0.6.15/target-redirect/x86_64-unknown-linux-gnu/serde/index An overview of the main modules provided by the Serde framework, detailing their specific functionalities within the serialization and deserialization process. ```APIDOC Modules: - bytes: Helper module to enable serializing bytes more efficiently - de: Generic deserialization framework. - iter: Module that contains helper iterators. - ser: Generic serialization framework. ``` -------------------------------- ### Define a Fibonacci Benchmark with Criterion.rs in Rust Source: https://docs.rs/scraper/0.23.1/scraper/crate/criterion/^0.5 Create a Rust file (`$PROJECT/benches/my_benchmark.rs`) to define a benchmark function. This example uses `criterion_group!` and `criterion_main!` to benchmark a Fibonacci calculation, demonstrating `black_box` for accurate measurement. ```Rust use criterion::{black_box, criterion_group, criterion_main, Criterion}; fn fibonacci(n: u64) -> u64 { match n { 0 => 1, 1 => 1, n => fibonacci(n-1) + fibonacci(n-2), } } fn criterion_benchmark(c: &mut Criterion) { c.bench_function("fib 20", |b| b.iter(|| fibonacci(black_box(20)))); } criterion_group!(benches, criterion_benchmark); criterion_main!(benches); ``` -------------------------------- ### Serde Modules Overview Source: https://docs.rs/scraper/0.23.1/scraper/serde/1.0.36/x86_64-apple-darwin/serde/index Documentation for core Serde modules, including generic data structure deserialization and serialization frameworks. ```APIDOC Module: de Description: Generic data structure deserialization framework. Module: ser Description: Generic data structure serialization framework. ``` -------------------------------- ### Mockall: Validate and Clear Expectations with Checkpoints (Rust) Source: https://docs.rs/scraper/0.23.1/scraper/crate/mockall/0.13.1/target-redirect/x86_64-unknown-linux-gnu/mockall/index Demonstrates the `checkpoint` method, which immediately validates all current expectations. If expectations haven't met their call count, it will panic. Afterwards, expectations are cleared. ```Rust #[automock] trait Foo { fn foo(&self); } let mut mock = MockFoo::new(); mock.expect_foo() .times(2) .returning(|| ()); mock.foo(); mock.checkpoint(); // Panics! foo hasn't yet been called twice. ``` -------------------------------- ### Mocking Multiple and Inherited Rust Traits Source: https://docs.rs/scraper/0.23.1/scraper/crate/mockall/0.13.1/target-redirect/x86_64-unknown-linux-gnu/mockall/index To create a mock struct that implements multiple traits, including inherited ones, the `mock!` macro must be used. Once created, the mock object is used in the same way as any other. ```Rust pub trait A { fn foo(&self); } pub trait B: A { fn bar(&self); } mock! { // Structure to mock C {} // First trait to implement on C impl A for C { fn foo(&self); } // Second trait to implement on C impl B for C { fn bar(&self); } } let mut mock = MockC::new(); mock.expect_foo().returning(|| ()); mock.expect_bar().returning(|| ()); mock.foo(); mock.bar(); ``` -------------------------------- ### Application Keyboard Shortcuts and Search Syntax Help Source: https://docs.rs/scraper/0.23.1/scraper/serde/1.0.56/x86_64-pc-windows-msvc/src/serde/lib.rs This section provides user assistance documentation, detailing keyboard shortcuts for navigation and interaction within the application interface, along with specific syntax rules for advanced search queries. It serves as a quick reference for users to efficiently utilize the application's features. ```APIDOC Keyboard Shortcuts: ?: Show this help dialog S: Focus the search field ↑: Move up in search results ↓: Move down in search results ↹: Switch tab ⏎: Go to active search result +: Expand all sections -: Collapse all sections Search Tricks: Prefix searches with a type followed by a colon (e.g. fn:) to restrict the search to a given type. Accepted types are: fn, mod, struct, enum, trait, type, macro, and const. Search functions by type signature (e.g. vec -> usize or * -> vec) ``` -------------------------------- ### Mocking Methods Returning Static References in Rust Source: https://docs.rs/scraper/0.23.1/scraper/crate/mockall/0.13.1/target-redirect/x86_64-unknown-linux-gnu/mockall/index Demonstrates how to mock a method that returns a reference with a 'static lifetime. Mockall treats these similarly to other 'static values, allowing return_const to be used with a static reference. ```Rust struct Thing(u32); #[automock] trait Container { fn get(&self, i: u32) -> &'static Thing; } const THING: Thing = Thing(42); let mut mock = MockContainer::new(); mock.expect_get() .return_const(&THING); assert_eq!(42, mock.get(0).0); ``` -------------------------------- ### Documentation Navigation: Keyboard Shortcuts Source: https://docs.rs/scraper/0.23.1/scraper/serde/1.0.29/x86_64-apple-darwin/serde/de/index Provides a list of keyboard shortcuts for navigating and interacting with the documentation, including showing help, focusing search, moving through results, switching tabs, and expanding/collapsing sections. ```APIDOC ? : Show this help dialog S : Focus the search field ↑ : Move up in search results ↓ : Move down in search results ↹ : Switch tab ⏎ : Go to active search result + : Expand all sections - : Collapse all sections ``` -------------------------------- ### Mockall: Checkpoint Clears Expectations (Rust) Source: https://docs.rs/scraper/0.23.1/scraper/crate/mockall/0.13.1/target-redirect/x86_64-unknown-linux-gnu/mockall/index Further illustrates the `checkpoint` method's behavior: after a checkpoint, all previous expectations are cleared, meaning subsequent calls to the mocked method will panic if no new expectations are set. ```Rust #[automock] trait Foo { fn foo(&self); } let mut mock = MockFoo::new(); mock.expect_foo() .times(1) .returning(|| ()); mock.foo(); mock.checkpoint(); mock.foo(); // Panics! The expectation has been cleared. ```