loops: Use Void for infinite loops
This commit is contained in:
9
src/actors/external/debug.rs
vendored
9
src/actors/external/debug.rs
vendored
@ -3,12 +3,13 @@
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
use std::thread;
|
||||
use zbus::{Connection, ObjectServer, dbus_interface, fdo};
|
||||
|
||||
use crate::main;
|
||||
use crate::state;
|
||||
|
||||
use std::thread;
|
||||
use zbus::{Connection, ObjectServer, dbus_interface, fdo};
|
||||
|
||||
use super::Void;
|
||||
|
||||
use std::convert::TryInto;
|
||||
|
||||
@ -37,7 +38,7 @@ impl Manager {
|
||||
}
|
||||
}
|
||||
|
||||
fn start(mgr: Manager) -> Result<(), Box<dyn std::error::Error>> {
|
||||
fn start(mgr: Manager) -> Result<Void, Box<dyn std::error::Error>> {
|
||||
let connection = Connection::new_session()?;
|
||||
fdo::DBusProxy::new(&connection)?.request_name(
|
||||
"sm.puri.SqueekDebug",
|
||||
|
||||
5
src/actors/external/mod.rs
vendored
5
src/actors/external/mod.rs
vendored
@ -8,4 +8,7 @@
|
||||
|
||||
pub mod debug;
|
||||
#[cfg(feature = "zbus_v1_5")]
|
||||
pub mod screensaver;
|
||||
pub mod screensaver;
|
||||
|
||||
/// The uninhabited type. Cannot be created or returned; means "will never return" as return type. Useful for infinite loops.
|
||||
enum Void {}
|
||||
5
src/actors/external/screensaver.rs
vendored
5
src/actors/external/screensaver.rs
vendored
@ -3,10 +3,11 @@
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
use crate::logging;
|
||||
use std::thread;
|
||||
use zbus::{Connection, dbus_proxy};
|
||||
|
||||
use crate::logging;
|
||||
use super::Void;
|
||||
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -45,7 +46,7 @@ pub fn init(destination: Destination) {
|
||||
});
|
||||
}
|
||||
|
||||
fn start(destination: Destination) -> Result<(), zbus::Error> {
|
||||
fn start(destination: Destination) -> Result<Void, zbus::Error> {
|
||||
let conn = Connection::new_session()?;
|
||||
let manager = ManagerProxy::new(&conn)?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user