limq

Check-in Differences
Login

Check-in Differences

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

Difference From limq-0.1.1 To limq-0.1.2

2024-10-05
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
21:36
Change log updates. check-in: 3c006f2a0c user: jan tags: trunk
21:27
Exclude bacon.toml from packaging. check-in: 457e09bb70 user: jan tags: limq-0.1.1, trunk
21:25
Add an assertion message. check-in: efca5d365c user: jan tags: trunk

Changes to Cargo.toml.

1
2
3
4
5
6
7
8
9
10
[package]
name = "limq"
version = "0.1.1"
edition = "2021"
license = "0BSD"
# https://crates.io/category_slugs
categories = [ "data-structures" ]
keywords = [ "queue", "bounded" ]
repository = "https://repos.qrnch.tech/pub/limq"
description = "Queue with optional maximum number of elements constraint"


|







1
2
3
4
5
6
7
8
9
10
[package]
name = "limq"
version = "0.1.2"
edition = "2021"
license = "0BSD"
# https://crates.io/category_slugs
categories = [ "data-structures" ]
keywords = [ "queue", "bounded" ]
repository = "https://repos.qrnch.tech/pub/limq"
description = "Queue with optional maximum number of elements constraint"

Changes to src/lib.rs.

53
54
55
56
57
58
59






60
61
62
63
64
65
66
      "A zero-length limit is forbidden"
    );

    let q = max_len.map_or_else(VecDeque::new, VecDeque::with_capacity);

    Self { q, max_len }
  }







  /// Change the limit of the queue.
  ///
  /// Does not drain overflow elements if the new limit is lower than the
  /// current number of elements in queue.  This can be done manually by
  /// calling [`LimQ::purge_overflow()`].
  ///







>
>
>
>
>
>







53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
      "A zero-length limit is forbidden"
    );

    let q = max_len.map_or_else(VecDeque::new, VecDeque::with_capacity);

    Self { q, max_len }
  }

  /// Clear all nodes from queue.
  #[inline]
  pub fn clear(&mut self) {
    self.q.clear();
  }

  /// Change the limit of the queue.
  ///
  /// Does not drain overflow elements if the new limit is lower than the
  /// current number of elements in queue.  This can be done manually by
  /// calling [`LimQ::purge_overflow()`].
  ///
90
91
92
93
94
95
96

























97
98
99
100
101
102
103

  /// Return a 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).
  ///
  /// ```
  /// use limq::LimQ;
  ///
  /// // Construct a queue with a maximum 2 element length limit







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134

  /// Return a boolean indicating whether the queue is empty or not.
  #[inline]
  #[must_use]
  pub fn is_empty(&self) -> bool {
    self.q.is_empty()
  }

  /// Returns a boolean indicating whether the queue is full.
  ///
  /// If no limit has been configured, this will always return `false`.
  ///
  /// ```
  /// use limq::LimQ;
  ///
  /// // Construct a queue with a maximum 1 element length limit
  /// let mut q: LimQ<u32> = LimQ::new(Some(1));
  ///
  /// assert!(!q.is_full());
  ///
  /// // Fill queue up
  /// q.try_push(1).unwrap();
  ///
  /// assert!(q.is_full());
  /// ```
  #[inline]
  #[must_use]
  pub fn is_full(&self) -> bool {
    self
      .max_len
      .map_or(false, |max_len| self.q.len() >= max_len)
  }

  /// Drop elements that overflow the queue limit (if a limit has been set).
  ///
  /// ```
  /// use limq::LimQ;
  ///
  /// // Construct a queue with a maximum 2 element length limit

Changes to www/changelog.md.

1
2
3
4
5
6
7
8
9
10
11
12
13
14





















15
16
17
18
19
20
# Change Log

## [Unreleased]

[Details](/vdiff?from=limq-0.1.0&to=trunk)

### Added

- Add an assertion message when a zero maximum length has been specified.

### Changed

### Removed






















---

## [0.1.0] - 2024-04-09

First release.





|



<
<




>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>






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
# Change Log

## [Unreleased]

[Details](/vdiff?from=limq-0.1.2&to=trunk)

### Added



### Changed

### Removed

---

## [0.1.2] - 2024-09-13

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

### Added

- Add `LimQ::is_full()` function.
- Add `LimQ::clear()` function.

---

## [0.1.1] - 2024-09-12

[Details](/vdiff?from=limq-0.1.0&to=limq-0.1.1)

### Added

- Add an assertion message when a zero maximum length has been specified.

---

## [0.1.0] - 2024-04-09

First release.