Skip to content

Commit

Permalink
[ISSUE #2419] Adding #[inline] for RocketMQRuntime method (#2420)
Browse files Browse the repository at this point in the history
  • Loading branch information
nakul-py authored Jan 27, 2025
1 parent fb5227f commit 7e6c826
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions rocketmq-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pub enum RocketMQRuntime {
}

impl RocketMQRuntime {
#[inline]
pub fn new_multi(threads: usize, name: &str) -> Self {
Self::Multi(
tokio::runtime::Builder::new_multi_thread()
Expand All @@ -35,30 +36,35 @@ impl RocketMQRuntime {
}

impl RocketMQRuntime {
#[inline]
pub fn get_handle(&self) -> &tokio::runtime::Handle {
match self {
Self::Multi(runtime) => runtime.handle(),
}
}

#[inline]
pub fn get_runtime(&self) -> &tokio::runtime::Runtime {
match self {
Self::Multi(runtime) => runtime,
}
}

#[inline]
pub fn shutdown(self) {
match self {
Self::Multi(runtime) => runtime.shutdown_background(),
}
}

#[inline]
pub fn shutdown_timeout(self, timeout: Duration) {
match self {
Self::Multi(runtime) => runtime.shutdown_timeout(timeout),
}
}

#[inline]
pub fn schedule_at_fixed_rate<F>(
&self,
task: F,
Expand Down Expand Up @@ -93,6 +99,7 @@ impl RocketMQRuntime {
}
}

#[inline]
pub fn schedule_at_fixed_rate_mut<F>(
&self,
mut task: F,
Expand Down

0 comments on commit 7e6c826

Please sign in to comment.