pub struct DiscordIPCSync { /* private fields */ }Expand description
Blocking wrapper
Implementations§
Source§impl DiscordIPCSync
impl DiscordIPCSync
Sourcepub fn new(client_id: &str) -> Result<Self>
pub fn new(client_id: &str) -> Result<Self>
Examples found in repository?
More examples
examples/timed-sync.rs (line 6)
5fn main() {
6 let mut client = DiscordIPCSync::new("1463450870480900160").unwrap();
7
8 // first run
9 client.run().unwrap();
10
11 client.set_activity("this runs", "for ten seconds").unwrap();
12 sleep(Duration::from_secs(5));
13 client.set_activity("believe it", "or not").unwrap();
14 sleep(Duration::from_secs(5));
15
16 client.close().unwrap();
17 client.wait().unwrap();
18
19 // 2nd run
20 client.run().unwrap();
21
22 client.set_activity("this is the", "second run").unwrap();
23 sleep(Duration::from_secs(5));
24 client
25 .set_activity("which also runs", "for ten seconds")
26 .unwrap();
27 sleep(Duration::from_secs(5));
28}pub fn client_id(&self) -> String
Sourcepub fn run(&mut self) -> Result<()>
pub fn run(&mut self) -> Result<()>
Examples found in repository?
More examples
examples/timed-sync.rs (line 9)
5fn main() {
6 let mut client = DiscordIPCSync::new("1463450870480900160").unwrap();
7
8 // first run
9 client.run().unwrap();
10
11 client.set_activity("this runs", "for ten seconds").unwrap();
12 sleep(Duration::from_secs(5));
13 client.set_activity("believe it", "or not").unwrap();
14 sleep(Duration::from_secs(5));
15
16 client.close().unwrap();
17 client.wait().unwrap();
18
19 // 2nd run
20 client.run().unwrap();
21
22 client.set_activity("this is the", "second run").unwrap();
23 sleep(Duration::from_secs(5));
24 client
25 .set_activity("which also runs", "for ten seconds")
26 .unwrap();
27 sleep(Duration::from_secs(5));
28}Sourcepub fn wait(&mut self) -> Result<()>
pub fn wait(&mut self) -> Result<()>
Examples found in repository?
More examples
examples/timed-sync.rs (line 17)
5fn main() {
6 let mut client = DiscordIPCSync::new("1463450870480900160").unwrap();
7
8 // first run
9 client.run().unwrap();
10
11 client.set_activity("this runs", "for ten seconds").unwrap();
12 sleep(Duration::from_secs(5));
13 client.set_activity("believe it", "or not").unwrap();
14 sleep(Duration::from_secs(5));
15
16 client.close().unwrap();
17 client.wait().unwrap();
18
19 // 2nd run
20 client.run().unwrap();
21
22 client.set_activity("this is the", "second run").unwrap();
23 sleep(Duration::from_secs(5));
24 client
25 .set_activity("which also runs", "for ten seconds")
26 .unwrap();
27 sleep(Duration::from_secs(5));
28}Sourcepub fn set_activity(&self, details: &str, state: &str) -> Result<()>
pub fn set_activity(&self, details: &str, state: &str) -> Result<()>
Examples found in repository?
More examples
examples/timed-sync.rs (line 11)
5fn main() {
6 let mut client = DiscordIPCSync::new("1463450870480900160").unwrap();
7
8 // first run
9 client.run().unwrap();
10
11 client.set_activity("this runs", "for ten seconds").unwrap();
12 sleep(Duration::from_secs(5));
13 client.set_activity("believe it", "or not").unwrap();
14 sleep(Duration::from_secs(5));
15
16 client.close().unwrap();
17 client.wait().unwrap();
18
19 // 2nd run
20 client.run().unwrap();
21
22 client.set_activity("this is the", "second run").unwrap();
23 sleep(Duration::from_secs(5));
24 client
25 .set_activity("which also runs", "for ten seconds")
26 .unwrap();
27 sleep(Duration::from_secs(5));
28}Sourcepub fn close(&self) -> Result<()>
pub fn close(&self) -> Result<()>
Examples found in repository?
examples/timed-sync.rs (line 16)
5fn main() {
6 let mut client = DiscordIPCSync::new("1463450870480900160").unwrap();
7
8 // first run
9 client.run().unwrap();
10
11 client.set_activity("this runs", "for ten seconds").unwrap();
12 sleep(Duration::from_secs(5));
13 client.set_activity("believe it", "or not").unwrap();
14 sleep(Duration::from_secs(5));
15
16 client.close().unwrap();
17 client.wait().unwrap();
18
19 // 2nd run
20 client.run().unwrap();
21
22 client.set_activity("this is the", "second run").unwrap();
23 sleep(Duration::from_secs(5));
24 client
25 .set_activity("which also runs", "for ten seconds")
26 .unwrap();
27 sleep(Duration::from_secs(5));
28}Trait Implementations§
Source§impl Debug for DiscordIPCSync
impl Debug for DiscordIPCSync
Auto Trait Implementations§
impl !Freeze for DiscordIPCSync
impl RefUnwindSafe for DiscordIPCSync
impl Send for DiscordIPCSync
impl Sync for DiscordIPCSync
impl Unpin for DiscordIPCSync
impl UnsafeUnpin for DiscordIPCSync
impl UnwindSafe for DiscordIPCSync
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more