docs.rs
Find peaks that match criteria in 1D data. Description Find a filtered subset of local maxima in 1D slice of data. The functionality implemented here is might be familiar to anyone using MATLAB's findpeaks , or Python's scipy.signal.find_peaks . Arguably, the most useful feature in this package...
Crate
v0.1.5
2022-05-18
docs.rs
...Principle of Operation In general chardetng prefers to do negative matching (rule out possibilities from the set of plausible encodings) than to do positive matching. Since negative matching is insufficient, there is positive matching, too. Except for ISO-2022-JP, pairs of ASCII bytes never contribute to the detection, which...
Crate
v1.0.0
2026-03-30
docs.rs
...Example use rustyline::error::ReadlineError; use rustyline::{DefaultEditor, Result}; fn main() -> Result<()> { // `()` can be used when no completer is required let mut rl = DefaultEditor::new()?; #[cfg(feature = "with-file-history")] if rl.load_history("history.txt").is_err() { println!("No previous history."); } loop { let readline = rl.readline(">> "); match readline { Ok...
Crate
v18.0.1
2026-06-24
docs.rs
...42, }; match syslog::unix(formatter) { Err(e) => println!("impossible to connect to syslog: {:?}", e), Ok(mut writer) => { writer.err("hello world").expect("could not write error message"); } } } The struct syslog::Logger implements Log from the log crate, so it can be used as backend for other logging systems: extern crate...
Crate
v7.0.0
2024-07-26
docs.rs
...Cohen-Sutherland TODO Cyrus-Beck Liang-Barsky Nicholl-Lee-Nicholl More comprehensive testing Installation cargo add line-clipping Minimum supported Rust version The crate is built with Rust 1.85 to match the 2024 edition. The MSRV may increase in a future minor release, but will be noted in the...
Crate
v0.3.8
2026-08-03
docs.rs
...use futures_util::StreamExt; use socketcan::{tokio::CanSocket, CanFrame, Result}; #[tokio::main] async fn main() -> Result<()> { let mut sock_rx = CanSocket::open("vcan0")?; let sock_tx = CanSocket::open("can0")?; while let Some(Ok(frame)) = sock_rx.next().await { if matches!(frame, CanFrame::Data(_)) { sock_tx.write_frame(frame).await?; } } Ok...
Crate
v3.6.2
2026-06-19
docs.rs
...bool, } fn parse_args() -> Result<Args, lexopt::Error> { use lexopt::prelude::*; let mut thing = None; let mut number = 1; let mut shout = false; let mut parser = lexopt::Parser::from_env(); while let Some(arg) = parser.next()? { match arg { Short('n') | Long("number") => { number = parser.value()?.parse()?; } Long("shout") => { shout = true...
Crate
v0.3.2
2026-02-28
crates.io
...use btoi::btoi; assert_eq!(Ok(42), btoi(b"42")); assert_eq!(Ok(-1000), btoi(b"-1000")); Documentation Read the documentation MSRV policy The minimum supported Rust version is 1.60, matching num_traits , with no intent to ever increase it. That's because #![feature(int_from_ascii)] in the...
Crate
v0.5.0
2025-05-29
docs.rs
...Only emits a single Rename event if the rename From and To events can be matched Merges multiple Rename events Takes Rename events into account and updates paths for events that occurred before the rename event, but which haven't been emitted, yet Optionally keeps track of the file system...
Crate
v0.8.0-rc.2
2026-05-02
docs.rs
...YAML that doesn’t match the expected Rust types is rejected early. Safer by construction: serde-saphyr avoids the typical YAML remote code execution vulnerability because it does not support or implement tag-driven object instantiation. Instead, it deserializes into fixed Rust types via Serde, removing the object-instantiation mechanism...
Crate
v1.1.0
2026-08-15
crates.io
...Pin<&mut Self>) { match self.project() { EnumProj::Pinned(x) => { let _: Pin<&mut T> = x; } EnumProj::Unpinned(y) => { let _: &mut U = y; } } } } code like this will be generated See #[pin_project] attribute for more details, and see examples directory for more examples and generated code. Related Projects pin-project-lite : A...
Crate
v1.1.13
2026-05-13
crates.io
...for n in 0..100 { match circuit_breaker.call(|| dangerous_call()) { Err(Error::Inner(_)) => { eprintln!("{}: fail", n); }, Err(Error::Rejected) => { eprintln!("{}: rejected", n); break; }, _ => {} } } Or configure custom backoff and policy: use std::time::Duration; use failsafe::{backoff, failure_policy, CircuitBreaker}; // Create an exponential growth backoff which starts from 10s and...
Crate
v1.3.0
2024-07-05
docs.rs
...SocketAddr = (ip, port).into(); let (name, service) = match getnameinfo(&socket, 0) { Ok((n, s)) => (n, s), Err(e) => panic!("Failed to lookup socket {:?}", e), }; println!("{:?} {:?}", name, service); let _ = (name, service); } { use dns_lookup::gethostname; let hostname = gethostname().unwrap(); }
Crate
v3.0.1
2025-10-20
docs.rs
...use tree_sitter_highlight::HighlightEvent; let highlights = highlighter.highlight( &javascript_config, b"const x = new Y();", None, |_| None ).unwrap(); for event in highlights { match event.unwrap() { HighlightEvent::Source {start, end} => { eprintln!("source: {start}-{end}"); }, HighlightEvent::HighlightStart(s) => { eprintln!("highlight style started: {s:?}"); }, HighlightEvent::HighlightEnd => { eprintln!("highlight style ended"); }, } } The last...
Crate
v0.26.11
2026-07-12
docs.rs
...let recording_rules = client.rules().kind(RuleKind::Recording).get().await; assert!(recording_rules.is_ok()); // Retrieve a list of time series that match certain labels sets ("series selectors"). let select1 = Selector::new() .eq("handler", "/api/v1/query"); let select2 = Selector::new() .eq("job", "node") .regex_eq("mode", ".+"); let time_series...
Crate
v0.9.0
2026-05-09
github.com
...u64 = match r.payload { j::ResponsePayload::Success(val) => serde_json::from_str(val.get()).unwrap(), j::ResponsePayload::Failure(err) => panic!("unexpected error: {err}"), }; assert_eq!(n, 12345); } Low-level Ethereum JSON-RPC transport abstraction. This crate handles RPC connection and request management. It builds an RpcClient on top of the...
Crate
v2.4.1
2026-08-13
docs.rs
...join("CMakeLists.txt").exists()); let mut builder = cmake::Config::new(lib_source_dir); // Look for -Zsanitizer=address for flag in rustflags::from_env() { if matches!(flag, Flag::Z(z) if z == "sanitizer=address") { builder.define("ENABLE_SANITIZERS", "ON"); builder.define("SANITIZERS", "address"); break; } } builder.build(); } License Licensed under either of...
Crate
v0.1.7
2025-03-03
github.com
...This allows the Provider to expose a consistent interface to the rest of the program, while adjusting request and response types to match the underlying blockchain. Providers can be composed via stacking. For example, a Provider that tracks the nonce for a given address can be stacked onto a Provider...
Crate
v2.4.1
2026-08-13
docs.rs
...The value is scaled to match that suffix if possible. use human_format::Formatter; let mut f = Formatter::new(); f.with_suffix("M"); assert_eq!(f.format(100_000.0), "0.10 M"); If the suffix is not valid for the current Scales , the formatter falls back to automatic selection...
Crate
v1.2.1
2026-01-17
docs.rs
Automata construction and matching using regular expressions. regex-automata This crate exposes a variety of regex engines used by the regex crate. It provides a vast, sprawling and "expert" level API to each regex engine. The regex engines provided by this crate focus heavily on finite automata implementations and specifically...
Crate
v0.4.18
2026-08-04