cargo fmt

This commit is contained in:
galister
2025-03-12 03:07:35 +09:00
parent bca6376b50
commit a1cc41f541
5 changed files with 180 additions and 88 deletions

View File

@@ -1,13 +1,22 @@
// This code was autogenerated with `dbus-codegen-rust -g -m None -d org.freedesktop.Notifications -p /org/freedesktop/Notifications`, see https://github.com/diwic/dbus-rs
use dbus as dbus;
use dbus;
#[allow(unused_imports)]
use dbus::arg;
use dbus::blocking;
pub trait OrgFreedesktopDBusProperties {
fn get<R0: for<'b> arg::Get<'b> + 'static>(&self, interface_name: &str, property_name: &str) -> Result<R0, dbus::Error>;
fn get<R0: for<'b> arg::Get<'b> + 'static>(
&self,
interface_name: &str,
property_name: &str,
) -> Result<R0, dbus::Error>;
fn get_all(&self, interface_name: &str) -> Result<arg::PropMap, dbus::Error>;
fn set<I2: arg::Arg + arg::Append>(&self, interface_name: &str, property_name: &str, value: I2) -> Result<(), dbus::Error>;
fn set<I2: arg::Arg + arg::Append>(
&self,
interface_name: &str,
property_name: &str,
value: I2,
) -> Result<(), dbus::Error>;
}
#[derive(Debug)]
@@ -40,20 +49,42 @@ impl dbus::message::SignalArgs for OrgFreedesktopDBusPropertiesPropertiesChanged
const INTERFACE: &'static str = "org.freedesktop.DBus.Properties";
}
impl<'a, T: blocking::BlockingSender, C: ::std::ops::Deref<Target=T>> OrgFreedesktopDBusProperties for blocking::Proxy<'a, C> {
fn get<R0: for<'b> arg::Get<'b> + 'static>(&self, interface_name: &str, property_name: &str) -> Result<R0, dbus::Error> {
self.method_call("org.freedesktop.DBus.Properties", "Get", (interface_name, property_name, ))
.and_then(|r: (arg::Variant<R0>, )| Ok((r.0).0, ))
impl<'a, T: blocking::BlockingSender, C: ::std::ops::Deref<Target = T>> OrgFreedesktopDBusProperties
for blocking::Proxy<'a, C>
{
fn get<R0: for<'b> arg::Get<'b> + 'static>(
&self,
interface_name: &str,
property_name: &str,
) -> Result<R0, dbus::Error> {
self.method_call(
"org.freedesktop.DBus.Properties",
"Get",
(interface_name, property_name),
)
.and_then(|r: (arg::Variant<R0>,)| Ok((r.0).0))
}
fn get_all(&self, interface_name: &str) -> Result<arg::PropMap, dbus::Error> {
self.method_call("org.freedesktop.DBus.Properties", "GetAll", (interface_name, ))
.and_then(|r: (arg::PropMap, )| Ok(r.0, ))
self.method_call(
"org.freedesktop.DBus.Properties",
"GetAll",
(interface_name,),
)
.and_then(|r: (arg::PropMap,)| Ok(r.0))
}
fn set<I2: arg::Arg + arg::Append>(&self, interface_name: &str, property_name: &str, value: I2) -> Result<(), dbus::Error> {
self.method_call("org.freedesktop.DBus.Properties", "Set", (interface_name, property_name, arg::Variant(value), ))
fn set<I2: arg::Arg + arg::Append>(
&self,
interface_name: &str,
property_name: &str,
value: I2,
) -> Result<(), dbus::Error> {
self.method_call(
"org.freedesktop.DBus.Properties",
"Set",
(interface_name, property_name, arg::Variant(value)),
)
}
}
@@ -61,11 +92,12 @@ pub trait OrgFreedesktopDBusIntrospectable {
fn introspect(&self) -> Result<String, dbus::Error>;
}
impl<'a, T: blocking::BlockingSender, C: ::std::ops::Deref<Target=T>> OrgFreedesktopDBusIntrospectable for blocking::Proxy<'a, C> {
impl<'a, T: blocking::BlockingSender, C: ::std::ops::Deref<Target = T>>
OrgFreedesktopDBusIntrospectable for blocking::Proxy<'a, C>
{
fn introspect(&self) -> Result<String, dbus::Error> {
self.method_call("org.freedesktop.DBus.Introspectable", "Introspect", ())
.and_then(|r: (String, )| Ok(r.0, ))
.and_then(|r: (String,)| Ok(r.0))
}
}
@@ -74,15 +106,16 @@ pub trait OrgFreedesktopDBusPeer {
fn get_machine_id(&self) -> Result<String, dbus::Error>;
}
impl<'a, T: blocking::BlockingSender, C: ::std::ops::Deref<Target=T>> OrgFreedesktopDBusPeer for blocking::Proxy<'a, C> {
impl<'a, T: blocking::BlockingSender, C: ::std::ops::Deref<Target = T>> OrgFreedesktopDBusPeer
for blocking::Proxy<'a, C>
{
fn ping(&self) -> Result<(), dbus::Error> {
self.method_call("org.freedesktop.DBus.Peer", "Ping", ())
}
fn get_machine_id(&self) -> Result<String, dbus::Error> {
self.method_call("org.freedesktop.DBus.Peer", "GetMachineId", ())
.and_then(|r: (String, )| Ok(r.0, ))
.and_then(|r: (String,)| Ok(r.0))
}
}
@@ -95,7 +128,17 @@ pub trait OrgFreedesktopNotifications {
fn close_all_notifications(&self) -> Result<(), dbus::Error>;
fn hide_latest_notification(&self, close: bool) -> Result<(), dbus::Error>;
fn get_capabilities(&self) -> Result<Vec<String>, dbus::Error>;
fn notify(&self, app_name: &str, replaces_id: u32, app_icon: &str, summary: &str, body: &str, actions: Vec<&str>, hints: arg::PropMap, expire_timeout: i32) -> Result<u32, dbus::Error>;
fn notify(
&self,
app_name: &str,
replaces_id: u32,
app_icon: &str,
summary: &str,
body: &str,
actions: Vec<&str>,
hints: arg::PropMap,
expire_timeout: i32,
) -> Result<u32, dbus::Error>;
fn close_notification(&self, id: u32) -> Result<(), dbus::Error>;
fn get_server_information(&self) -> Result<(String, String, String, String), dbus::Error>;
fn dnd(&self) -> Result<bool, dbus::Error>;
@@ -115,9 +158,7 @@ impl arg::AppendAll for OrgFreedesktopNotificationsOnDndToggle {
impl arg::ReadAll for OrgFreedesktopNotificationsOnDndToggle {
fn read(i: &mut arg::Iter) -> Result<Self, arg::TypeMismatchError> {
Ok(OrgFreedesktopNotificationsOnDndToggle {
dnd: i.read()?,
})
Ok(OrgFreedesktopNotificationsOnDndToggle { dnd: i.read()? })
}
}
@@ -207,15 +248,20 @@ impl dbus::message::SignalArgs for OrgFreedesktopNotificationsNotificationReplie
const INTERFACE: &'static str = "org.freedesktop.Notifications";
}
impl<'a, T: blocking::BlockingSender, C: ::std::ops::Deref<Target=T>> OrgFreedesktopNotifications for blocking::Proxy<'a, C> {
impl<'a, T: blocking::BlockingSender, C: ::std::ops::Deref<Target = T>> OrgFreedesktopNotifications
for blocking::Proxy<'a, C>
{
fn set_noti_window_visibility(&self, value: bool) -> Result<(), dbus::Error> {
self.method_call("org.freedesktop.Notifications", "SetNotiWindowVisibility", (value, ))
self.method_call(
"org.freedesktop.Notifications",
"SetNotiWindowVisibility",
(value,),
)
}
fn toggle_dnd(&self) -> Result<bool, dbus::Error> {
self.method_call("org.freedesktop.Notifications", "ToggleDnd", ())
.and_then(|r: (bool, )| Ok(r.0, ))
.and_then(|r: (bool,)| Ok(r.0))
}
fn set_dnd(&self, state: bool) -> Result<(), dbus::Error> {
@@ -224,11 +270,15 @@ impl<'a, T: blocking::BlockingSender, C: ::std::ops::Deref<Target=T>> OrgFreedes
fn get_dnd(&self) -> Result<bool, dbus::Error> {
self.method_call("org.freedesktop.Notifications", "GetDnd", ())
.and_then(|r: (bool, )| Ok(r.0, ))
.and_then(|r: (bool,)| Ok(r.0))
}
fn manually_close_notification(&self, id: u32, timeout: bool) -> Result<(), dbus::Error> {
self.method_call("org.freedesktop.Notifications", "ManuallyCloseNotification", (id, timeout, ))
self.method_call(
"org.freedesktop.Notifications",
"ManuallyCloseNotification",
(id, timeout),
)
}
fn close_all_notifications(&self) -> Result<(), dbus::Error> {
@@ -236,17 +286,44 @@ impl<'a, T: blocking::BlockingSender, C: ::std::ops::Deref<Target=T>> OrgFreedes
}
fn hide_latest_notification(&self, close: bool) -> Result<(), dbus::Error> {
self.method_call("org.freedesktop.Notifications", "HideLatestNotification", (close, ))
self.method_call(
"org.freedesktop.Notifications",
"HideLatestNotification",
(close,),
)
}
fn get_capabilities(&self) -> Result<Vec<String>, dbus::Error> {
self.method_call("org.freedesktop.Notifications", "GetCapabilities", ())
.and_then(|r: (Vec<String>, )| Ok(r.0, ))
.and_then(|r: (Vec<String>,)| Ok(r.0))
}
fn notify(&self, app_name: &str, replaces_id: u32, app_icon: &str, summary: &str, body: &str, actions: Vec<&str>, hints: arg::PropMap, expire_timeout: i32) -> Result<u32, dbus::Error> {
self.method_call("org.freedesktop.Notifications", "Notify", (app_name, replaces_id, app_icon, summary, body, actions, hints, expire_timeout, ))
.and_then(|r: (u32, )| Ok(r.0, ))
fn notify(
&self,
app_name: &str,
replaces_id: u32,
app_icon: &str,
summary: &str,
body: &str,
actions: Vec<&str>,
hints: arg::PropMap,
expire_timeout: i32,
) -> Result<u32, dbus::Error> {
self.method_call(
"org.freedesktop.Notifications",
"Notify",
(
app_name,
replaces_id,
app_icon,
summary,
body,
actions,
hints,
expire_timeout,
),
)
.and_then(|r: (u32,)| Ok(r.0))
}
fn close_notification(&self, id: u32) -> Result<(), dbus::Error> {
@@ -258,10 +335,19 @@ impl<'a, T: blocking::BlockingSender, C: ::std::ops::Deref<Target=T>> OrgFreedes
}
fn dnd(&self) -> Result<bool, dbus::Error> {
<Self as blocking::stdintf::org_freedesktop_dbus::Properties>::get(self, "org.freedesktop.Notifications", "Dnd")
<Self as blocking::stdintf::org_freedesktop_dbus::Properties>::get(
self,
"org.freedesktop.Notifications",
"Dnd",
)
}
fn set_dnd_(&self, value: bool) -> Result<(), dbus::Error> {
<Self as blocking::stdintf::org_freedesktop_dbus::Properties>::set(self, "org.freedesktop.Notifications", "Dnd", value)
<Self as blocking::stdintf::org_freedesktop_dbus::Properties>::set(
self,
"org.freedesktop.Notifications",
"Dnd",
value,
)
}
}

View File

@@ -153,7 +153,13 @@ impl InteractionHandler for WayVRInteractionHandler {
}
}
fn on_scroll(&mut self, _app: &mut state::AppState, _hit: &input::PointerHit, delta_y: f32, delta_x: f32) {
fn on_scroll(
&mut self,
_app: &mut state::AppState,
_hit: &input::PointerHit,
delta_y: f32,
delta_x: f32,
) {
let ctx = self.context.borrow();
ctx.wayvr
.borrow_mut()