mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
Migrate to rust 2018 edition
This commit is contained in:
parent
2a1482c880
commit
be2ad9059a
6 changed files with 10 additions and 40 deletions
|
@ -7,6 +7,7 @@ description = "An open source client library for Spotify, with support for Spoti
|
|||
keywords = ["spotify"]
|
||||
repository = "https://github.com/librespot-org/librespot"
|
||||
readme = "README.md"
|
||||
edition = "2018"
|
||||
|
||||
[workspace]
|
||||
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
extern crate librespot;
|
||||
extern crate tokio_core;
|
||||
|
||||
use std::env;
|
||||
use tokio_core::reactor::Core;
|
||||
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
extern crate log;
|
||||
extern crate env_logger;
|
||||
|
||||
extern crate librespot;
|
||||
extern crate tokio_core;
|
||||
extern crate tokio_io;
|
||||
extern crate futures;
|
||||
|
||||
use env_logger;
|
||||
use std::env;
|
||||
use tokio_core::reactor::Core;
|
||||
|
||||
|
|
|
@ -1,15 +1,6 @@
|
|||
#![crate_name = "librespot"]
|
||||
#![cfg_attr(feature = "cargo-clippy", allow(unused_io_amount))]
|
||||
|
||||
extern crate base64;
|
||||
extern crate futures;
|
||||
extern crate hyper;
|
||||
extern crate num_bigint;
|
||||
extern crate protobuf;
|
||||
extern crate rand;
|
||||
extern crate tokio_core;
|
||||
extern crate url;
|
||||
|
||||
pub extern crate librespot_audio as audio;
|
||||
pub extern crate librespot_connect as connect;
|
||||
pub extern crate librespot_core as core;
|
||||
|
|
28
src/main.rs
28
src/main.rs
|
@ -1,21 +1,7 @@
|
|||
extern crate env_logger;
|
||||
extern crate futures;
|
||||
extern crate getopts;
|
||||
extern crate librespot;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
extern crate hex;
|
||||
extern crate rpassword;
|
||||
extern crate sha1;
|
||||
extern crate tokio_core;
|
||||
extern crate tokio_io;
|
||||
extern crate tokio_process;
|
||||
extern crate tokio_signal;
|
||||
extern crate url;
|
||||
|
||||
use futures::sync::mpsc::UnboundedReceiver;
|
||||
use futures::{Async, Future, Poll, Stream};
|
||||
use sha1::{Digest, Sha1};
|
||||
use log::{error, info, trace, warn};
|
||||
use std::env;
|
||||
use std::io::{self, stderr, Write};
|
||||
use std::mem;
|
||||
|
@ -40,7 +26,7 @@ use librespot::playback::mixer::{self, Mixer, MixerConfig};
|
|||
use librespot::playback::player::{Player, PlayerEvent};
|
||||
|
||||
mod player_event_handler;
|
||||
use player_event_handler::run_program_on_events;
|
||||
use crate::player_event_handler::run_program_on_events;
|
||||
|
||||
fn device_id(name: &str) -> String {
|
||||
hex::encode(Sha1::digest(name.as_bytes()))
|
||||
|
@ -86,10 +72,10 @@ fn list_backends() {
|
|||
|
||||
#[derive(Clone)]
|
||||
struct Setup {
|
||||
backend: fn(Option<String>) -> Box<Sink>,
|
||||
backend: fn(Option<String>) -> Box<dyn Sink>,
|
||||
device: Option<String>,
|
||||
|
||||
mixer: fn(Option<MixerConfig>) -> Box<Mixer>,
|
||||
mixer: fn(Option<MixerConfig>) -> Box<dyn Mixer>,
|
||||
|
||||
cache: Option<Cache>,
|
||||
player_config: PlayerConfig,
|
||||
|
@ -367,9 +353,9 @@ struct Main {
|
|||
player_config: PlayerConfig,
|
||||
session_config: SessionConfig,
|
||||
connect_config: ConnectConfig,
|
||||
backend: fn(Option<String>) -> Box<Sink>,
|
||||
backend: fn(Option<String>) -> Box<dyn Sink>,
|
||||
device: Option<String>,
|
||||
mixer: fn(Option<MixerConfig>) -> Box<Mixer>,
|
||||
mixer: fn(Option<MixerConfig>) -> Box<dyn Mixer>,
|
||||
mixer_config: MixerConfig,
|
||||
handle: Handle,
|
||||
|
||||
|
@ -378,7 +364,7 @@ struct Main {
|
|||
|
||||
spirc: Option<Spirc>,
|
||||
spirc_task: Option<SpircTask>,
|
||||
connect: Box<Future<Item = Session, Error = io::Error>>,
|
||||
connect: Box<dyn Future<Item = Session, Error = io::Error>>,
|
||||
|
||||
shutdown: bool,
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use log::info;
|
||||
use librespot::playback::player::PlayerEvent;
|
||||
use tokio_process::{Child, CommandExt};
|
||||
use std::collections::HashMap;
|
||||
|
|
Loading…
Reference in a new issue