forked from amqp-rs/lapin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqueue.rs
41 lines (35 loc) · 820 Bytes
/
queue.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
use crate::types::{ConsumerCount, MessageCount, ShortString};
use std::borrow::Borrow;
#[derive(Clone, Debug)]
pub struct Queue {
name: ShortString,
message_count: MessageCount,
consumer_count: ConsumerCount,
}
impl Queue {
pub(crate) fn new(
name: ShortString,
message_count: MessageCount,
consumer_count: ConsumerCount,
) -> Self {
Self {
name,
message_count,
consumer_count,
}
}
pub fn name(&self) -> &ShortString {
&self.name
}
pub fn message_count(&self) -> MessageCount {
self.message_count
}
pub fn consumer_count(&self) -> ConsumerCount {
self.consumer_count
}
}
impl Borrow<str> for Queue {
fn borrow(&self) -> &str {
self.name.as_str()
}
}