@@ -166,6 +166,11 @@ impl<S: Read + Write> Client<S> {
166166 self . run_command ( "stop" , ( ) ) . and_then ( |_| self . expect_ok ( ) )
167167 }
168168
169+ /// Toggle pause state
170+ pub fn toggle_pause ( & mut self ) -> Result < ( ) > {
171+ self . run_command ( "pause" , ( ) ) . and_then ( |_| self . expect_ok ( ) )
172+ }
173+
169174 /// Set pause state
170175 pub fn pause ( & mut self , value : bool ) -> Result < ( ) > {
171176 self . run_command ( "pause" , value as u8 ) . and_then ( |_| self . expect_ok ( ) )
@@ -474,8 +479,12 @@ impl<S: Read + Write> Client<S> {
474479 /// List all channels available for current connection
475480 pub fn channels ( & mut self ) -> Result < Vec < Channel > > {
476481 self . run_command ( "channels" , ( ) ) . and_then ( |_| self . read_list ( "channel" ) ) . map ( |v| {
477- v. into_iter ( ) . map ( |b| unsafe { Channel :: new_unchecked ( b) } ) . collect ( )
478- } )
482+ v. into_iter ( )
483+ . map ( |b| unsafe {
484+ Channel :: new_unchecked ( b)
485+ } )
486+ . collect ( )
487+ } )
479488 }
480489
481490 /// Read queued messages from subscribed channels
@@ -553,32 +562,26 @@ impl<S: Read + Write> Client<S> {
553562
554563 /// List all stickers from a given object, identified by type and uri
555564 pub fn stickers ( & mut self , typ : & str , uri : & str ) -> Result < Vec < String > > {
556- self . run_command ( "sticker list" , ( typ, uri) ) . and_then ( |_| self . read_list ( "sticker" ) ) . map ( |v| {
557- v. into_iter ( )
558- . map ( |b| {
559- b. splitn ( 2 , '=' )
560- . nth ( 1 )
561- . map ( |s| s. to_owned ( ) )
562- . unwrap ( )
563- } )
564- . collect ( )
565- } )
565+ self . run_command ( "sticker list" , ( typ, uri) )
566+ . and_then ( |_| self . read_list ( "sticker" ) )
567+ . map ( |v| v. into_iter ( ) . map ( |b| b. splitn ( 2 , '=' ) . nth ( 1 ) . map ( |s| s. to_owned ( ) ) . unwrap ( ) ) . collect ( ) )
566568 }
567569
568570 /// List all (file, sticker) pairs for sticker name and objects of given type
569571 /// from given directory (identified by uri)
570572 pub fn find_sticker ( & mut self , typ : & str , uri : & str , name : & str ) -> Result < Vec < ( String , String ) > > {
571- self . run_command ( "sticker find" , ( typ, uri, name) ) . and_then ( |_| {
572- self . read_pairs ( )
573- . split ( "file" )
574- . map ( |rmap| {
575- rmap. map ( |mut map| {
576- ( map. remove ( "file" ) . unwrap ( ) ,
577- map. remove ( "sticker" ) . and_then ( |s| s. splitn ( 2 , '=' ) . nth ( 1 ) . map ( |s| s. to_owned ( ) ) ) . unwrap ( ) )
578- } )
579- } )
580- . collect ( )
581- } )
573+ self . run_command ( "sticker find" , ( typ, uri, name) )
574+ . and_then ( |_| {
575+ self . read_pairs ( )
576+ . split ( "file" )
577+ . map ( |rmap| {
578+ rmap. map ( |mut map| {
579+ ( map. remove ( "file" ) . unwrap ( ) ,
580+ map. remove ( "sticker" ) . and_then ( |s| s. splitn ( 2 , '=' ) . nth ( 1 ) . map ( |s| s. to_owned ( ) ) ) . unwrap ( ) )
581+ } )
582+ } )
583+ . collect ( )
584+ } )
582585 }
583586
584587 /// List all files of a given type under given directory (identified by uri)
0 commit comments