Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Difference From bndpresbufq-0.1.1 To bndpresbufq-0.1.2
2024-10-05
| ||
01:51 | Add try_return. check-in: 57133b16db user: jan tags: trunk | |
2024-09-12
| ||
23:06 | Release maintenance. check-in: 31bb13f5e5 user: jan tags: bndpresbufq-0.1.2, trunk | |
23:04 | Add clean() and is_full() functions. check-in: 8607dde02e user: jan tags: trunk | |
22:02 | Release maintenance. check-in: 59354d4d2b user: jan tags: bndpresbufq-0.1.1, trunk | |
22:00 | Use limq 0.1.1. Make sure specific panic messages are used. Pedantic clippy. check-in: d00fa4a2e1 user: jan tags: trunk | |
Changes to Cargo.toml.
1 2 | [package] name = "bndpresbufq" | | | 1 2 3 4 5 6 7 8 9 10 | [package] name = "bndpresbufq" version = "0.1.2" edition = "2021" license = "0BSD" # https://crates.io/category_slugs categories = [ "data-structures" ] keywords = [ "buffer", "queue", "bounded", "bounds-preserving" ] repository = "https://repos.qrnch.tech/pub/bndpresbufq" description = "Bounds-preserving, optionally limited, buffer queue" |
︙ | ︙ | |||
19 20 21 22 23 24 25 | ] # https://doc.rust-lang.org/cargo/reference/manifest.html#the-badges-section [badges] maintenance = { status = "passively-maintained" } [dependencies] | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | ] # https://doc.rust-lang.org/cargo/reference/manifest.html#the-badges-section [badges] maintenance = { status = "passively-maintained" } [dependencies] limq = { version = "0.1.2" } [package.metadata.docs.rs] rustdoc-args = ["--generate-link-to-definition"] [lints.clippy] all = { level = "deny", priority = -1 } pedantic = { level = "warn", priority = -1 } nursery = { level = "warn", priority = -1 } cargo = { level = "warn", priority = -1 } |
Changes to src/lib.rs.
︙ | ︙ | |||
54 55 56 57 58 59 60 61 62 63 64 65 66 67 | ); Self { q: LimQ::new(max_len), max_size, size: 0 } } /// Change the length limit of the queue. /// /// # Panics /// A zero-limit will cause a panic. pub fn set_max_len(&mut self, max_len: Option<usize>) { self.q.set_max_len(max_len); | > > > > > > > | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | ); Self { q: LimQ::new(max_len), max_size, size: 0 } } /// Clear all buffers from queue. #[inline] pub fn clear(&mut self) { self.q.clear(); self.size = 0; } /// Change the length limit of the queue. /// /// # Panics /// A zero-limit will cause a panic. pub fn set_max_len(&mut self, max_len: Option<usize>) { self.q.set_max_len(max_len); |
︙ | ︙ | |||
107 108 109 110 111 112 113 114 115 116 117 118 119 120 | /// Return boolean indicating whether the queue is empty or not. #[inline] #[must_use] pub fn is_empty(&self) -> bool { self.q.is_empty() } /// Drop elements that overflow the queue limit (if a limit has been set). #[inline] pub fn purge_overflow(&mut self) { self.q.purge_overflow(); if let Some(max_size) = self.max_size { while self.size > max_size { | > > > > > > > > > > > > | 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | /// Return boolean indicating whether the queue is empty or not. #[inline] #[must_use] pub fn is_empty(&self) -> bool { self.q.is_empty() } /// Return boolean indicating whether the queue has reached its configured /// limits. /// /// Returns `false` is no limits have been configured. #[must_use] pub fn is_full(&self) -> bool { self.q.is_full() || self .max_size .map_or(false, |max_size| self.size >= max_size) } /// Drop elements that overflow the queue limit (if a limit has been set). #[inline] pub fn purge_overflow(&mut self) { self.q.purge_overflow(); if let Some(max_size) = self.max_size { while self.size > max_size { |
︙ | ︙ | |||
283 284 285 286 287 288 289 | } #[test] fn force_too_big_buf() { let mut q = BndPresLimBufQ::new(None, Some(2)); assert_eq!(q.force_push([1, 2, 3].into()), Err(vec![1, 2, 3])); } | | > > > > > > | > > > > > > > > > > > > > > > > > > | 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | } #[test] fn force_too_big_buf() { let mut q = BndPresLimBufQ::new(None, Some(2)); assert_eq!(q.force_push([1, 2, 3].into()), Err(vec![1, 2, 3])); } #[test] fn is_full_len() { let mut q = BndPresLimBufQ::new(Some(1), None); assert!(!q.is_full()); q.force_push([1].into()).unwrap(); assert!(q.is_full()); } #[test] fn is_full_size() { let mut q = BndPresLimBufQ::new(None, Some(1)); assert!(!q.is_full()); q.force_push([1].into()).unwrap(); assert!(q.is_full()); } #[test] fn is_full_both() { let mut q = BndPresLimBufQ::new(Some(1), Some(1)); assert!(!q.is_full()); q.force_push([1].into()).unwrap(); assert!(q.is_full()); } } // 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 | # Change Log ## [Unreleased] [Details](/vdiff?from=bndpresbufq-0.1.2&to=trunk) ### Added ### Changed ### Removed --- ## [0.1.2] - 2024-09-13 [Details](/vdiff?from=bndpresbufq-0.1.1&to=bndpresbufq-0.1.2) ### Added - Add `clear()` and `is_full()` methods. --- ## [0.1.1] - 2024-09-13 [Details](/vdiff?from=bndpresbufq-0.1.0&to=bndpresbufq-0.1.1) ### Added |
︙ | ︙ |