Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/game_data.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = shaco::ingame::IngameClient::new()?;
let client = shaco::ingame::IngameClient::new();

let data = client.all_game_data(None).await?;

println!("{:#?}", data);
println!("{data:#?}");

Ok(())
}
4 changes: 2 additions & 2 deletions examples/ingame_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ use shaco::{ingame::EventStream, ingame::IngameClient};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let ingame_client = IngameClient::new()?;
let ingame_client = IngameClient::new();
let mut event_stream = EventStream::from_ingame_client(ingame_client, None);

while let Some(event) = event_stream.next().await {
println!("{:?}", event)
println!("{event:?}")
}

Ok(())
Expand Down
2 changes: 1 addition & 1 deletion examples/websocket_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.unwrap();

while let Some(event) = client.next().await {
println!("Event: {:?}", event);
println!("Event: {event:?}");
}

Ok(())
Expand Down
16 changes: 7 additions & 9 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,15 @@ impl Display for ProcessInfoError {
match self {
Self::ProcessNotAvailable => write!(
f,
"{:?}: Riot/League client process could not be found",
self
"{self:?}: Riot/League client process could not be found"
),
Self::PortNotFound => write!(
f,
"{:?}: API port could not be parsed from process arguments",
self
"{self:?}: API port could not be parsed from process arguments"
),
Self::AuthTokenNotFound => write!(
f,
"{:?}: API auth token could not be parsed from process arguments",
self
"{self:?}: API auth token could not be parsed from process arguments"
),
}
}
Expand All @@ -38,8 +35,9 @@ impl Display for ProcessInfoError {
/// Errors for the Ingame API
#[derive(Debug, Clone)]
pub enum IngameClientError {
/// An API might not be available yet during the loading screen
/// Some API calls only return valid results after the game has started even if other API calls already work
ApiNotAvailableInSpectatorMode,
/// An API might not be available yet during the loading screen
ApiNotAvailableDuringLoadingScreen,
/// An error occurred on the client side probably because of a malformed request \
/// Corresponds to HTTP status responses 400 – 499, excluding 400 and 404 which are [IngameClientError::ApiNotAvailableInSpectatorMode] and [IngameClientError::ApiNotAvailableDuringLoadingScreen]
Expand Down Expand Up @@ -99,10 +97,10 @@ impl Error for LcuWebsocketError {}
impl Display for LcuWebsocketError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::LcuNotAvailable(s) => write!(f, "LCU API not available: {}", s),
Self::LcuNotAvailable(s) => write!(f, "LCU API not available: {s}"),
Self::AuthError => write!(f, "Authentication error"),
Self::SendError => write!(f, "Error sending message"),
Self::Disconnected(s) => write!(f, "Websocket disconnected: {}", s),
Self::Disconnected(s) => write!(f, "Websocket disconnected: {s}"),
}
}
}
Loading
Loading