Use lib/bin separation to allow for proper documentation

This commit is contained in:
Julian Ospald 2017-07-14 17:23:26 +02:00
parent 1c0fbc8760
commit 87eba7e3a8
4 changed files with 104 additions and 92 deletions

View File

@ -3,6 +3,16 @@ name = "pnmixer-rs"
version = "0.1.0"
authors = ["Julian Ospald <hasufell@posteo.de>"]
[lib]
name = "pnmixerlib"
path = "src/lib.rs"
doc = true
[[bin]]
name = "pnmixer-rs"
path = "src/bin.rs"
doc = false
[dependencies]
alsa = "^0.1.8"
alsa-sys = "^0.1.1"

34
src/bin.rs Normal file
View File

@ -0,0 +1,34 @@
#![feature(alloc_system)]
extern crate alloc_system;
extern crate pnmixerlib;
use pnmixerlib::*;
use app_state::*;
#[cfg(feature = "notify")]
use libnotify::*;
use std::rc::Rc;
fn main() {
gtk::init().unwrap();
// TODO: error handling
#[cfg(feature = "notify")]
init("PNMixer-rs").unwrap();
flexi_logger::LogOptions::new()
.log_to_file(false)
// ... your configuration options go here ...
.init(Some("pnmixer=debug".to_string()))
.unwrap_or_else(|e| panic!("Logger initialization failed with {}", e));
let apps = Rc::new(AppS::new());
ui_entry::init(apps);
gtk::main();
#[cfg(feature = "notify")]
uninit();
}

60
src/lib.rs Normal file
View File

@ -0,0 +1,60 @@
#![feature(alloc_system)]
extern crate alloc_system;
pub extern crate flexi_logger;
#[macro_use]
pub extern crate log;
#[macro_use]
pub extern crate error_chain;
#[macro_use]
pub extern crate serde_derive;
pub extern crate toml;
pub extern crate serde;
pub extern crate alsa;
pub extern crate alsa_sys;
pub extern crate ffi;
pub extern crate gdk;
pub extern crate gdk_pixbuf;
pub extern crate gdk_pixbuf_sys;
pub extern crate gdk_sys;
pub extern crate gio;
pub extern crate glib;
pub extern crate glib_sys;
pub extern crate gobject_sys;
pub extern crate gtk;
pub extern crate gtk_sys;
pub extern crate libc;
pub extern crate png;
pub extern crate which;
pub extern crate xdg;
#[cfg(feature = "notify")]
pub extern crate libnotify;
#[macro_use]
pub mod errors;
#[macro_use]
pub mod glade_helpers;
pub mod alsa_card;
pub mod app_state;
pub mod audio;
pub mod prefs;
pub mod support_alsa;
pub mod support_audio;
pub mod support_cmd;
#[macro_use]
pub mod support_ui;
pub mod ui_entry;
pub mod ui_popup_menu;
pub mod ui_popup_window;
pub mod ui_prefs_dialog;
pub mod ui_tray_icon;
#[cfg(feature = "notify")]
pub mod notif;

View File

@ -1,92 +0,0 @@
#![feature(alloc_system)]
extern crate alloc_system;
extern crate flexi_logger;
#[macro_use]
extern crate log;
#[macro_use]
extern crate error_chain;
#[macro_use]
extern crate serde_derive;
extern crate toml;
extern crate serde;
extern crate alsa;
extern crate alsa_sys;
extern crate ffi;
extern crate gdk;
extern crate gdk_pixbuf;
extern crate gdk_pixbuf_sys;
extern crate gdk_sys;
extern crate gio;
extern crate glib;
extern crate glib_sys;
extern crate gobject_sys;
extern crate gtk;
extern crate gtk_sys;
extern crate libc;
extern crate png;
extern crate which;
extern crate xdg;
#[cfg(feature = "notify")]
extern crate libnotify;
use std::rc::Rc;
#[macro_use]
mod errors;
#[macro_use]
mod glade_helpers;
mod alsa_card;
mod app_state;
mod audio;
mod prefs;
mod support_alsa;
mod support_audio;
mod support_cmd;
#[macro_use]
mod support_ui;
mod ui_entry;
mod ui_popup_menu;
mod ui_popup_window;
mod ui_prefs_dialog;
mod ui_tray_icon;
#[cfg(feature = "notify")]
mod notif;
use app_state::*;
#[cfg(feature = "notify")]
use libnotify::*;
fn main() {
gtk::init().unwrap();
// TODO: error handling
#[cfg(feature = "notify")]
init("PNMixer-rs").unwrap();
flexi_logger::LogOptions::new()
.log_to_file(false)
// ... your configuration options go here ...
.init(Some("pnmixer=debug".to_string()))
.unwrap_or_else(|e| panic!("Logger initialization failed with {}", e));
let apps = Rc::new(AppS::new());
ui_entry::init(apps);
gtk::main();
#[cfg(feature = "notify")]
uninit();
}