diff --git a/js/package-lock.json b/js/package-lock.json index 199c80ce..43a0d23f 100644 --- a/js/package-lock.json +++ b/js/package-lock.json @@ -37,14 +37,15 @@ "@types/react-dom": "^18.2.14", "bun-types": ">=1.0.15", "tsup": ">=7.2.0", - "typescript": ">=5.2.2" + "typescript": ">=5.2.2", + "wouter": "<3.2.0" }, "peerDependencies": { "chroma-js": "^2.4.2", "react": "^18.2.0", "react-dom": "^18.2.0", "vite": "^5.0.11", - "wouter": "<=3.1.3" + "wouter": "^3.2.0" } }, "node_modules/@ampproject/remapping": { @@ -5167,7 +5168,7 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz", "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==", - "peer": true + "dev": true }, "node_modules/module-details-from-path": { "version": "1.0.3", @@ -5675,7 +5676,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/regexparam/-/regexparam-3.0.0.tgz", "integrity": "sha512-RSYAtP31mvYLkAHrOlh25pCNQ5hWnT106VukGaaFfuJrZFkGRX5GhUAdPqpSDXxOhA2c4akmRuplv1mRqnBn6Q==", - "peer": true, + "dev": true, "engines": { "node": ">=8" } @@ -6652,7 +6653,7 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz", "integrity": "sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==", - "peer": true, + "dev": true, "peerDependencies": { "react": "^16.8.0 || ^17.0.0 || ^18.0.0" } @@ -7463,7 +7464,7 @@ "version": "3.1.3", "resolved": "https://registry.npmjs.org/wouter/-/wouter-3.1.3.tgz", "integrity": "sha512-peIjHLma9MWDb9PAxVV+h+yYxpx9y5V6O1jF49ru8NEvLaDhwZR4y4FMYN5C3FM7CSXFn3ZmBeTq3g+V8b+hRQ==", - "peer": true, + "dev": true, "dependencies": { "mitt": "^3.0.1", "regexparam": "^3.0.0", diff --git a/rust/bitbazaar/errors/mod.rs b/rust/bitbazaar/errors/mod.rs index b3acd8af..43596355 100644 --- a/rust/bitbazaar/errors/mod.rs +++ b/rust/bitbazaar/errors/mod.rs @@ -3,7 +3,7 @@ mod macros; pub use any::AnyErr; -/// Shorthand for a [`Result`] with a [`Report`] as the error variant +/// Shorthand for a [`Result`] with a [`error_stack::Report`] as the error variant pub type RResult = Result>; /// Easily import all useful error items. Useful to put inside a crate prelude. diff --git a/rust/bitbazaar/lib.rs b/rust/bitbazaar/lib.rs index 17fa1466..8f300b27 100644 --- a/rust/bitbazaar/lib.rs +++ b/rust/bitbazaar/lib.rs @@ -5,6 +5,9 @@ //! bitbazaar - An assortment of publicly available cross-language utilities useful to my projects. +// When docs auto created for docs.rs, will include features, given docs.rs uses nightly by default: +#![cfg_attr(all(doc, CHANNEL_NIGHTLY), feature(doc_auto_cfg))] + mod prelude; #[cfg(feature = "cli")] diff --git a/rust/bitbazaar/redis/batch.rs b/rust/bitbazaar/redis/batch.rs index c4888176..c6644c69 100644 --- a/rust/bitbazaar/redis/batch.rs +++ b/rust/bitbazaar/redis/batch.rs @@ -105,7 +105,7 @@ impl<'a, 'b, 'c, ReturnType> RedisBatch<'a, 'b, 'c, ReturnType> { /// Expire an existing key with a new/updated ttl. /// - /// https://redis.io/commands/pexpire/ + /// pub fn expire(mut self, namespace: &str, key: &str, ttl: chrono::Duration) -> Self { self.pipe .pexpire( @@ -124,7 +124,7 @@ impl<'a, 'b, 'c, ReturnType> RedisBatch<'a, 'b, 'c, ReturnType> { } /// Add an entry to an ordered set (auto creating the set if it doesn't exist). - /// https://redis.io/commands/zadd/ + /// /// /// Arguments: /// - `set_namespace`: The namespace of the set. @@ -161,7 +161,7 @@ impl<'a, 'b, 'c, ReturnType> RedisBatch<'a, 'b, 'c, ReturnType> { } /// remove an entries from an ordered set. - /// https://redis.io/commands/zrem/ + /// /// /// Arguments: /// - `set_namespace`: The namespace of the set. @@ -194,7 +194,7 @@ impl<'a, 'b, 'c, ReturnType> RedisBatch<'a, 'b, 'c, ReturnType> { } /// Add multiple entries at once to an ordered set (auto creating the set if it doesn't exist). - /// https://redis.io/commands/zadd/ + /// /// /// Arguments: /// - `set_namespace`: The namespace of the set. @@ -229,7 +229,7 @@ impl<'a, 'b, 'c, ReturnType> RedisBatch<'a, 'b, 'c, ReturnType> { /// Remove entries from an ordered set by score range. (range is inclusive) /// - /// https://redis.io/commands/zremrangebyscore/ + /// pub fn zremrangebyscore( mut self, set_namespace: &str, @@ -443,7 +443,7 @@ pub trait RedisBatchReturningOps<'c> { /// - `max`: The maximum score. /// - `limit`: The maximum number of items to return. /// - /// https://redis.io/commands/zrangebyscore/ + /// `https://redis.io/commands/zrangebyscore/` fn zrangebyscore_high_to_low( self, set_namespace: &str, @@ -464,7 +464,7 @@ pub trait RedisBatchReturningOps<'c> { /// - `max`: The maximum score. /// - `limit`: The maximum number of items to return. /// - /// https://redis.io/commands/zrangebyscore/ + /// `https://redis.io/commands/zrangebyscore/` fn zrangebyscore_low_to_high( self, set_namespace: &str, diff --git a/rust/bitbazaar/redis/temp_list.rs b/rust/bitbazaar/redis/temp_list.rs index 3d1d2476..7281cc55 100644 --- a/rust/bitbazaar/redis/temp_list.rs +++ b/rust/bitbazaar/redis/temp_list.rs @@ -383,7 +383,7 @@ impl RedisTempList { /// - Clean up expired list items /// /// Returns: - /// RedisTempListItem: The resulting item holder which can be used to further manipulate the items. + /// `RedisTempListItem`: The resulting item holder which can be used to further manipulate the items. pub async fn push<'a, T: serde::Serialize + for<'b> serde::Deserialize<'b>>( self: &'a Arc, // Using arc to be cloning references into the list items rather than the full list object each time. conn: &mut RedisConn<'_>, @@ -419,8 +419,8 @@ impl RedisTempList { /// - Clean up expired list items /// /// Returns: - /// - Some(Vec>): The resulting item holders for each of the items added, these can be used to further manipulate the items. - /// - None: Something went wrong and the items weren't added correctly. + /// - `Some(Vec>)`: The resulting item holders for each of the items added, these can be used to further manipulate the items. + /// - `None`: Something went wrong and the items weren't added correctly. pub async fn extend<'a, T: serde::Serialize + for<'b> serde::Deserialize<'b>>( self: &'a Arc, // Using arc to be cloning references into the list items rather than the full list object each time. conn: &mut RedisConn<'_>, @@ -441,7 +441,7 @@ impl RedisTempList { } } - /// Underlying of [`RedisTempList::read_multi`], but returns the (i64: ttl, String: item key, T: item) rather than RedisTempList that makes working with items easier. + /// Underlying of [`RedisTempList::read_multi`], but returns the `(i64: ttl, String: item key, T: item)` rather than `RedisTempList` that makes working with items easier. pub async fn read_multi_raw serde::Deserialize<'a>>( &self, conn: &mut RedisConn<'_>, @@ -528,7 +528,7 @@ impl RedisTempList { /// - Clean up expired list items /// /// Returns: - /// - Vec: The wrapped items in the list from newest to oldest up to the provided limit (if any). + /// - `Vec`: The wrapped items in the list from newest to oldest up to the provided limit (if any). pub async fn read_multi serde::Deserialize<'a>>( self: &Arc, // Using arc to be cloning references into the list items rather than the full list object each time. conn: &mut RedisConn<'_>, diff --git a/rust/bitbazaar/threads/batch_futures.rs b/rust/bitbazaar/threads/batch_futures.rs index 0dd13b98..9f7b637b 100644 --- a/rust/bitbazaar/threads/batch_futures.rs +++ b/rust/bitbazaar/threads/batch_futures.rs @@ -123,7 +123,7 @@ pub enum BatchLimit { } /// Batch run futures but with a limiter on parents and descendants. -/// IF HIGHEST PERFORMANCE IS NEEDED AND YOU DON'T NEED DESCENDANT LIMITING, USE [`batch_futures_stream_async_cb_perf`] or just normal [`futures::StreamExt::buffer_unordered`]. +/// IF HIGHEST PERFORMANCE IS NEEDED AND YOU DON'T NEED DESCENDANT LIMITING, USE [`batch_futures_flat_stream_async_cb`] or just normal [`futures::StreamExt::buffer_unordered`]. /// /// Key specialised features: /// - Limits can be shared with descendants/parents, preventing concurrency explosion, but also internally making sure no deadlocks. @@ -131,9 +131,9 @@ pub enum BatchLimit { /// - Despite batching, vec of results/callbacks of results are in same order as inputted (keeping finished out of order futures in buffer until they're next in line.). /// - The future callback will only be called when the future will imminently be polled, allowing sync setup. /// -/// If you need to start processing the results before all the futures are done, use [`batch_futures_stream_async_cb`] or [`batch_futures_stream_sync_cb`]. +/// If you need to start processing the results before all the futures are done, use [`batch_futures_descendants_stream_sync_cb`] or [`batch_futures_descendants_stream_async_cb`]. /// -/// If neither of the above features are needed, you may as well use `buffer_unordered` (https://users.rust-lang.org/t/batch-execution-of-futures-in-the-tokio-runtime-or-max-number-of-active-futures-at-a-time/47659) +/// If neither of the above features are needed, you may as well use `buffer_unordered` pub async fn batch_futures_descendants>( batch_limit: &BatchLimit, fut_cbs: impl IntoIterator Fut>, diff --git a/rust/bitbazaar/threads/run_cpu_intensive.rs b/rust/bitbazaar/threads/run_cpu_intensive.rs index 9a33b972..07bd48e0 100644 --- a/rust/bitbazaar/threads/run_cpu_intensive.rs +++ b/rust/bitbazaar/threads/run_cpu_intensive.rs @@ -3,7 +3,7 @@ use crate::prelude::*; /// The following link explains the distinction between normal tokio, [`tokio::task::spawn_blocking`], and rayon. /// For most cases you think to use [`tokio::task::spawn_blocking`], but isn't actual IO like file read/write that isn't async, and actually CPU bound stuff, rayon should be used. /// It goes without saying, if you ever want to use anything from rayon like [`rayon::iter::ParallelIterator`], it should be inside [`run_cpu_intensive`] -/// https://ryhl.io/blog/async-what-is-blocking/#the-rayon-crate +/// /// /// This also makes sure to maintain the active tracing span context across into the rayon block. pub async fn run_cpu_intensive(