Skip to main content

DiscordIPCSync

Struct DiscordIPCSync 

Source
pub struct DiscordIPCSync { /* private fields */ }
Expand description

Blocking wrapper

Implementations§

Source§

impl DiscordIPCSync

Source

pub fn new(client_id: &str) -> Result<Self>

Examples found in repository?
examples/indefinite-sync.rs (line 4)
3fn main() {
4    let mut client = DiscordIPCSync::new("1463450870480900160").unwrap();
5
6    client.run().unwrap();
7    client.set_activity("this runs", "forever").unwrap();
8    client.wait().unwrap();
9}
More examples
Hide additional 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}
Source

pub fn client_id(&self) -> String

Source

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}
Source

pub fn run(&mut self) -> Result<()>

Examples found in repository?
examples/indefinite-sync.rs (line 6)
3fn main() {
4    let mut client = DiscordIPCSync::new("1463450870480900160").unwrap();
5
6    client.run().unwrap();
7    client.set_activity("this runs", "forever").unwrap();
8    client.wait().unwrap();
9}
More examples
Hide additional 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}
Source

pub fn wait(&mut self) -> Result<()>

Examples found in repository?
examples/indefinite-sync.rs (line 8)
3fn main() {
4    let mut client = DiscordIPCSync::new("1463450870480900160").unwrap();
5
6    client.run().unwrap();
7    client.set_activity("this runs", "forever").unwrap();
8    client.wait().unwrap();
9}
Source

pub fn set_activity(&self, details: &str, state: &str) -> Result<()>

Examples found in repository?
examples/indefinite-sync.rs (line 7)
3fn main() {
4    let mut client = DiscordIPCSync::new("1463450870480900160").unwrap();
5
6    client.run().unwrap();
7    client.set_activity("this runs", "forever").unwrap();
8    client.wait().unwrap();
9}
More examples
Hide additional 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§

Source§

impl Debug for DiscordIPCSync

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.