Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Difference From limq-0.1.2 To limq-0.1.3
2024-10-05
| ||
15:31 | Docs. check-in: 9860ad541a user: jan tags: trunk | |
01:29 | Release maintenance. check-in: c213f001af user: jan tags: limq-0.1.3, trunk | |
01:26 | Add LimQ::try_return(). check-in: 3fec62e1b7 user: jan tags: trunk | |
2024-09-12
| ||
22:41 | Release maintenance. check-in: 408568f1fb user: jan tags: limq-0.1.2, trunk | |
22:38 | inline more. check-in: 96fd0dbe05 user: jan tags: trunk | |
Changes to Cargo.toml.
1 2 | 1 2 3 4 5 6 7 8 9 10 | - + | [package] name = "limq" |
︙ |
Changes to src/lib.rs.
︙ | |||
228 229 230 231 232 233 234 235 236 237 238 239 240 241 | 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | // Make sure there's room for the new node while self.q.len() > (max_len - 1) { let _ = self.q.pop_front(); } } self.q.push_back(n); } /// Attempt to push node onto queue so it will be the next in line. /// /// Meant to be used to return an element to the queue that was just taken /// off it, but is currently not available to be processed. /// /// ``` /// use limq::LimQ; /// /// // Construct a queue with a maximum 2 element length limit /// let mut q: LimQ<u32> = LimQ::new(Some(2)); /// /// // Fill queue up /// q.force_push(1); /// q.force_push(2); /// /// // Take node off queue /// let n = q.pop().unwrap(); /// assert_eq!(n, 1); /// assert_eq!(q.len(), 1); /// /// // Return node to queue /// q.try_return(n); /// assert_eq!(q.len(), 2); /// /// // Should be the same node again /// let n = q.pop().unwrap(); /// assert_eq!(n, 1); /// ``` /// /// # Errors /// If the queue is full, return the node back to caller. #[inline] pub fn try_return(&mut self, n: T) -> Result<(), T> { if let Some(max_len) = self.max_len { if self.q.len() > (max_len - 1) { return Err(n); } } self.q.push_front(n); Ok(()) } /// Take node off queue. /// /// Returns `None` if the queue is empty. #[inline] pub fn pop(&mut self) -> Option<T> { self.q.pop_front() |
︙ |
Changes to www/changelog.md.
1 2 3 4 | 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] |
︙ |