docs.rs
...use palette::{ encoding, white_point, rgb::Rgb, chromatic_adaptation::AdaptFrom, Srgb }; // RgbStandard and RgbSpace are implemented for 2 and 3 element tuples, // allowing mixing and matching of existing types. In this case we are // combining sRGB primaries, the CIE equal energy white point and the // sRGB transfer function (a.k...
Crate
v0.7.7
2026-08-02
crates.io
...An array may have a fixed length that matches a fixed list of item types; this is well represented by a Rust tuple. The distinction between Vec<T> and HashSet<T> is only if the schema's uniqueItems field is false or true respectively. Objects In general, objects turn into...
Crate
v0.7.0
2026-06-05
crates.io
...An array may have a fixed length that matches a fixed list of item types; this is well represented by a Rust tuple. The distinction between Vec<T> and HashSet<T> is only if the schema's uniqueItems field is false or true respectively. Objects In general, objects turn into...
Crate
v0.7.0
2026-06-05
crates.io
...An array may have a fixed length that matches a fixed list of item types; this is well represented by a Rust tuple. The distinction between Vec<T> and HashSet<T> is only if the schema's uniqueItems field is false or true respectively. Objects In general, objects turn into...
Crate
v0.7.0
2026-06-05
docs.rs
...result = r#"LOAD DATA LOCAL INFILE 'whatever' INTO TABLE `tmp` FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\r\n'"#.ignore(&mut conn).await; match result { Ok(()) => (), Err(Error::Server(ref err)) if err.code == 1148 => { // The used command is not allowed with this MySQL version return Ok(()); }, Err(Error...
Crate
v0.37.0
2026-05-25
docs.rs
...When using bitvec to manage protocol buffers, you will need to select the exact type parameters that match your memory layout. For instance, TCP uses <u8, Msb0> , while IPv6 on a little-endian machine uses <u32, Lsb0> . Once you have done this, you can replace all of your (memory & mask...
Crate
v1.1.1
2026-06-18
docs.rs
...The name of this module must match /// the `lib.name` setting in the `Cargo.toml`, else Python will not be able to /// import the module. #[pyo3::pymodule] mod string_sum { use pyo3::prelude::*; /// Formats the sum of two numbers as string. #[pyfunction] fn sum_as_string(a: usize, b: usize...
Crate
v0.29.2
2026-08-05
crates.io
...This is because it gets both live trust information (new roots, explicit markers, and auto-managed CRLs) and better matches the common expectation of apps running on that platform (to use proxies, for example). Otherwise, it becomes your maintenance burden to ship updates right away in order to handle increasing...
Crate
v0.7.0
2026-04-12
crates.io
...link_section::TypedSection<MyType>; } mod elsewhere { // This must match the definition site! #[in_section(unsafe, name = my_crate::SECTION_NAME, type = typed)] // optionally: aux(main = MAIN_SECTION) static ITEM: MyType = MyType(42); } Syntax Section definition: #[section(<kind>)] #[section(<kind>, aux(main = <path::to::MAIN_SECTION>))] #[section(unsafe, type = <kind>)] #[section...
Crate
v0.19.3
2026-08-09
crates.io
...use swift_rs::{swift, Int, SRObject}; // Any struct that is used in a C function must be annotated // with this, and since our Swift function is exposed as a // C function with @_cdecl, this is necessary here #[repr(C)] // Struct matches the class declaration in Swift struct SquareNumberResult { input: Int...
Crate
v1.0.8
2026-08-20
crates.io
...let phone_type = 2i32; match PhoneType::try_from(phone_type) { Ok(PhoneType::Mobile) => ..., Ok(PhoneType::Home) => ..., Ok(PhoneType::Work) => ..., Err(_) => ..., } Additionally, wherever a proto enum is used as a field in a Message , the message will have 'accessor' methods to get/set the value of the field as the Rust...
Crate
v0.14.4
2026-06-07
docs.rs
...proptest! { // snip... #[test] fn parses_all_valid_dates(s in "[0-9]{4}-[0-9]{2}-[0-9]{2}") { parse_date(&s).unwrap(); } } The thing to the right-hand side of in is actually a regular expression , and s is chosen from strings which match it. So in our previous...
Crate
v1.11.0
2026-03-24
docs.rs
...None, }; // insert with ON CONFLICT on primary key do nothing, with MySQL specific polyfill let result = Fruit::insert_many([apple, pear]) .on_conflict_do_nothing() .exec(db) .await?; matches!(result, TryInsertResult::Conflicted); Update ActiveModel avoids race conditions by updating only the fields you've changed, never overwriting untouched columns. You...
Crate
v2.0.2
2026-08-12
github.com
...The #[files(...)] attribute ignores matched directory paths by default, returning only file paths. If you need the test cases to include directories found by the glob pattern, use the #[dirs] attribute in conjunction with #[files(...)] . Use #[once] Fixture If you need to a fixture that should be initialized just once...
Crate
v0.26.1
2025-07-27
docs.rs
...Kiddo is not intended as a library for high-dimensional vector search or feature matching over hundreds or thousands of dimensions, where plain k-d trees are usually the wrong data structure and other approaches are more appropriate. The API does not impose a hard dimensional limit, but Kiddo is...
Crate
v6.0.2
2026-08-13
docs.rs
...Create a new instance of the DAO that will use the client let dao = MyUserDao::new(metrics); // Try to lookup a user by ID! match dao.get_user_by_id(123) { Some(u) => println!("Found a user!"), None => println!("No user!") }; Quiet Metric Sending and Error Handling When sending metrics...
Crate
v1.8.0
2026-04-11
crates.io
...EdgeDataMerge<ShapeCountBoolean, Self>) -> Self { match (ctx.lhs_data, ctx.rhs_data) { (EdgeKind::Red, EdgeKind::Red) => EdgeKind::Red, (EdgeKind::Green, EdgeKind::Green) => EdgeKind::Green, _ => EdgeKind::Undefined, } } } let mut overlay = EdgeOverlay::new(8); let red_square = [ [0, 0], [4, 0], [4, 4], [0, 4], ]; let green_square = [ [2, 0], [6, 0], [6...
Crate
v8.1.0
2026-08-16
docs.rs
...Result<Version> = "1.2.x".parse().into_diagnostic(); match version_result { Err(e) => println!("{:?}", e), Ok(version) => println!("{}", version), } } ... diagnostic code URLs miette supports providing a URL for individual diagnostics. This URL will be displayed as an actual link in supported terminals, like so: To use this, you can add...
Crate
v7.6.0
2025-04-27
crates.io
...serde_json::error::Error × data did not match any variant of untagged enum LambdaRequest An simpler alternative is to cURL the following endpoint based on the address and port you defined. For example: curl -v -X POST \ 'http://127.0.0.1:9000/lambda-url/<lambda-function-name>/' \ -H 'content...
Crate
v1.3.0
2026-07-09
crates.io
...mypy.stubtest integration mypy stubtest validates that stub files match runtime behavior. You can add it to your test suite: uv run stubtest your_module_name --ignore-missing-stub --ignore-disjoint-bases Required flags for PyO3/maturin projects --ignore-missing-stub - Maturin creates internal native modules ( .so files) that re...
Crate
v0.23.0
2026-06-17