From 80f447b2ac9accf3b2c341f1ab7f84a8b03b50e0 Mon Sep 17 00:00:00 2001 From: fpagliughi Date: Sun, 26 Dec 2021 12:43:01 -0500 Subject: [PATCH] Added getters for the MqAttr struct --- CHANGELOG.md | 2 ++ src/mqueue.rs | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cd0d9e1227..96a1ce0e56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,8 @@ This project adheres to [Semantic Versioning](https://semver.org/). (#[1537](https://github.com/nix-rust/nix/pull/1537)) - Added the `SO_TIMESTAMPING` support (#[1547](https://github.com/nix-rust/nix/pull/1547)) +- Added getter methods to `MqAttr` struct + (#[1619](https://github.com/nix-rust/nix/pull/1619)) ### Changed ### Fixed diff --git a/src/mqueue.rs b/src/mqueue.rs index 564df4e40d..20740b54f9 100644 --- a/src/mqueue.rs +++ b/src/mqueue.rs @@ -64,6 +64,21 @@ impl MqAttr { pub const fn flags(&self) -> mq_attr_member_t { self.mq_attr.mq_flags } + + /// The max number of messages that can be held by the queue + pub const fn maxmsg(&self) -> mq_attr_member_t { + self.mq_attr.mq_maxmsg + } + + /// The maximum size of each message (in bytes) + pub const fn msgsize(&self) -> mq_attr_member_t { + self.mq_attr.mq_msgsize + } + + /// The number of messages currently held in the queue + pub const fn curmsgs(&self) -> mq_attr_member_t { + self.mq_attr.mq_curmsgs + } }