Skip to content

Commit

Permalink
fix: Use function instead of Box<FnOnce>
Browse files Browse the repository at this point in the history
  • Loading branch information
DashieTM committed Mar 28, 2024
1 parent 65495a3 commit 6bd2335
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/utils/plugin_setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{
sync::{Arc, RwLock},
};

use dbus_crossroads::{Crossroads, IfaceBuilder, IfaceToken};
use dbus_crossroads::{Crossroads, IfaceToken};
use libloading::Library;
use once_cell::sync::Lazy;

Expand Down Expand Up @@ -266,8 +266,6 @@ impl FrontendPluginFunctions {
unsafe impl Send for FrontendPluginFunctions {}
unsafe impl Sync for FrontendPluginFunctions {}

type Registration<T> = Box<dyn FnOnce(&mut IfaceBuilder<T>)>;

pub struct CrossWrapper<'a>(&'a mut Crossroads);

impl<'a> CrossWrapper<'a> {
Expand All @@ -278,7 +276,7 @@ impl<'a> CrossWrapper<'a> {
pub fn register<T: Send + Sync + 'static>(
&mut self,
name: impl Into<String>,
token: Registration<T>,
token: fn(&mut dbus_crossroads::IfaceBuilder<T>),
) -> dbus_crossroads::IfaceToken<T> {
self.0.register(name.into(), token)
}
Expand Down

0 comments on commit 6bd2335

Please sign in to comment.