Commit e0ab1b8 1 parent de82ab7 commit e0ab1b8 Copy full SHA for e0ab1b8
File tree 2 files changed +7
-7
lines changed
2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ async fn main() {
10
10
. init ( )
11
11
. unwrap ( ) ;
12
12
13
- let name = "Librespot" . to_string ( ) ;
13
+ let name = "Librespot" ;
14
14
let device_id = hex:: encode ( Sha1 :: digest ( name. as_bytes ( ) ) ) ;
15
15
16
16
let mut server = librespot_discovery:: Discovery :: builder ( device_id)
Original file line number Diff line number Diff line change @@ -75,18 +75,18 @@ pub enum Error {
75
75
76
76
impl Builder {
77
77
/// Starts a new builder using the provided device id.
78
- pub fn new ( device_id : String ) -> Self {
78
+ pub fn new ( device_id : impl Into < String > ) -> Self {
79
79
Self {
80
80
name : "Librespot" . into ( ) ,
81
81
device_type : DeviceType :: default ( ) ,
82
- device_id,
82
+ device_id : device_id . into ( ) ,
83
83
port : 0 ,
84
84
}
85
85
}
86
86
87
87
/// Sets the name to be displayed. Default is `"Librespot"`.
88
- pub fn name ( mut self , name : String ) -> Self {
89
- self . name = name;
88
+ pub fn name ( mut self , name : impl Into < String > ) -> Self {
89
+ self . name = name. into ( ) ;
90
90
self
91
91
}
92
92
@@ -143,12 +143,12 @@ impl Builder {
143
143
144
144
impl Discovery {
145
145
/// Starts a [`Builder`] with the provided device id.
146
- pub fn builder ( device_id : String ) -> Builder {
146
+ pub fn builder ( device_id : impl Into < String > ) -> Builder {
147
147
Builder :: new ( device_id)
148
148
}
149
149
150
150
/// Create a new instance with the specified device id and default paramaters.
151
- pub fn new ( device_id : String ) -> Result < Self , Error > {
151
+ pub fn new ( device_id : impl Into < String > ) -> Result < Self , Error > {
152
152
Self :: builder ( device_id) . launch ( )
153
153
}
154
154
}
You can’t perform that action at this time.
0 commit comments