Trait discord_rich_presence::DiscordIpc[][src]

pub trait DiscordIpc {
    fn get_valid_path(&mut self) -> Result<Option<PathBuf>, Box<dyn Error>>;
fn close(&mut self) -> Result<(), Box<dyn Error>>; fn connect(&mut self, client_id: &str) -> Result<(), Box<dyn Error>> { ... }
fn send_handshake(&mut self, client_id: &str) -> Result<(), Box<dyn Error>> { ... }
fn send(&mut self, data: Value, opcode: u8) -> Result<(), Box<dyn Error>> { ... }
fn recv(&mut self) -> Result<(u32, Value), Box<dyn Error>> { ... }
fn set_activity(
        &mut self,
        activity_payload: Value
    ) -> Result<(), Box<dyn Error>> { ... } }
Expand description

A client that connects to and communicates with the Discord IPC.

Required methods

fn get_valid_path(&mut self) -> Result<Option<PathBuf>, Box<dyn Error>>[src]

Tries to find a valid socket to connect to.

fn close(&mut self) -> Result<(), Box<dyn Error>>[src]

Closes the Discord IPC connection. Implementation is dependent on platform.

Provided methods

fn connect(&mut self, client_id: &str) -> Result<(), Box<dyn Error>>[src]

Connects the client to the Discord IPC. This method is typically called automatically by the new_client function.

fn send_handshake(&mut self, client_id: &str) -> Result<(), Box<dyn Error>>[src]

Handshakes the Discord IPC. Usually called automatically by connect

fn send(&mut self, data: Value, opcode: u8) -> Result<(), Box<dyn Error>>[src]

Sends JSON data to the Discord IPC.

fn recv(&mut self) -> Result<(u32, Value), Box<dyn Error>>[src]

Receives an opcode and JSON data from the Discord IPC.

fn set_activity(
    &mut self,
    activity_payload: Value
) -> Result<(), Box<dyn Error>>
[src]

An abstraction for sending rich presence data to the IPC such that only the presence’s JSON payload is required.

Implementors