Move librespot into lib.rs and let main.rs be the test binary

This commit is contained in:
Tor Arne Vestbø 2015-07-08 20:28:17 +02:00
parent e452abce43
commit cbd414853f
4 changed files with 56 additions and 25 deletions

View file

@ -4,6 +4,14 @@ version = "0.1.0"
authors = ["Paul Liétar <paul@lietar.net>"]
build = "build.rs"
[lib]
name = "librespot"
path = "src/lib.rs"
[[bin]]
name = "main"
path = "src/main.rs"
[dependencies.librespot-protocol]
path = "protocol"

View file

@ -20,7 +20,7 @@ pub enum AudioFile<'s> {
Loading(AudioFileLoading<'s>)
}
struct AudioFileLoading<'s> {
pub struct AudioFileLoading<'s> {
read_file: TempFile,
position: u64,

37
src/lib.rs Normal file
View file

@ -0,0 +1,37 @@
#![crate_name = "librespot"]
#![feature(plugin,scoped,zero_one,iter_arith,slice_position_elem,slice_bytes,bitset,arc_weak,append,future)]
#![allow(deprecated)]
#![allow(unused_imports,dead_code)]
#![plugin(protobuf_macros)]
#[macro_use] extern crate lazy_static;
extern crate byteorder;
extern crate crypto;
extern crate gmp;
extern crate num;
extern crate portaudio;
extern crate protobuf;
extern crate shannon;
extern crate rand;
extern crate readall;
extern crate vorbis;
extern crate time;
extern crate tempfile;
extern crate librespot_protocol;
#[macro_use] pub mod util;
pub mod audio_decrypt;
pub mod audio_file;
pub mod audio_key;
pub mod connection;
pub mod keys;
pub mod mercury;
pub mod metadata;
pub mod player;
pub mod session;
pub mod stream;
pub mod subsystem;

View file

@ -1,6 +1,4 @@
#![crate_name = "librespot"]
#![feature(plugin,scoped,zero_one,iter_arith,slice_position_elem,slice_bytes,bitset,arc_weak,append,future)]
#![feature(plugin,scoped)]
#![allow(deprecated)]
//#![allow(unused_imports,dead_code)]
@ -18,23 +16,9 @@ extern crate shannon;
extern crate rand;
extern crate readall;
extern crate vorbis;
extern crate time;
extern crate tempfile;
extern crate librespot_protocol;
#[macro_use] mod util;
mod audio_decrypt;
mod audio_file;
mod audio_key;
mod connection;
mod keys;
mod mercury;
mod metadata;
mod player;
mod session;
mod stream;
mod subsystem;
#[macro_use] extern crate librespot;
use std::clone::Clone;
use std::fs::File;
@ -44,12 +28,14 @@ use protobuf::core::Message;
use std::thread;
use std::path::PathBuf;
use metadata::{AlbumRef, ArtistRef, TrackRef};
use session::{Config, Session};
use util::SpotifyId;
use util::version::version_string;
use player::{Player, PlayerCommand};
use mercury::{MercuryRequest, MercuryMethod};
use librespot::util;
use librespot::metadata::{AlbumRef, ArtistRef, TrackRef};
use librespot::session::{Config, Session};
use librespot::util::SpotifyId;
use librespot::util::version::version_string;
use librespot::player::{Player, PlayerCommand};
use librespot::mercury::{MercuryRequest, MercuryMethod};
use librespot_protocol as protocol;
use librespot_protocol::spirc::PlayStatus;