bndpresbufq

Check-in Differences
Login

Check-in Differences

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Difference From bndpresbufq-0.1.2 To bndpresbufq-0.1.3

2024-10-05
18:21
Bugfix: Update the total queue size when try_return() is successful. check-in: 40a762cf04 user: jan tags: trunk
01:53
Release maintenance. check-in: 789a8bbe7d user: jan tags: bndpresbufq-0.1.3, trunk
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

Changes to Cargo.toml.

1
2
3

4
5
6
7
8
9
10
1
2

3
4
5
6
7
8
9
10


-
+







[package]
name = "bndpresbufq"
version = "0.1.2"
version = "0.1.3"
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
26

27
28
29
30
31
32
33
34
35
36
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" }
limq = { version = "0.1.3" }

[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.

190
191
192
193
194
195
196





























197
198
199
200
201
202
203
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+








    // At this point, pushing should always succeed
    self.q.force_push(n);
    self.size += nlen;

    Ok(())
  }

  /// Attempt to put a buffer back on to the queue so that it will be the next
  /// one to be pulled off it.
  ///
  /// Intended to put a buffer back on the queue that was just taken off the
  /// queue but can not currently be processed.
  ///
  /// # Errors
  /// If the buffer would exceed the queues limits the buffer is returned.
  pub fn try_return(&mut self, n: Vec<u8>) -> Result<(), Vec<u8>> {
    let nlen = n.len();

    // If a maximum size has been set for this queue ..
    if let Some(max_size) = self.max_size {
      // .. then bail if the input buffer size is larger than the maximum
      // allowed total queue size.
      if nlen > max_size {
        return Err(n);
      }

      // Make sure this node wouldn't exceed queue total capacity
      if self.size + nlen > max_size {
        return Err(n);
      }
    }

    self.size += nlen;
    self.q.try_return(n)
  }

  /// Take next buffer off queue.
  #[inline]
  pub fn pop(&mut self) -> Option<Vec<u8>> {
    let n = self.q.pop()?;
    self.size -= n.len();
    Some(n)

Changes to www/changelog.md.

1
2
3
4
5

6
7
8
9
10
11
12











13
14
15
16
17
18
19
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=bndpresbufq-0.1.2&to=trunk)
[Details](/vdiff?from=bndpresbufq-0.1.3&to=trunk)

### Added

### Changed

### Removed

---

## [0.1.3]

[Details](/vdiff?from=bndpresbufq-0.1.2&to=bndpresbufq-0.1.3)

### Added

- `BndPresLimBufQ::try_return()` can be used to return a node that was just
  taken off the queue back to it so it will be return next.

---

## [0.1.2] - 2024-09-13

[Details](/vdiff?from=bndpresbufq-0.1.1&to=bndpresbufq-0.1.2)

### Added