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 client.run().unwrap();
9
10 client.set_activity("this runs", "for ten seconds").unwrap();
11 sleep(Duration::from_secs(5));
12 client.set_activity("believe it", "or not").unwrap();
13 sleep(Duration::from_secs(5));
14
15 println!(
16 "Duration: {} seconds",
17 client.duration_since().unwrap().as_secs()
18 )
19}pub fn client_id(&self) -> String
Sourcepub fn duration_since(&self) -> Result<Duration>
pub fn duration_since(&self) -> Result<Duration>
Examples found in repository?
examples/timed-sync.rs (line 17)
5fn main() {
6 let mut client = DiscordIPCSync::new("1463450870480900160").unwrap();
7
8 client.run().unwrap();
9
10 client.set_activity("this runs", "for ten seconds").unwrap();
11 sleep(Duration::from_secs(5));
12 client.set_activity("believe it", "or not").unwrap();
13 sleep(Duration::from_secs(5));
14
15 println!(
16 "Duration: {} seconds",
17 client.duration_since().unwrap().as_secs()
18 )
19}Sourcepub fn run(&mut self) -> Result<()>
pub fn run(&mut self) -> Result<()>
Examples found in repository?
More examples
examples/timed-sync.rs (line 8)
5fn main() {
6 let mut client = DiscordIPCSync::new("1463450870480900160").unwrap();
7
8 client.run().unwrap();
9
10 client.set_activity("this runs", "for ten seconds").unwrap();
11 sleep(Duration::from_secs(5));
12 client.set_activity("believe it", "or not").unwrap();
13 sleep(Duration::from_secs(5));
14
15 println!(
16 "Duration: {} seconds",
17 client.duration_since().unwrap().as_secs()
18 )
19}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 10)
5fn main() {
6 let mut client = DiscordIPCSync::new("1463450870480900160").unwrap();
7
8 client.run().unwrap();
9
10 client.set_activity("this runs", "for ten seconds").unwrap();
11 sleep(Duration::from_secs(5));
12 client.set_activity("believe it", "or not").unwrap();
13 sleep(Duration::from_secs(5));
14
15 println!(
16 "Duration: {} seconds",
17 client.duration_since().unwrap().as_secs()
18 )
19}Trait Implementations§
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