Skip to content

Commit f448904

Browse files
committed
Add logo to documentation
1 parent 2291a5f commit f448904

File tree

1 file changed

+35
-6
lines changed

1 file changed

+35
-6
lines changed

src/lib.rs

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
//! The core of this crate is the [`Steam`] struct, which interacts with the Steam Web API. It typically[^1] needs to be initialized with a valid Steam API key.
88
//!
99
//! ```
10+
//! use steam_rs::Steam;
11+
//!
1012
//! // Retrieve the Steam API key from an environment variable.
1113
//! let steam_api_key = &std::env::var("STEAM_API_KEY").expect("Missing an API key");
1214
//!
@@ -16,19 +18,46 @@
1618
//!
1719
//! Another key component of this crate is the [`SteamId`](`steam_id::SteamId`) struct. It represents a Steam user ID[^2], which is often used when querying user data.
1820
//!
21+
//! ## Example
22+
//!
23+
//! Here is an example, where the [`Steam`] client requests data about two users using the [`.get_player_summaries(steam_ids)`](`Steam::get_player_summaries()`) method:
24+
//!
1925
//! ```
20-
//! let steam_ids = vec![
21-
//! SteamId::new(76561198136162943),
22-
//! SteamId(76561197960435530),
23-
//! ];
26+
//! use steam_rs::{steam_id::SteamId, Steam};
27+
//!
28+
//! #[tokio::main]
29+
//! async fn main() {
30+
//! // Get the Steam API Key as an environment variable.
31+
//! let steam_api_key = &std::env::var("STEAM_API_KEY").expect("Missing an API key");
2432
//!
25-
//! // Request the player summaries of SteamIDs `76561198136162943` and `76561197960435530`.
26-
//! let player_summaries = steam.get_player_summaries(steam_ids).await.unwrap();
33+
//! // Initialize the Steam API client.
34+
//! let steam = Steam::new(steam_api_key);
35+
//!
36+
//! // Request the player summaries of SteamIDs `76561198136162943` and `76561197960435530`.
37+
//! let steam_ids = vec![
38+
//! SteamId::new(76561198136162943), // Garrett Howard
39+
//! SteamId(76561197960435530), // Robin Walker
40+
//! ];
41+
//!
42+
//! let player_summaries = steam.get_player_summaries(steam_ids).await.unwrap();
43+
//!
44+
//! // Print the recieved information about the players.
45+
//! for player in player_summaries {
46+
//! println!(
47+
//! "{:?}'s SteamID is {:?}",
48+
//! player.persona_name, player.steam_id
49+
//! )
50+
//! }
51+
//! }
2752
//! ```
2853
//!
2954
//! [^1]: Not all API endpoints require an API key, and in that case providing one is optional.
3055
//! [^2]: Specifically, [`SteamId`](`steam_id::SteamId`) represents a SteamID64 type, but more types, such as SteamID and SteamID3 are planned in future releases.
3156
57+
#![doc(
58+
html_logo_url = "https://raw.githubusercontent.com/garhow/steam-rs/refs/heads/main/branding/docs.png"
59+
)]
60+
3261
pub mod econ_service;
3362
pub mod game_servers_service;
3463
pub mod player_service;

0 commit comments

Comments
 (0)