mqrs/src/posix/info.rs
finga 8f93d2d6c8 Fix clippy and remove borrows
Fix clippy lints and remove unneded borrows when logging or printing
macros.
2021-12-03 14:57:38 +01:00

25 lines
574 B
Rust

use anyhow::Result;
use clap::Parser;
use posixmq::PosixMq;
/// Print information about an existing message queue
#[derive(Debug, Parser)]
pub struct Info {
/// Name of the queue
#[clap(value_name = "QUEUE")]
queue: String,
}
impl Info {
pub fn run(&self) -> Result<()> {
let attrs = PosixMq::open(&self.queue)?.attributes()?;
println!(
"Message queue: {}, msg_max: {}, msgsize_max: {}, current_messages: {}",
self.queue, attrs.capacity, attrs.max_msg_len, attrs.current_messages
);
Ok(())
}
}