Run rustfmt on the codebase

This commit is contained in:
Tom A. Wagner
2020-12-14 11:28:06 +01:00
parent 53895f8e28
commit c72bef364d
4 changed files with 18 additions and 14 deletions

View File

@@ -1,7 +1,7 @@
mod view;
use glib::clone;
use gio::prelude::*;
use glib::clone;
use gtk::prelude::*;
use std::rc::Rc;
@@ -10,10 +10,9 @@ pub struct PipewireLink {
pub node_from: u32,
pub port_from: u32,
pub node_to: u32,
pub port_to: u32
pub port_to: u32,
}
fn main() -> Result<(), Box<dyn std::error::Error>> {
gtk::init()?;
let mut graphview = view::GraphView::new();
@@ -31,12 +30,15 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
graphview.add_node(0, node);
graphview.add_node(1, node2);
graphview.add_link(2, PipewireLink {
node_from: 0,
port_from: 12,
node_to: 1,
port_to: 13
});
graphview.add_link(
2,
PipewireLink {
node_from: 0,
port_from: 12,
node_to: 1,
port_to: 13,
},
);
// End UI Testing
let graphview = Rc::new(graphview);

View File

@@ -62,11 +62,11 @@ fn draw(
cr.move_to(
(from_alloc.x + from_alloc.width).into(),
(from_alloc.y + (from_alloc.height / 2)).into()
(from_alloc.y + (from_alloc.height / 2)).into(),
);
cr.line_to(
to_alloc.x.into(),
(to_alloc.y + (to_alloc.height / 2)).into()
(to_alloc.y + (to_alloc.height / 2)).into(),
);
cr.stroke();

View File

@@ -1,5 +1,5 @@
mod graph_view;
mod pipewire_node;
pub use pipewire_node::PipewireNode;
pub use graph_view::GraphView;
pub use pipewire_node::PipewireNode;

View File

@@ -24,12 +24,14 @@ impl PipewireNode {
}
pub fn add_ingoing_port(&mut self, id: u32, port: gtk::Button) {
self.widget.attach(&port, 0, (self.ingoing_ports.len() + 1) as i32, 1, 1);
self.widget
.attach(&port, 0, (self.ingoing_ports.len() + 1) as i32, 1, 1);
self.ingoing_ports.insert(id, port);
}
pub fn add_outgoing_port(&mut self, id: u32, port: gtk::Button) {
self.widget.attach(&port, 1, (self.outgoing_ports.len() + 1) as i32, 1, 1);
self.widget
.attach(&port, 1, (self.outgoing_ports.len() + 1) as i32, 1, 1);
self.outgoing_ports.insert(id, port);
}