crates.io
...u32) -> u32 { match n { 1 | 2 => 1, _ => fibonacci(n - 1) + fibonacci(n - 2), } } /// use `Fn`, `FnMut` or `FnOnce` traits to defined JavaScript callbacks /// the return type of callbacks can only be `Result`. #[napi] pub fn get_cwd<T: Fn(String) -> Result<()>>(callback: T) { callback( std::env::current_dir() .unwrap() .to...
Crate
v3.12.2
2026-08-21
docs.rs
...vec_debug => Replaces the default Debug trait implementation with a custom one that prints the bitmask as a vec of all matching values. flags_iter => Adds a ::flags() method that returns an iterator over all flags of the bitmask represented as a tuple (name, flag) . If you need / can think...
Crate
v2.2.5
2024-10-22
docs.rs
...use libproc::libproc::proc_pid; match proc_pid::pidpath(pid) { Ok(path) => println!("PID {}: has path {}", pid, path), Err(err) => writeln!(&mut std::io::stderr(), "Error: {}", err).unwrap() } You can find the latest published release on crates.io You can find the browseable docs for the latest release on docs...
Crate
v0.14.11
2025-10-01
docs.rs
...HList![ isize, bool, &str ] = t3.into(); assert_eq!(h3, hlist![ 999, false, "world" ]); HLists have a hlist_pat! macro for pattern matching; let h: HList!(&str, &str, i32, bool) = hlist!["Joe", "Blow", 30, true]; // We use the HList! type macro to make it easier to write // a type signature for...
Crate
v0.5.0
2026-07-04
api.rocket.rs
...Your code's style should match the existing and surrounding code style. Simple: Your code should accomplish its task as simply and idiomatically as possible. Tested: You must write (and pass) convincing tests for any new functionality. Focused: Your code should do what it's supposed to and nothing more...
Crate
v0.5.1
2024-05-23
api.rocket.rs
...Your code's style should match the existing and surrounding code style. Simple: Your code should accomplish its task as simply and idiomatically as possible. Tested: You must write (and pass) convincing tests for any new functionality. Focused: Your code should do what it's supposed to and nothing more...
Crate
v0.5.1
2024-05-23
api.rocket.rs
...Your code's style should match the existing and surrounding code style. Simple: Your code should accomplish its task as simply and idiomatically as possible. Tested: You must write (and pass) convincing tests for any new functionality. Focused: Your code should do what it's supposed to and nothing more...
Crate
v0.5.1
2024-05-23
docs.rs
...let job = Exec::cmd("sleep").arg("10").start()?; match job.wait_timeout(Duration::from_secs(1))? { Some(status) => println!("finished: {:?}", status), None => { job.terminate()?; job.wait()?; } } License subprocess is distributed under the terms of both the MIT license and the Apache License (Version 2.0). See LICENSE-APACHE and LICENSE...
Crate
v1.2.1
2026-08-05
burntsushi.net
...For example, it should be possible to only show completions that can lead to a valid Docopt match. This may be hard. (i.e., It may require restructuring Docopt's internals.) Support more shells. (I'll happily accept pull requests on this one. I doubt I'll venture outside of...
Crate
v1.1.1
2021-03-12
docs.rs
...use { solana_program::{entrypoint::ProgramResult, program_error::ProgramError}, spl_tlv_account_resolution::state::ExtraAccountMetaList, spl_transfer_hook_interface::instruction::{ExecuteInstruction, TransferHookInstruction}, spl_type_length_value::state::TlvStateBorrowed, }; pub fn process_instruction( program_id: &Pubkey, accounts: &[AccountInfo], input: &[u8], ) -> ProgramResult { let instruction = TransferHookInstruction::unpack(input)?; let _amount = match instruction { TransferHookInstruction::Execute...
Crate
v2.1.0
2025-11-05
docs.rs
...Lastly, the tap module also has traits TapOptional and TapFallible which run taps on the variants of Option and Result enums, respectively, and do nothing when the variant does not match the method name. TapOptional::tap_some has no effect when called on a None , etc.
Crate
v1.0.1
2021-02-13
docs.rs
...RUSTFLAGS="-Clinker-plugin-lto -Clinker=clang -Clink-arg=-fuse-ld=lld" cargo build Note that the clang version must match the rustc LLVM version . If not, it is possible to encounter errors when running the ethnum-intrinsics build script. You can verify the LLVM version used by rustc with: rustc...
Crate
v1.5.3
2026-04-20
crates.io
...Myers algorithm has been enhanced with preprocessing and multiple heuristics to ensure fast runtime in pathological cases to avoid quadratic time complexity and closely matches the behavior of gnu-diff and git. The histogram algorithm was originally ported from git but has been heavily optimized. The Histogram algorithm outperforms Myers...
Crate
v0.2.0
2025-06-14
docs.rs
...that case where libEGL.so.1 provides a more recent version of EGL, you can still upcast ths instance to provide version specific features: match egl.upcast::<egl::EGL1_5>() { Some(egl1_5) => { // do something with EGL 1.5 } None => { // do something with EGL 1.4 instead. } }; NixOS A shell...
Crate
v6.0.0
2023-10-05
crates.io
...Sum, _ctx: &mut Context<Self>) -> Self::Result { msg.0 + msg.1 } } #[actix::main] // <- starts the system and block until future resolves async fn main() { let addr = Calculator.start(); let res = addr.send(Sum(10, 5)).await; // <- send message and get future for result match res { Ok(result) => println!("SUM: {}", result...
Crate
v0.13.5
2024-06-09
crates.io
...This means that it's important to match whichever regex implementation syntect is using * This is also why fancy's bundled syntax definitions are smaller than onig's default: syntect-onig Feature Desc. syntect-onig / syntect-fancy Enables the minimal feature set that we require from syntect syntect-default-onig...
Crate
v0.5.2+bat-0.26.1
2026-08-07
magiclen.org
...use std::path::Path; use std::env; use path_dedot::*; let p = Path::new("../path/to/123/456"); let cwd = env::current_dir().unwrap(); let cwd_parent = cwd.parent(); match cwd_parent { Some(cwd_parent) => { assert_eq!(Path::join(&cwd_parent, Path::new("path/to/123/456")).to_str().unwrap...
Crate
v4.0.1
2026-07-11
docs.rs
...integer, and a float otherwise str::regex_matches 2 String, String Returns true if the first argument matches the regex in the second argument (Requires regex_support feature flag) str::regex_replace 3 String, String, String Returns the first argument with all matches of the regex in the second argument...
Crate
v13.1.0
2025-11-26
docs.rs
...derive(Embed)] #[folder = "$CARGO_MANIFEST_DIR/foo"] struct Asset; include-exclude : Filter files to be embedded with multiple #[include = "*.txt"] and #[exclude = "*.jpg"] attributes. Matching is done on relative file paths, via globset . exclude attributes have higher priority than include attributes. use rust_embed::Embed; #[derive(Embed)] #[folder = "examples/public...
Crate
v8.12.0
2026-07-08
docs.rs
...use num_format::SystemLocale; fn main() { let locale = SystemLocale::default().unwrap(); println!("My system's default locale is..."); println!("{:#?}", &locale); let available = SystemLocale::available_names().unwrap(); println!("My available locale names are..."); println!("{:#?}", available); match SystemLocale::from_name("en_US") { Ok(_) => println!("My system has the 'en_US' locale."), Err...
Crate
v0.4.4
2022-12-03