Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Difference From orphanage-0.1.2 To orphanage-0.1.3
2024-11-22
| ||
14:21 | Add 'outdated' functions to fs module, useful for driving dependency rules. check-in: 89ac2f5207 user: jan tags: trunk | |
2024-11-07
| ||
13:37 | Release maintenance. check-in: a4cacdb382 user: jan tags: orphanage-0.1.3, trunk | |
12:47 | Don't deny on lints. check-in: b6a940c489 user: jan tags: trunk | |
12:44 | Add setops module. check-in: 02f72ed914 user: jan tags: trunk | |
2024-11-01
| ||
12:52 | Happy pedantic clippy. check-in: b2e5d75f49 user: jan tags: orphanage-0.1.2, trunk | |
12:48 | Release maintenance. check-in: e924dfeeb4 user: jan tags: trunk | |
Changes to .efiles.
︙ | ︙ | |||
10 11 12 13 14 15 16 17 18 19 | src/buf.rs src/sqlfuncs.rs src/futures.rs src/iox.rs src/tokiox.rs src/tokiox/tcpconn.rs src/serde_parsers.rs examples/fut_if_some.rs examples/deser.rs examples/slasher.rs | > > | 10 11 12 13 14 15 16 17 18 19 20 21 | src/buf.rs src/sqlfuncs.rs src/futures.rs src/iox.rs src/tokiox.rs src/tokiox/tcpconn.rs src/serde_parsers.rs src/setops.rs tests/setops.rs examples/fut_if_some.rs examples/deser.rs examples/slasher.rs |
Changes to Cargo.toml.
1 2 | [package] name = "orphanage" | | | 1 2 3 4 5 6 7 8 9 10 | [package] name = "orphanage" version = "0.1.3" edition = "2021" license = "0BSD" # https://crates.io/category_slugs categories = [ "network-programming" ] keywords = [ "sqlite", "fs", "path" ] repository = "https://repos.qrnch.tech/pub/orphanage" description = "Random collection of stuff that is still searching for a home." |
︙ | ︙ | |||
26 27 28 29 30 31 32 33 34 35 36 37 38 39 | [features] tokio = ["dep:tokio", "dep:async-trait", "dep:killswitch"] rusqlite = ["dep:rusqlite", "dep:sha2"] serde = ["dep:serde", "dep:parse-size"] [dependencies] async-trait = { version = "0.1.82", optional = true } killswitch = { version = "0.4.2", optional = true } parse-size = { version = "1.1.0", optional = true } rand = { version = "0.8.5" } rusqlite = { version = "0.32.1", optional = true, features = ["functions"] } serde = { version = "1.0.214", optional = true, features = ["derive"] } sha2 = { version = "0.10.7", optional = true } shellexpand = { version = "3.1.0" } | > | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | [features] tokio = ["dep:tokio", "dep:async-trait", "dep:killswitch"] rusqlite = ["dep:rusqlite", "dep:sha2"] serde = ["dep:serde", "dep:parse-size"] [dependencies] async-trait = { version = "0.1.82", optional = true } hashbrown = { version = "0.15.1" } killswitch = { version = "0.4.2", optional = true } parse-size = { version = "1.1.0", optional = true } rand = { version = "0.8.5" } rusqlite = { version = "0.32.1", optional = true, features = ["functions"] } serde = { version = "1.0.214", optional = true, features = ["derive"] } sha2 = { version = "0.10.7", optional = true } shellexpand = { version = "3.1.0" } |
︙ | ︙ | |||
48 49 50 51 52 53 54 | toml = { version = "0.8.18" } [package.metadata.docs.rs] all-features = true rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"] [lints.clippy] | | | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | toml = { version = "0.8.18" } [package.metadata.docs.rs] all-features = true rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"] [lints.clippy] all = { level = "warn", priority = -1 } pedantic = { level = "warn", priority = -1 } nursery = { level = "warn", priority = -1 } cargo = { level = "warn", priority = -1 } multiple_crate_versions = "allow" |
Changes to src/lib.rs.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #![cfg_attr(docsrs, feature(doc_cfg))] pub mod buf; mod err; pub mod fs; pub mod futures; pub mod iox; pub mod path; pub mod strx; #[cfg(feature = "rusqlite")] #[cfg_attr(docsrs, doc(cfg(feature = "rusqlite")))] pub mod sqlfuncs; #[cfg(feature = "tokio")] | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #![cfg_attr(docsrs, feature(doc_cfg))] pub mod buf; mod err; pub mod fs; pub mod futures; pub mod iox; pub mod path; pub mod setops; pub mod strx; #[cfg(feature = "rusqlite")] #[cfg_attr(docsrs, doc(cfg(feature = "rusqlite")))] pub mod sqlfuncs; #[cfg(feature = "tokio")] |
︙ | ︙ |
Added src/setops.rs.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | use std::hash::Hash; pub use hashbrown::HashSet; pub struct Diff<'a, T> { pub added: HashSet<&'a T>, pub removed: HashSet<&'a T>, pub unchanged: HashSet<&'a T> } impl<T> Diff<'_, T> { /// Returns `true` if the sets that were diff'd have changed. #[must_use] pub fn changed(&self) -> bool { !self.added.is_empty() || !self.removed.is_empty() } } /// Calculate changes between two sets. /// /// Returns a struct containing: /// - `added`, containing elements that exist in new set but not in old. /// - `removed`, containig elements that exist in old set but not in new. /// - `unchaned`, containing elements that exists in both old and new sets. /// /// ``` /// use orphanage::setops::{HashSet, changes}; /// /// let old: HashSet<u32> = [1, 2].into_iter().collect(); /// let new: HashSet<u32> = [2, 3].into_iter().collect(); /// /// let diff = changes(&old, &new); /// /// let mut added: Vec<u32> = diff.added.into_iter().copied().collect(); /// added.sort_unstable(); /// let mut removed: Vec<u32> = diff.removed.into_iter().copied().collect(); /// removed.sort_unstable(); /// let mut unchanged: Vec<u32> = diff.unchanged.into_iter().copied().collect(); /// unchanged.sort_unstable(); /// /// assert_eq!(&added, &[3]); /// assert_eq!(&removed, &[1]); /// assert_eq!(&unchanged, &[2]); /// ``` #[must_use] pub fn changes<'a, T>(old: &'a HashSet<T>, new: &'a HashSet<T>) -> Diff<'a, T> where T: Hash + Eq { let added: HashSet<_> = new.difference(old).collect(); let removed: HashSet<_> = old.difference(new).collect(); let unchanged: HashSet<_> = old.intersection(new).collect(); Diff { added, removed, unchanged } } // vim: set ft=rust et sw=2 ts=2 sts=2 cinoptions=2 tw=79 : |
Added tests/setops.rs.
> > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | use orphanage::setops::{changes, HashSet}; #[test] fn all() { let old: HashSet<u32> = [1, 2].into_iter().collect(); let new: HashSet<u32> = [2, 3].into_iter().collect(); let diff = changes(&old, &new); let mut added: Vec<u32> = diff.added.into_iter().copied().collect(); added.sort_unstable(); let mut removed: Vec<u32> = diff.removed.into_iter().copied().collect(); removed.sort_unstable(); let mut unchanged: Vec<u32> = diff.unchanged.into_iter().copied().collect(); unchanged.sort_unstable(); assert_eq!(&added, &[3]); assert_eq!(&removed, &[1]); assert_eq!(&unchanged, &[2]); } // vim: set ft=rust et sw=2 ts=2 sts=2 cinoptions=2 tw=79 : |
Changes to www/changelog.md.
1 2 3 4 | # Change Log ## [Unreleased] | | > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | # Change Log ## [Unreleased] [Details](/vdiff?from=orphanage-0.1.3&to=trunk) ### Added ### Changed ### Removed --- ## [0.1.3] - 2024-11-07 [Details](/vdiff?from=orphanage-0.1.2&to=orphanage-0.1.3) ### Added - Add `setops` module for collecting set/map operations. Contains `changes()` for calculating the changes between two sets. --- ## [0.1.2] - 2024-11-01 [Details](/vdiff?from=orphanage-0.1.1&to=orphanage-0.1.2) ### Added |
︙ | ︙ |