Client

Struct Client 

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

Client for interacting with the FACEIT Public API

Implementations§

Source§

impl Client

Source

pub fn new() -> Self

Create a new client without authentication

Requests without authentication are subject to standard rate limits.

§Examples
use faceit::HttpClient;

let client = HttpClient::new();
Examples found in repository?
examples/ergonomic_api.rs (line 5)
4async fn main() -> Result<(), faceit::error::Error> {
5    let client = HttpClient::new();
6
7    // Example 1: Player API
8    println!("=== Player API ===");
9    let player = faceit::http::ergonomic::Player::new("player-id-here", &client);
10
11    // Get player details
12    match player.get().await {
13        Ok(player_data) => {
14            println!("Player: {}", player_data.nickname);
15            if let Some(country) = player_data.country {
16                println!("Country: {}", country);
17            }
18        }
19        Err(e) => eprintln!("Error: {}", e),
20    }
21
22    // Get player stats
23    match player.stats("cs2").await {
24        Ok(stats) => {
25            println!("Stats retrieved for game: {}", stats.game_id);
26        }
27        Err(e) => eprintln!("Error: {}", e),
28    }
29
30    // Get player match history
31    match player.history("cs2", None, None, Some(0), Some(20)).await {
32        Ok(history) => {
33            println!("Found {} matches", history.items.len());
34        }
35        Err(e) => eprintln!("Error: {}", e),
36    }
37
38    // Get player hubs
39    match player.hubs(Some(0), Some(50)).await {
40        Ok(hubs) => {
41            println!("Found {} hubs", hubs.items.len());
42        }
43        Err(e) => eprintln!("Error: {}", e),
44    }
45
46    // Example 2: Match API
47    println!("\n=== Match API ===");
48    let match_obj = faceit::http::ergonomic::Match::new("match-id-here", &client);
49
50    match match_obj.get().await {
51        Ok(match_data) => {
52            println!("Match ID: {}", match_data.match_id);
53            println!("Status: {}", match_data.status);
54        }
55        Err(e) => eprintln!("Error: {}", e),
56    }
57
58    match match_obj.stats().await {
59        Ok(stats) => {
60            println!("Rounds: {}", stats.rounds.len());
61        }
62        Err(e) => eprintln!("Error: {}", e),
63    }
64
65    // Example 3: Game API
66    println!("\n=== Game API ===");
67    let game = faceit::http::ergonomic::Game::new("cs2", &client);
68
69    match game.get().await {
70        Ok(game_data) => {
71            println!("Game: {}", game_data.long_label);
72        }
73        Err(e) => eprintln!("Error: {}", e),
74    }
75
76    match game.matchmakings(Some("EU"), Some(0), Some(20)).await {
77        Ok(matchmakings) => {
78            println!("Found {} matchmakings", matchmakings.items.len());
79        }
80        Err(e) => eprintln!("Error: {}", e),
81    }
82
83    // Example 4: Hub API
84    println!("\n=== Hub API ===");
85    let hub = faceit::http::ergonomic::Hub::new("hub-id-here", &client);
86
87    match hub.get(None).await {
88        Ok(hub_data) => {
89            println!("Hub: {}", hub_data.name);
90        }
91        Err(e) => eprintln!("Error: {}", e),
92    }
93
94    match hub.matches(Some("all"), Some(0), Some(20)).await {
95        Ok(matches) => {
96            println!("Found {} matches", matches.items.len());
97        }
98        Err(e) => eprintln!("Error: {}", e),
99    }
100
101    match hub.members(Some(0), Some(50)).await {
102        Ok(members) => {
103            println!("Found {} members", members.items.len());
104        }
105        Err(e) => eprintln!("Error: {}", e),
106    }
107
108    // Example 5: Championship API
109    println!("\n=== Championship API ===");
110    let championship = faceit::http::ergonomic::Championship::new("championship-id-here", &client);
111
112    match championship.get(None).await {
113        Ok(championship_data) => {
114            println!("Championship: {}", championship_data.name);
115        }
116        Err(e) => eprintln!("Error: {}", e),
117    }
118
119    match championship.matches(Some("all"), Some(0), Some(20)).await {
120        Ok(matches) => {
121            println!("Found {} matches", matches.items.len());
122        }
123        Err(e) => eprintln!("Error: {}", e),
124    }
125
126    // Example 6: Direct instantiation (alternative to client methods)
127    println!("\n=== Direct Instantiation ===");
128    use faceit::http::ergonomic::{Championship, Game, Hub, Match, Player};
129
130    let _player2 = Player::new("player-id-here", &client);
131    let _match_obj2 = Match::new("match-id-here", &client);
132    let _game2 = Game::new("cs2", &client);
133    let _hub2 = Hub::new("hub-id-here", &client);
134    let _championship2 = Championship::new("championship-id-here", &client);
135
136    println!("Created ergonomic API instances directly");
137
138    Ok(())
139}
More examples
Hide additional examples
examples/basic_usage.rs (line 6)
4async fn main() -> Result<(), faceit::error::Error> {
5    // Create a client (without authentication)
6    let client = HttpClient::new();
7
8    // Or create a client with API key or access token:
9    // let client = Client::builder()
10    //     .api_key("your-api-key-or-access-token")
11    //     .build()?;
12
13    // Example 1: Get player by ID
14    println!("Fetching player by ID...");
15    match client.get_player("player-id-here").await {
16        Ok(player) => {
17            println!("Player: {}", player.nickname);
18            if let Some(country) = player.country {
19                println!("Country: {}", country);
20            }
21        }
22        Err(e) => eprintln!("Error fetching player: {}", e),
23    }
24
25    // Example 2: Get player from lookup by nickname
26    println!("\nFetching player from lookup...");
27    match client
28        .get_player_from_lookup(Some("player_nickname"), Some("cs2"), None)
29        .await
30    {
31        Ok(player) => {
32            println!("Player: {}", player.nickname);
33        }
34        Err(e) => eprintln!("Error fetching player: {}", e),
35    }
36
37    // Example 3: Get player stats
38    println!("\nFetching player stats...");
39    match client.get_player_stats("player-id-here", "cs2").await {
40        Ok(stats) => {
41            println!("Player ID: {}", stats.player_id);
42            println!("Game ID: {}", stats.game_id);
43        }
44        Err(e) => eprintln!("Error fetching stats: {}", e),
45    }
46
47    // Example 4: Get player match history
48    println!("\nFetching player match history...");
49    match client
50        .get_player_history("player-id-here", "cs2", None, None, Some(0), Some(20))
51        .await
52    {
53        Ok(history) => {
54            println!("Found {} matches", history.items.len());
55            if let Some(first_match) = history.items.first() {
56                println!("Most recent match: {}", first_match.match_id);
57            }
58        }
59        Err(e) => eprintln!("Error fetching history: {}", e),
60    }
61
62    // Example 5: Get match details
63    println!("\nFetching match details...");
64    match client.get_match("match-id-here").await {
65        Ok(match_details) => {
66            println!("Match ID: {}", match_details.match_id);
67            println!("Game: {}", match_details.game);
68            println!("Status: {}", match_details.status);
69        }
70        Err(e) => eprintln!("Error fetching match: {}", e),
71    }
72
73    // Example 6: Get match stats
74    println!("\nFetching match stats...");
75    match client.get_match_stats("match-id-here").await {
76        Ok(stats) => {
77            println!("Rounds: {}", stats.rounds.len());
78        }
79        Err(e) => eprintln!("Error fetching match stats: {}", e),
80    }
81
82    // Example 7: Search for players
83    println!("\nSearching for players...");
84    match client
85        .search_players("player_name", Some("cs2"), None, Some(0), Some(20))
86        .await
87    {
88        Ok(results) => {
89            println!("Found {} players", results.items.len());
90            for player in results.items.iter().take(5) {
91                println!("  - {} ({})", player.nickname, player.player_id);
92            }
93        }
94        Err(e) => eprintln!("Error searching players: {}", e),
95    }
96
97    // Example 8: Get all games
98    println!("\nFetching all games...");
99    match client.get_all_games(Some(0), Some(20)).await {
100        Ok(games) => {
101            println!("Found {} games", games.items.len());
102            for game in games.items.iter().take(5) {
103                println!("  - {} ({})", game.long_label, game.game_id);
104            }
105        }
106        Err(e) => eprintln!("Error fetching games: {}", e),
107    }
108
109    // Example 9: Get hub details
110    println!("\nFetching hub details...");
111    match client.get_hub("hub-id-here", None).await {
112        Ok(hub) => {
113            println!("Hub: {}", hub.name);
114            println!("Game: {}", hub.game_id);
115        }
116        Err(e) => eprintln!("Error fetching hub: {}", e),
117    }
118
119    // Example 10: Get global ranking
120    println!("\nFetching global ranking...");
121    match client
122        .get_global_ranking("cs2", "EU", None, Some(0), Some(20))
123        .await
124    {
125        Ok(ranking) => {
126            println!("Found {} players in ranking", ranking.items.len());
127            for entry in ranking.items.iter().take(5) {
128                println!(
129                    "  {}: {} - ELO: {}",
130                    entry.position, entry.nickname, entry.faceit_elo
131                );
132            }
133        }
134        Err(e) => eprintln!("Error fetching ranking: {}", e),
135    }
136
137    // Example 11: Using the builder pattern with authentication
138    println!("\nCreating client with builder...");
139    let _custom_client = HttpClient::builder()
140        .api_key("your-api-key-or-access-token-here")
141        .timeout(std::time::Duration::from_secs(60))
142        .build()?;
143
144    println!("Client created with custom configuration");
145
146    Ok(())
147}
Source

pub fn builder() -> ClientBuilder

Create a builder for customizing the client configuration

§Examples
use faceit::HttpClient;
use std::time::Duration;

let client = HttpClient::builder()
    .api_key("your-api-key-or-access-token")
    .timeout(Duration::from_secs(60))
    .base_url("https://custom-api.example.com")
    .build()
    .unwrap();
Examples found in repository?
examples/basic_usage.rs (line 139)
4async fn main() -> Result<(), faceit::error::Error> {
5    // Create a client (without authentication)
6    let client = HttpClient::new();
7
8    // Or create a client with API key or access token:
9    // let client = Client::builder()
10    //     .api_key("your-api-key-or-access-token")
11    //     .build()?;
12
13    // Example 1: Get player by ID
14    println!("Fetching player by ID...");
15    match client.get_player("player-id-here").await {
16        Ok(player) => {
17            println!("Player: {}", player.nickname);
18            if let Some(country) = player.country {
19                println!("Country: {}", country);
20            }
21        }
22        Err(e) => eprintln!("Error fetching player: {}", e),
23    }
24
25    // Example 2: Get player from lookup by nickname
26    println!("\nFetching player from lookup...");
27    match client
28        .get_player_from_lookup(Some("player_nickname"), Some("cs2"), None)
29        .await
30    {
31        Ok(player) => {
32            println!("Player: {}", player.nickname);
33        }
34        Err(e) => eprintln!("Error fetching player: {}", e),
35    }
36
37    // Example 3: Get player stats
38    println!("\nFetching player stats...");
39    match client.get_player_stats("player-id-here", "cs2").await {
40        Ok(stats) => {
41            println!("Player ID: {}", stats.player_id);
42            println!("Game ID: {}", stats.game_id);
43        }
44        Err(e) => eprintln!("Error fetching stats: {}", e),
45    }
46
47    // Example 4: Get player match history
48    println!("\nFetching player match history...");
49    match client
50        .get_player_history("player-id-here", "cs2", None, None, Some(0), Some(20))
51        .await
52    {
53        Ok(history) => {
54            println!("Found {} matches", history.items.len());
55            if let Some(first_match) = history.items.first() {
56                println!("Most recent match: {}", first_match.match_id);
57            }
58        }
59        Err(e) => eprintln!("Error fetching history: {}", e),
60    }
61
62    // Example 5: Get match details
63    println!("\nFetching match details...");
64    match client.get_match("match-id-here").await {
65        Ok(match_details) => {
66            println!("Match ID: {}", match_details.match_id);
67            println!("Game: {}", match_details.game);
68            println!("Status: {}", match_details.status);
69        }
70        Err(e) => eprintln!("Error fetching match: {}", e),
71    }
72
73    // Example 6: Get match stats
74    println!("\nFetching match stats...");
75    match client.get_match_stats("match-id-here").await {
76        Ok(stats) => {
77            println!("Rounds: {}", stats.rounds.len());
78        }
79        Err(e) => eprintln!("Error fetching match stats: {}", e),
80    }
81
82    // Example 7: Search for players
83    println!("\nSearching for players...");
84    match client
85        .search_players("player_name", Some("cs2"), None, Some(0), Some(20))
86        .await
87    {
88        Ok(results) => {
89            println!("Found {} players", results.items.len());
90            for player in results.items.iter().take(5) {
91                println!("  - {} ({})", player.nickname, player.player_id);
92            }
93        }
94        Err(e) => eprintln!("Error searching players: {}", e),
95    }
96
97    // Example 8: Get all games
98    println!("\nFetching all games...");
99    match client.get_all_games(Some(0), Some(20)).await {
100        Ok(games) => {
101            println!("Found {} games", games.items.len());
102            for game in games.items.iter().take(5) {
103                println!("  - {} ({})", game.long_label, game.game_id);
104            }
105        }
106        Err(e) => eprintln!("Error fetching games: {}", e),
107    }
108
109    // Example 9: Get hub details
110    println!("\nFetching hub details...");
111    match client.get_hub("hub-id-here", None).await {
112        Ok(hub) => {
113            println!("Hub: {}", hub.name);
114            println!("Game: {}", hub.game_id);
115        }
116        Err(e) => eprintln!("Error fetching hub: {}", e),
117    }
118
119    // Example 10: Get global ranking
120    println!("\nFetching global ranking...");
121    match client
122        .get_global_ranking("cs2", "EU", None, Some(0), Some(20))
123        .await
124    {
125        Ok(ranking) => {
126            println!("Found {} players in ranking", ranking.items.len());
127            for entry in ranking.items.iter().take(5) {
128                println!(
129                    "  {}: {} - ELO: {}",
130                    entry.position, entry.nickname, entry.faceit_elo
131                );
132            }
133        }
134        Err(e) => eprintln!("Error fetching ranking: {}", e),
135    }
136
137    // Example 11: Using the builder pattern with authentication
138    println!("\nCreating client with builder...");
139    let _custom_client = HttpClient::builder()
140        .api_key("your-api-key-or-access-token-here")
141        .timeout(std::time::Duration::from_secs(60))
142        .build()?;
143
144    println!("Client created with custom configuration");
145
146    Ok(())
147}
Source

pub async fn get_player(&self, player_id: &str) -> Result<Player, Error>

Get player details by player ID

§Arguments
  • player_id - The FACEIT player ID (UUID format)
§Examples
let client = HttpClient::new();
let player = client.get_player("player-id-here").await?;
println!("Player: {}", player.nickname);
Examples found in repository?
examples/basic_usage.rs (line 15)
4async fn main() -> Result<(), faceit::error::Error> {
5    // Create a client (without authentication)
6    let client = HttpClient::new();
7
8    // Or create a client with API key or access token:
9    // let client = Client::builder()
10    //     .api_key("your-api-key-or-access-token")
11    //     .build()?;
12
13    // Example 1: Get player by ID
14    println!("Fetching player by ID...");
15    match client.get_player("player-id-here").await {
16        Ok(player) => {
17            println!("Player: {}", player.nickname);
18            if let Some(country) = player.country {
19                println!("Country: {}", country);
20            }
21        }
22        Err(e) => eprintln!("Error fetching player: {}", e),
23    }
24
25    // Example 2: Get player from lookup by nickname
26    println!("\nFetching player from lookup...");
27    match client
28        .get_player_from_lookup(Some("player_nickname"), Some("cs2"), None)
29        .await
30    {
31        Ok(player) => {
32            println!("Player: {}", player.nickname);
33        }
34        Err(e) => eprintln!("Error fetching player: {}", e),
35    }
36
37    // Example 3: Get player stats
38    println!("\nFetching player stats...");
39    match client.get_player_stats("player-id-here", "cs2").await {
40        Ok(stats) => {
41            println!("Player ID: {}", stats.player_id);
42            println!("Game ID: {}", stats.game_id);
43        }
44        Err(e) => eprintln!("Error fetching stats: {}", e),
45    }
46
47    // Example 4: Get player match history
48    println!("\nFetching player match history...");
49    match client
50        .get_player_history("player-id-here", "cs2", None, None, Some(0), Some(20))
51        .await
52    {
53        Ok(history) => {
54            println!("Found {} matches", history.items.len());
55            if let Some(first_match) = history.items.first() {
56                println!("Most recent match: {}", first_match.match_id);
57            }
58        }
59        Err(e) => eprintln!("Error fetching history: {}", e),
60    }
61
62    // Example 5: Get match details
63    println!("\nFetching match details...");
64    match client.get_match("match-id-here").await {
65        Ok(match_details) => {
66            println!("Match ID: {}", match_details.match_id);
67            println!("Game: {}", match_details.game);
68            println!("Status: {}", match_details.status);
69        }
70        Err(e) => eprintln!("Error fetching match: {}", e),
71    }
72
73    // Example 6: Get match stats
74    println!("\nFetching match stats...");
75    match client.get_match_stats("match-id-here").await {
76        Ok(stats) => {
77            println!("Rounds: {}", stats.rounds.len());
78        }
79        Err(e) => eprintln!("Error fetching match stats: {}", e),
80    }
81
82    // Example 7: Search for players
83    println!("\nSearching for players...");
84    match client
85        .search_players("player_name", Some("cs2"), None, Some(0), Some(20))
86        .await
87    {
88        Ok(results) => {
89            println!("Found {} players", results.items.len());
90            for player in results.items.iter().take(5) {
91                println!("  - {} ({})", player.nickname, player.player_id);
92            }
93        }
94        Err(e) => eprintln!("Error searching players: {}", e),
95    }
96
97    // Example 8: Get all games
98    println!("\nFetching all games...");
99    match client.get_all_games(Some(0), Some(20)).await {
100        Ok(games) => {
101            println!("Found {} games", games.items.len());
102            for game in games.items.iter().take(5) {
103                println!("  - {} ({})", game.long_label, game.game_id);
104            }
105        }
106        Err(e) => eprintln!("Error fetching games: {}", e),
107    }
108
109    // Example 9: Get hub details
110    println!("\nFetching hub details...");
111    match client.get_hub("hub-id-here", None).await {
112        Ok(hub) => {
113            println!("Hub: {}", hub.name);
114            println!("Game: {}", hub.game_id);
115        }
116        Err(e) => eprintln!("Error fetching hub: {}", e),
117    }
118
119    // Example 10: Get global ranking
120    println!("\nFetching global ranking...");
121    match client
122        .get_global_ranking("cs2", "EU", None, Some(0), Some(20))
123        .await
124    {
125        Ok(ranking) => {
126            println!("Found {} players in ranking", ranking.items.len());
127            for entry in ranking.items.iter().take(5) {
128                println!(
129                    "  {}: {} - ELO: {}",
130                    entry.position, entry.nickname, entry.faceit_elo
131                );
132            }
133        }
134        Err(e) => eprintln!("Error fetching ranking: {}", e),
135    }
136
137    // Example 11: Using the builder pattern with authentication
138    println!("\nCreating client with builder...");
139    let _custom_client = HttpClient::builder()
140        .api_key("your-api-key-or-access-token-here")
141        .timeout(std::time::Duration::from_secs(60))
142        .build()?;
143
144    println!("Client created with custom configuration");
145
146    Ok(())
147}
Source

pub async fn get_player_from_lookup( &self, nickname: Option<&str>, game: Option<&str>, game_player_id: Option<&str>, ) -> Result<Player, Error>

Get player details from lookup (by nickname, game, or game_player_id)

§Arguments
  • nickname - Optional player nickname
  • game - Optional game ID
  • game_player_id - Optional game-specific player ID
§Examples
let client = HttpClient::new();
let player = client.get_player_from_lookup(Some("player_nickname"), None, None).await?;
Examples found in repository?
examples/basic_usage.rs (line 28)
4async fn main() -> Result<(), faceit::error::Error> {
5    // Create a client (without authentication)
6    let client = HttpClient::new();
7
8    // Or create a client with API key or access token:
9    // let client = Client::builder()
10    //     .api_key("your-api-key-or-access-token")
11    //     .build()?;
12
13    // Example 1: Get player by ID
14    println!("Fetching player by ID...");
15    match client.get_player("player-id-here").await {
16        Ok(player) => {
17            println!("Player: {}", player.nickname);
18            if let Some(country) = player.country {
19                println!("Country: {}", country);
20            }
21        }
22        Err(e) => eprintln!("Error fetching player: {}", e),
23    }
24
25    // Example 2: Get player from lookup by nickname
26    println!("\nFetching player from lookup...");
27    match client
28        .get_player_from_lookup(Some("player_nickname"), Some("cs2"), None)
29        .await
30    {
31        Ok(player) => {
32            println!("Player: {}", player.nickname);
33        }
34        Err(e) => eprintln!("Error fetching player: {}", e),
35    }
36
37    // Example 3: Get player stats
38    println!("\nFetching player stats...");
39    match client.get_player_stats("player-id-here", "cs2").await {
40        Ok(stats) => {
41            println!("Player ID: {}", stats.player_id);
42            println!("Game ID: {}", stats.game_id);
43        }
44        Err(e) => eprintln!("Error fetching stats: {}", e),
45    }
46
47    // Example 4: Get player match history
48    println!("\nFetching player match history...");
49    match client
50        .get_player_history("player-id-here", "cs2", None, None, Some(0), Some(20))
51        .await
52    {
53        Ok(history) => {
54            println!("Found {} matches", history.items.len());
55            if let Some(first_match) = history.items.first() {
56                println!("Most recent match: {}", first_match.match_id);
57            }
58        }
59        Err(e) => eprintln!("Error fetching history: {}", e),
60    }
61
62    // Example 5: Get match details
63    println!("\nFetching match details...");
64    match client.get_match("match-id-here").await {
65        Ok(match_details) => {
66            println!("Match ID: {}", match_details.match_id);
67            println!("Game: {}", match_details.game);
68            println!("Status: {}", match_details.status);
69        }
70        Err(e) => eprintln!("Error fetching match: {}", e),
71    }
72
73    // Example 6: Get match stats
74    println!("\nFetching match stats...");
75    match client.get_match_stats("match-id-here").await {
76        Ok(stats) => {
77            println!("Rounds: {}", stats.rounds.len());
78        }
79        Err(e) => eprintln!("Error fetching match stats: {}", e),
80    }
81
82    // Example 7: Search for players
83    println!("\nSearching for players...");
84    match client
85        .search_players("player_name", Some("cs2"), None, Some(0), Some(20))
86        .await
87    {
88        Ok(results) => {
89            println!("Found {} players", results.items.len());
90            for player in results.items.iter().take(5) {
91                println!("  - {} ({})", player.nickname, player.player_id);
92            }
93        }
94        Err(e) => eprintln!("Error searching players: {}", e),
95    }
96
97    // Example 8: Get all games
98    println!("\nFetching all games...");
99    match client.get_all_games(Some(0), Some(20)).await {
100        Ok(games) => {
101            println!("Found {} games", games.items.len());
102            for game in games.items.iter().take(5) {
103                println!("  - {} ({})", game.long_label, game.game_id);
104            }
105        }
106        Err(e) => eprintln!("Error fetching games: {}", e),
107    }
108
109    // Example 9: Get hub details
110    println!("\nFetching hub details...");
111    match client.get_hub("hub-id-here", None).await {
112        Ok(hub) => {
113            println!("Hub: {}", hub.name);
114            println!("Game: {}", hub.game_id);
115        }
116        Err(e) => eprintln!("Error fetching hub: {}", e),
117    }
118
119    // Example 10: Get global ranking
120    println!("\nFetching global ranking...");
121    match client
122        .get_global_ranking("cs2", "EU", None, Some(0), Some(20))
123        .await
124    {
125        Ok(ranking) => {
126            println!("Found {} players in ranking", ranking.items.len());
127            for entry in ranking.items.iter().take(5) {
128                println!(
129                    "  {}: {} - ELO: {}",
130                    entry.position, entry.nickname, entry.faceit_elo
131                );
132            }
133        }
134        Err(e) => eprintln!("Error fetching ranking: {}", e),
135    }
136
137    // Example 11: Using the builder pattern with authentication
138    println!("\nCreating client with builder...");
139    let _custom_client = HttpClient::builder()
140        .api_key("your-api-key-or-access-token-here")
141        .timeout(std::time::Duration::from_secs(60))
142        .build()?;
143
144    println!("Client created with custom configuration");
145
146    Ok(())
147}
Source

pub async fn get_player_stats( &self, player_id: &str, game_id: &str, ) -> Result<PlayerStats, Error>

Get player statistics for a specific game

§Arguments
  • player_id - The FACEIT player ID
  • game_id - The game ID (e.g., “cs2”, “csgo”)
§Examples
let client = HttpClient::new();
let stats = client.get_player_stats("player-id", "cs2").await?;
Examples found in repository?
examples/basic_usage.rs (line 39)
4async fn main() -> Result<(), faceit::error::Error> {
5    // Create a client (without authentication)
6    let client = HttpClient::new();
7
8    // Or create a client with API key or access token:
9    // let client = Client::builder()
10    //     .api_key("your-api-key-or-access-token")
11    //     .build()?;
12
13    // Example 1: Get player by ID
14    println!("Fetching player by ID...");
15    match client.get_player("player-id-here").await {
16        Ok(player) => {
17            println!("Player: {}", player.nickname);
18            if let Some(country) = player.country {
19                println!("Country: {}", country);
20            }
21        }
22        Err(e) => eprintln!("Error fetching player: {}", e),
23    }
24
25    // Example 2: Get player from lookup by nickname
26    println!("\nFetching player from lookup...");
27    match client
28        .get_player_from_lookup(Some("player_nickname"), Some("cs2"), None)
29        .await
30    {
31        Ok(player) => {
32            println!("Player: {}", player.nickname);
33        }
34        Err(e) => eprintln!("Error fetching player: {}", e),
35    }
36
37    // Example 3: Get player stats
38    println!("\nFetching player stats...");
39    match client.get_player_stats("player-id-here", "cs2").await {
40        Ok(stats) => {
41            println!("Player ID: {}", stats.player_id);
42            println!("Game ID: {}", stats.game_id);
43        }
44        Err(e) => eprintln!("Error fetching stats: {}", e),
45    }
46
47    // Example 4: Get player match history
48    println!("\nFetching player match history...");
49    match client
50        .get_player_history("player-id-here", "cs2", None, None, Some(0), Some(20))
51        .await
52    {
53        Ok(history) => {
54            println!("Found {} matches", history.items.len());
55            if let Some(first_match) = history.items.first() {
56                println!("Most recent match: {}", first_match.match_id);
57            }
58        }
59        Err(e) => eprintln!("Error fetching history: {}", e),
60    }
61
62    // Example 5: Get match details
63    println!("\nFetching match details...");
64    match client.get_match("match-id-here").await {
65        Ok(match_details) => {
66            println!("Match ID: {}", match_details.match_id);
67            println!("Game: {}", match_details.game);
68            println!("Status: {}", match_details.status);
69        }
70        Err(e) => eprintln!("Error fetching match: {}", e),
71    }
72
73    // Example 6: Get match stats
74    println!("\nFetching match stats...");
75    match client.get_match_stats("match-id-here").await {
76        Ok(stats) => {
77            println!("Rounds: {}", stats.rounds.len());
78        }
79        Err(e) => eprintln!("Error fetching match stats: {}", e),
80    }
81
82    // Example 7: Search for players
83    println!("\nSearching for players...");
84    match client
85        .search_players("player_name", Some("cs2"), None, Some(0), Some(20))
86        .await
87    {
88        Ok(results) => {
89            println!("Found {} players", results.items.len());
90            for player in results.items.iter().take(5) {
91                println!("  - {} ({})", player.nickname, player.player_id);
92            }
93        }
94        Err(e) => eprintln!("Error searching players: {}", e),
95    }
96
97    // Example 8: Get all games
98    println!("\nFetching all games...");
99    match client.get_all_games(Some(0), Some(20)).await {
100        Ok(games) => {
101            println!("Found {} games", games.items.len());
102            for game in games.items.iter().take(5) {
103                println!("  - {} ({})", game.long_label, game.game_id);
104            }
105        }
106        Err(e) => eprintln!("Error fetching games: {}", e),
107    }
108
109    // Example 9: Get hub details
110    println!("\nFetching hub details...");
111    match client.get_hub("hub-id-here", None).await {
112        Ok(hub) => {
113            println!("Hub: {}", hub.name);
114            println!("Game: {}", hub.game_id);
115        }
116        Err(e) => eprintln!("Error fetching hub: {}", e),
117    }
118
119    // Example 10: Get global ranking
120    println!("\nFetching global ranking...");
121    match client
122        .get_global_ranking("cs2", "EU", None, Some(0), Some(20))
123        .await
124    {
125        Ok(ranking) => {
126            println!("Found {} players in ranking", ranking.items.len());
127            for entry in ranking.items.iter().take(5) {
128                println!(
129                    "  {}: {} - ELO: {}",
130                    entry.position, entry.nickname, entry.faceit_elo
131                );
132            }
133        }
134        Err(e) => eprintln!("Error fetching ranking: {}", e),
135    }
136
137    // Example 11: Using the builder pattern with authentication
138    println!("\nCreating client with builder...");
139    let _custom_client = HttpClient::builder()
140        .api_key("your-api-key-or-access-token-here")
141        .timeout(std::time::Duration::from_secs(60))
142        .build()?;
143
144    println!("Client created with custom configuration");
145
146    Ok(())
147}
Source

pub async fn get_player_history( &self, player_id: &str, game: &str, from: Option<i64>, to: Option<i64>, offset: Option<i64>, limit: Option<i64>, ) -> Result<MatchHistoryList, Error>

Get player match history

§Arguments
  • player_id - The FACEIT player ID
  • game - The game ID (required)
  • from - Optional start timestamp (Unix time)
  • to - Optional end timestamp (Unix time)
  • offset - Optional offset for pagination (default: 0)
  • limit - Optional limit for pagination (default: 20, max: 100)
§Examples
let client = HttpClient::new();
let history = client.get_player_history("player-id", "cs2", None, None, Some(0), Some(20)).await?;
Examples found in repository?
examples/basic_usage.rs (line 50)
4async fn main() -> Result<(), faceit::error::Error> {
5    // Create a client (without authentication)
6    let client = HttpClient::new();
7
8    // Or create a client with API key or access token:
9    // let client = Client::builder()
10    //     .api_key("your-api-key-or-access-token")
11    //     .build()?;
12
13    // Example 1: Get player by ID
14    println!("Fetching player by ID...");
15    match client.get_player("player-id-here").await {
16        Ok(player) => {
17            println!("Player: {}", player.nickname);
18            if let Some(country) = player.country {
19                println!("Country: {}", country);
20            }
21        }
22        Err(e) => eprintln!("Error fetching player: {}", e),
23    }
24
25    // Example 2: Get player from lookup by nickname
26    println!("\nFetching player from lookup...");
27    match client
28        .get_player_from_lookup(Some("player_nickname"), Some("cs2"), None)
29        .await
30    {
31        Ok(player) => {
32            println!("Player: {}", player.nickname);
33        }
34        Err(e) => eprintln!("Error fetching player: {}", e),
35    }
36
37    // Example 3: Get player stats
38    println!("\nFetching player stats...");
39    match client.get_player_stats("player-id-here", "cs2").await {
40        Ok(stats) => {
41            println!("Player ID: {}", stats.player_id);
42            println!("Game ID: {}", stats.game_id);
43        }
44        Err(e) => eprintln!("Error fetching stats: {}", e),
45    }
46
47    // Example 4: Get player match history
48    println!("\nFetching player match history...");
49    match client
50        .get_player_history("player-id-here", "cs2", None, None, Some(0), Some(20))
51        .await
52    {
53        Ok(history) => {
54            println!("Found {} matches", history.items.len());
55            if let Some(first_match) = history.items.first() {
56                println!("Most recent match: {}", first_match.match_id);
57            }
58        }
59        Err(e) => eprintln!("Error fetching history: {}", e),
60    }
61
62    // Example 5: Get match details
63    println!("\nFetching match details...");
64    match client.get_match("match-id-here").await {
65        Ok(match_details) => {
66            println!("Match ID: {}", match_details.match_id);
67            println!("Game: {}", match_details.game);
68            println!("Status: {}", match_details.status);
69        }
70        Err(e) => eprintln!("Error fetching match: {}", e),
71    }
72
73    // Example 6: Get match stats
74    println!("\nFetching match stats...");
75    match client.get_match_stats("match-id-here").await {
76        Ok(stats) => {
77            println!("Rounds: {}", stats.rounds.len());
78        }
79        Err(e) => eprintln!("Error fetching match stats: {}", e),
80    }
81
82    // Example 7: Search for players
83    println!("\nSearching for players...");
84    match client
85        .search_players("player_name", Some("cs2"), None, Some(0), Some(20))
86        .await
87    {
88        Ok(results) => {
89            println!("Found {} players", results.items.len());
90            for player in results.items.iter().take(5) {
91                println!("  - {} ({})", player.nickname, player.player_id);
92            }
93        }
94        Err(e) => eprintln!("Error searching players: {}", e),
95    }
96
97    // Example 8: Get all games
98    println!("\nFetching all games...");
99    match client.get_all_games(Some(0), Some(20)).await {
100        Ok(games) => {
101            println!("Found {} games", games.items.len());
102            for game in games.items.iter().take(5) {
103                println!("  - {} ({})", game.long_label, game.game_id);
104            }
105        }
106        Err(e) => eprintln!("Error fetching games: {}", e),
107    }
108
109    // Example 9: Get hub details
110    println!("\nFetching hub details...");
111    match client.get_hub("hub-id-here", None).await {
112        Ok(hub) => {
113            println!("Hub: {}", hub.name);
114            println!("Game: {}", hub.game_id);
115        }
116        Err(e) => eprintln!("Error fetching hub: {}", e),
117    }
118
119    // Example 10: Get global ranking
120    println!("\nFetching global ranking...");
121    match client
122        .get_global_ranking("cs2", "EU", None, Some(0), Some(20))
123        .await
124    {
125        Ok(ranking) => {
126            println!("Found {} players in ranking", ranking.items.len());
127            for entry in ranking.items.iter().take(5) {
128                println!(
129                    "  {}: {} - ELO: {}",
130                    entry.position, entry.nickname, entry.faceit_elo
131                );
132            }
133        }
134        Err(e) => eprintln!("Error fetching ranking: {}", e),
135    }
136
137    // Example 11: Using the builder pattern with authentication
138    println!("\nCreating client with builder...");
139    let _custom_client = HttpClient::builder()
140        .api_key("your-api-key-or-access-token-here")
141        .timeout(std::time::Duration::from_secs(60))
142        .build()?;
143
144    println!("Client created with custom configuration");
145
146    Ok(())
147}
Source

pub async fn get_player_bans( &self, player_id: &str, offset: Option<i64>, limit: Option<i64>, ) -> Result<PlayerBansList, Error>

Get player bans

§Arguments
  • player_id - The FACEIT player ID
  • offset - Optional offset for pagination (default: 0)
  • limit - Optional limit for pagination (default: 20, max: 100)
§Examples
let client = HttpClient::new();
let bans = client.get_player_bans("player-id", Some(0), Some(20)).await?;
Source

pub async fn get_player_hubs( &self, player_id: &str, offset: Option<i64>, limit: Option<i64>, ) -> Result<HubsList, Error>

Get player hubs

§Arguments
  • player_id - The FACEIT player ID
  • offset - Optional offset for pagination (default: 0, max: 1000)
  • limit - Optional limit for pagination (default: 50, max: 50)
§Examples
let client = HttpClient::new();
let hubs = client.get_player_hubs("player-id", Some(0), Some(50)).await?;
Source

pub async fn get_player_teams( &self, player_id: &str, offset: Option<i64>, limit: Option<i64>, ) -> Result<TeamList, Error>

Get player teams

§Arguments
  • player_id - The FACEIT player ID
  • offset - Optional offset for pagination (default: 0)
  • limit - Optional limit for pagination (default: 20, max: 100)
§Examples
let client = HttpClient::new();
let teams = client.get_player_teams("player-id", Some(0), Some(20)).await?;
Source

pub async fn get_player_tournaments( &self, player_id: &str, offset: Option<i64>, limit: Option<i64>, ) -> Result<TournamentsList, Error>

Get player tournaments

§Arguments
  • player_id - The FACEIT player ID
  • offset - Optional offset for pagination (default: 0)
  • limit - Optional limit for pagination (default: 20, max: 100)
§Examples
let client = HttpClient::new();
let tournaments = client.get_player_tournaments("player-id", Some(0), Some(20)).await?;
Source

pub async fn get_match(&self, match_id: &str) -> Result<Match, Error>

Get match details

§Arguments
  • match_id - The FACEIT match ID
§Examples
let client = HttpClient::new();
let match_details = client.get_match("match-id-here").await?;
Examples found in repository?
examples/basic_usage.rs (line 64)
4async fn main() -> Result<(), faceit::error::Error> {
5    // Create a client (without authentication)
6    let client = HttpClient::new();
7
8    // Or create a client with API key or access token:
9    // let client = Client::builder()
10    //     .api_key("your-api-key-or-access-token")
11    //     .build()?;
12
13    // Example 1: Get player by ID
14    println!("Fetching player by ID...");
15    match client.get_player("player-id-here").await {
16        Ok(player) => {
17            println!("Player: {}", player.nickname);
18            if let Some(country) = player.country {
19                println!("Country: {}", country);
20            }
21        }
22        Err(e) => eprintln!("Error fetching player: {}", e),
23    }
24
25    // Example 2: Get player from lookup by nickname
26    println!("\nFetching player from lookup...");
27    match client
28        .get_player_from_lookup(Some("player_nickname"), Some("cs2"), None)
29        .await
30    {
31        Ok(player) => {
32            println!("Player: {}", player.nickname);
33        }
34        Err(e) => eprintln!("Error fetching player: {}", e),
35    }
36
37    // Example 3: Get player stats
38    println!("\nFetching player stats...");
39    match client.get_player_stats("player-id-here", "cs2").await {
40        Ok(stats) => {
41            println!("Player ID: {}", stats.player_id);
42            println!("Game ID: {}", stats.game_id);
43        }
44        Err(e) => eprintln!("Error fetching stats: {}", e),
45    }
46
47    // Example 4: Get player match history
48    println!("\nFetching player match history...");
49    match client
50        .get_player_history("player-id-here", "cs2", None, None, Some(0), Some(20))
51        .await
52    {
53        Ok(history) => {
54            println!("Found {} matches", history.items.len());
55            if let Some(first_match) = history.items.first() {
56                println!("Most recent match: {}", first_match.match_id);
57            }
58        }
59        Err(e) => eprintln!("Error fetching history: {}", e),
60    }
61
62    // Example 5: Get match details
63    println!("\nFetching match details...");
64    match client.get_match("match-id-here").await {
65        Ok(match_details) => {
66            println!("Match ID: {}", match_details.match_id);
67            println!("Game: {}", match_details.game);
68            println!("Status: {}", match_details.status);
69        }
70        Err(e) => eprintln!("Error fetching match: {}", e),
71    }
72
73    // Example 6: Get match stats
74    println!("\nFetching match stats...");
75    match client.get_match_stats("match-id-here").await {
76        Ok(stats) => {
77            println!("Rounds: {}", stats.rounds.len());
78        }
79        Err(e) => eprintln!("Error fetching match stats: {}", e),
80    }
81
82    // Example 7: Search for players
83    println!("\nSearching for players...");
84    match client
85        .search_players("player_name", Some("cs2"), None, Some(0), Some(20))
86        .await
87    {
88        Ok(results) => {
89            println!("Found {} players", results.items.len());
90            for player in results.items.iter().take(5) {
91                println!("  - {} ({})", player.nickname, player.player_id);
92            }
93        }
94        Err(e) => eprintln!("Error searching players: {}", e),
95    }
96
97    // Example 8: Get all games
98    println!("\nFetching all games...");
99    match client.get_all_games(Some(0), Some(20)).await {
100        Ok(games) => {
101            println!("Found {} games", games.items.len());
102            for game in games.items.iter().take(5) {
103                println!("  - {} ({})", game.long_label, game.game_id);
104            }
105        }
106        Err(e) => eprintln!("Error fetching games: {}", e),
107    }
108
109    // Example 9: Get hub details
110    println!("\nFetching hub details...");
111    match client.get_hub("hub-id-here", None).await {
112        Ok(hub) => {
113            println!("Hub: {}", hub.name);
114            println!("Game: {}", hub.game_id);
115        }
116        Err(e) => eprintln!("Error fetching hub: {}", e),
117    }
118
119    // Example 10: Get global ranking
120    println!("\nFetching global ranking...");
121    match client
122        .get_global_ranking("cs2", "EU", None, Some(0), Some(20))
123        .await
124    {
125        Ok(ranking) => {
126            println!("Found {} players in ranking", ranking.items.len());
127            for entry in ranking.items.iter().take(5) {
128                println!(
129                    "  {}: {} - ELO: {}",
130                    entry.position, entry.nickname, entry.faceit_elo
131                );
132            }
133        }
134        Err(e) => eprintln!("Error fetching ranking: {}", e),
135    }
136
137    // Example 11: Using the builder pattern with authentication
138    println!("\nCreating client with builder...");
139    let _custom_client = HttpClient::builder()
140        .api_key("your-api-key-or-access-token-here")
141        .timeout(std::time::Duration::from_secs(60))
142        .build()?;
143
144    println!("Client created with custom configuration");
145
146    Ok(())
147}
Source

pub async fn get_match_stats(&self, match_id: &str) -> Result<MatchStats, Error>

Get match statistics

§Arguments
  • match_id - The FACEIT match ID
§Examples
let client = HttpClient::new();
let stats = client.get_match_stats("match-id-here").await?;
Examples found in repository?
examples/basic_usage.rs (line 75)
4async fn main() -> Result<(), faceit::error::Error> {
5    // Create a client (without authentication)
6    let client = HttpClient::new();
7
8    // Or create a client with API key or access token:
9    // let client = Client::builder()
10    //     .api_key("your-api-key-or-access-token")
11    //     .build()?;
12
13    // Example 1: Get player by ID
14    println!("Fetching player by ID...");
15    match client.get_player("player-id-here").await {
16        Ok(player) => {
17            println!("Player: {}", player.nickname);
18            if let Some(country) = player.country {
19                println!("Country: {}", country);
20            }
21        }
22        Err(e) => eprintln!("Error fetching player: {}", e),
23    }
24
25    // Example 2: Get player from lookup by nickname
26    println!("\nFetching player from lookup...");
27    match client
28        .get_player_from_lookup(Some("player_nickname"), Some("cs2"), None)
29        .await
30    {
31        Ok(player) => {
32            println!("Player: {}", player.nickname);
33        }
34        Err(e) => eprintln!("Error fetching player: {}", e),
35    }
36
37    // Example 3: Get player stats
38    println!("\nFetching player stats...");
39    match client.get_player_stats("player-id-here", "cs2").await {
40        Ok(stats) => {
41            println!("Player ID: {}", stats.player_id);
42            println!("Game ID: {}", stats.game_id);
43        }
44        Err(e) => eprintln!("Error fetching stats: {}", e),
45    }
46
47    // Example 4: Get player match history
48    println!("\nFetching player match history...");
49    match client
50        .get_player_history("player-id-here", "cs2", None, None, Some(0), Some(20))
51        .await
52    {
53        Ok(history) => {
54            println!("Found {} matches", history.items.len());
55            if let Some(first_match) = history.items.first() {
56                println!("Most recent match: {}", first_match.match_id);
57            }
58        }
59        Err(e) => eprintln!("Error fetching history: {}", e),
60    }
61
62    // Example 5: Get match details
63    println!("\nFetching match details...");
64    match client.get_match("match-id-here").await {
65        Ok(match_details) => {
66            println!("Match ID: {}", match_details.match_id);
67            println!("Game: {}", match_details.game);
68            println!("Status: {}", match_details.status);
69        }
70        Err(e) => eprintln!("Error fetching match: {}", e),
71    }
72
73    // Example 6: Get match stats
74    println!("\nFetching match stats...");
75    match client.get_match_stats("match-id-here").await {
76        Ok(stats) => {
77            println!("Rounds: {}", stats.rounds.len());
78        }
79        Err(e) => eprintln!("Error fetching match stats: {}", e),
80    }
81
82    // Example 7: Search for players
83    println!("\nSearching for players...");
84    match client
85        .search_players("player_name", Some("cs2"), None, Some(0), Some(20))
86        .await
87    {
88        Ok(results) => {
89            println!("Found {} players", results.items.len());
90            for player in results.items.iter().take(5) {
91                println!("  - {} ({})", player.nickname, player.player_id);
92            }
93        }
94        Err(e) => eprintln!("Error searching players: {}", e),
95    }
96
97    // Example 8: Get all games
98    println!("\nFetching all games...");
99    match client.get_all_games(Some(0), Some(20)).await {
100        Ok(games) => {
101            println!("Found {} games", games.items.len());
102            for game in games.items.iter().take(5) {
103                println!("  - {} ({})", game.long_label, game.game_id);
104            }
105        }
106        Err(e) => eprintln!("Error fetching games: {}", e),
107    }
108
109    // Example 9: Get hub details
110    println!("\nFetching hub details...");
111    match client.get_hub("hub-id-here", None).await {
112        Ok(hub) => {
113            println!("Hub: {}", hub.name);
114            println!("Game: {}", hub.game_id);
115        }
116        Err(e) => eprintln!("Error fetching hub: {}", e),
117    }
118
119    // Example 10: Get global ranking
120    println!("\nFetching global ranking...");
121    match client
122        .get_global_ranking("cs2", "EU", None, Some(0), Some(20))
123        .await
124    {
125        Ok(ranking) => {
126            println!("Found {} players in ranking", ranking.items.len());
127            for entry in ranking.items.iter().take(5) {
128                println!(
129                    "  {}: {} - ELO: {}",
130                    entry.position, entry.nickname, entry.faceit_elo
131                );
132            }
133        }
134        Err(e) => eprintln!("Error fetching ranking: {}", e),
135    }
136
137    // Example 11: Using the builder pattern with authentication
138    println!("\nCreating client with builder...");
139    let _custom_client = HttpClient::builder()
140        .api_key("your-api-key-or-access-token-here")
141        .timeout(std::time::Duration::from_secs(60))
142        .build()?;
143
144    println!("Client created with custom configuration");
145
146    Ok(())
147}
Source

pub async fn get_all_games( &self, offset: Option<i64>, limit: Option<i64>, ) -> Result<GamesList, Error>

Get all games

§Arguments
  • offset - Optional offset for pagination (default: 0)
  • limit - Optional limit for pagination (default: 20, max: 100)
§Examples
let client = HttpClient::new();
let games = client.get_all_games(Some(0), Some(20)).await?;
Examples found in repository?
examples/basic_usage.rs (line 99)
4async fn main() -> Result<(), faceit::error::Error> {
5    // Create a client (without authentication)
6    let client = HttpClient::new();
7
8    // Or create a client with API key or access token:
9    // let client = Client::builder()
10    //     .api_key("your-api-key-or-access-token")
11    //     .build()?;
12
13    // Example 1: Get player by ID
14    println!("Fetching player by ID...");
15    match client.get_player("player-id-here").await {
16        Ok(player) => {
17            println!("Player: {}", player.nickname);
18            if let Some(country) = player.country {
19                println!("Country: {}", country);
20            }
21        }
22        Err(e) => eprintln!("Error fetching player: {}", e),
23    }
24
25    // Example 2: Get player from lookup by nickname
26    println!("\nFetching player from lookup...");
27    match client
28        .get_player_from_lookup(Some("player_nickname"), Some("cs2"), None)
29        .await
30    {
31        Ok(player) => {
32            println!("Player: {}", player.nickname);
33        }
34        Err(e) => eprintln!("Error fetching player: {}", e),
35    }
36
37    // Example 3: Get player stats
38    println!("\nFetching player stats...");
39    match client.get_player_stats("player-id-here", "cs2").await {
40        Ok(stats) => {
41            println!("Player ID: {}", stats.player_id);
42            println!("Game ID: {}", stats.game_id);
43        }
44        Err(e) => eprintln!("Error fetching stats: {}", e),
45    }
46
47    // Example 4: Get player match history
48    println!("\nFetching player match history...");
49    match client
50        .get_player_history("player-id-here", "cs2", None, None, Some(0), Some(20))
51        .await
52    {
53        Ok(history) => {
54            println!("Found {} matches", history.items.len());
55            if let Some(first_match) = history.items.first() {
56                println!("Most recent match: {}", first_match.match_id);
57            }
58        }
59        Err(e) => eprintln!("Error fetching history: {}", e),
60    }
61
62    // Example 5: Get match details
63    println!("\nFetching match details...");
64    match client.get_match("match-id-here").await {
65        Ok(match_details) => {
66            println!("Match ID: {}", match_details.match_id);
67            println!("Game: {}", match_details.game);
68            println!("Status: {}", match_details.status);
69        }
70        Err(e) => eprintln!("Error fetching match: {}", e),
71    }
72
73    // Example 6: Get match stats
74    println!("\nFetching match stats...");
75    match client.get_match_stats("match-id-here").await {
76        Ok(stats) => {
77            println!("Rounds: {}", stats.rounds.len());
78        }
79        Err(e) => eprintln!("Error fetching match stats: {}", e),
80    }
81
82    // Example 7: Search for players
83    println!("\nSearching for players...");
84    match client
85        .search_players("player_name", Some("cs2"), None, Some(0), Some(20))
86        .await
87    {
88        Ok(results) => {
89            println!("Found {} players", results.items.len());
90            for player in results.items.iter().take(5) {
91                println!("  - {} ({})", player.nickname, player.player_id);
92            }
93        }
94        Err(e) => eprintln!("Error searching players: {}", e),
95    }
96
97    // Example 8: Get all games
98    println!("\nFetching all games...");
99    match client.get_all_games(Some(0), Some(20)).await {
100        Ok(games) => {
101            println!("Found {} games", games.items.len());
102            for game in games.items.iter().take(5) {
103                println!("  - {} ({})", game.long_label, game.game_id);
104            }
105        }
106        Err(e) => eprintln!("Error fetching games: {}", e),
107    }
108
109    // Example 9: Get hub details
110    println!("\nFetching hub details...");
111    match client.get_hub("hub-id-here", None).await {
112        Ok(hub) => {
113            println!("Hub: {}", hub.name);
114            println!("Game: {}", hub.game_id);
115        }
116        Err(e) => eprintln!("Error fetching hub: {}", e),
117    }
118
119    // Example 10: Get global ranking
120    println!("\nFetching global ranking...");
121    match client
122        .get_global_ranking("cs2", "EU", None, Some(0), Some(20))
123        .await
124    {
125        Ok(ranking) => {
126            println!("Found {} players in ranking", ranking.items.len());
127            for entry in ranking.items.iter().take(5) {
128                println!(
129                    "  {}: {} - ELO: {}",
130                    entry.position, entry.nickname, entry.faceit_elo
131                );
132            }
133        }
134        Err(e) => eprintln!("Error fetching ranking: {}", e),
135    }
136
137    // Example 11: Using the builder pattern with authentication
138    println!("\nCreating client with builder...");
139    let _custom_client = HttpClient::builder()
140        .api_key("your-api-key-or-access-token-here")
141        .timeout(std::time::Duration::from_secs(60))
142        .build()?;
143
144    println!("Client created with custom configuration");
145
146    Ok(())
147}
Source

pub async fn get_game(&self, game_id: &str) -> Result<Game, Error>

Get game details

§Arguments
  • game_id - The game ID (e.g., “cs2”, “csgo”)
§Examples
let client = HttpClient::new();
let game = client.get_game("cs2").await?;
Source

pub async fn get_parent_game(&self, game_id: &str) -> Result<Game, Error>

Get parent game details (for region-specific games)

§Arguments
  • game_id - The game ID
§Examples
let client = HttpClient::new();
let parent_game = client.get_parent_game("game-id").await?;
Source

pub async fn get_game_matchmakings( &self, game_id: &str, region: Option<&str>, offset: Option<i64>, limit: Option<i64>, ) -> Result<MatchmakingList, Error>

Get game matchmakings

§Arguments
  • game_id - The game ID
  • region - Optional region filter
  • offset - Optional offset for pagination (default: 0)
  • limit - Optional limit for pagination (default: 20, max: 100)
§Examples
let client = HttpClient::new();
let matchmakings = client.get_game_matchmakings("cs2", Some("EU"), Some(0), Some(20)).await?;
Source

pub async fn get_hub( &self, hub_id: &str, expanded: Option<&[&str]>, ) -> Result<Hub, Error>

Get hub details

§Arguments
  • hub_id - The hub ID
  • expanded - Optional list of entities to expand (e.g., [“organizer”, “game”])
§Examples
let client = HttpClient::new();
let hub = client.get_hub("hub-id", None).await?;
Examples found in repository?
examples/basic_usage.rs (line 111)
4async fn main() -> Result<(), faceit::error::Error> {
5    // Create a client (without authentication)
6    let client = HttpClient::new();
7
8    // Or create a client with API key or access token:
9    // let client = Client::builder()
10    //     .api_key("your-api-key-or-access-token")
11    //     .build()?;
12
13    // Example 1: Get player by ID
14    println!("Fetching player by ID...");
15    match client.get_player("player-id-here").await {
16        Ok(player) => {
17            println!("Player: {}", player.nickname);
18            if let Some(country) = player.country {
19                println!("Country: {}", country);
20            }
21        }
22        Err(e) => eprintln!("Error fetching player: {}", e),
23    }
24
25    // Example 2: Get player from lookup by nickname
26    println!("\nFetching player from lookup...");
27    match client
28        .get_player_from_lookup(Some("player_nickname"), Some("cs2"), None)
29        .await
30    {
31        Ok(player) => {
32            println!("Player: {}", player.nickname);
33        }
34        Err(e) => eprintln!("Error fetching player: {}", e),
35    }
36
37    // Example 3: Get player stats
38    println!("\nFetching player stats...");
39    match client.get_player_stats("player-id-here", "cs2").await {
40        Ok(stats) => {
41            println!("Player ID: {}", stats.player_id);
42            println!("Game ID: {}", stats.game_id);
43        }
44        Err(e) => eprintln!("Error fetching stats: {}", e),
45    }
46
47    // Example 4: Get player match history
48    println!("\nFetching player match history...");
49    match client
50        .get_player_history("player-id-here", "cs2", None, None, Some(0), Some(20))
51        .await
52    {
53        Ok(history) => {
54            println!("Found {} matches", history.items.len());
55            if let Some(first_match) = history.items.first() {
56                println!("Most recent match: {}", first_match.match_id);
57            }
58        }
59        Err(e) => eprintln!("Error fetching history: {}", e),
60    }
61
62    // Example 5: Get match details
63    println!("\nFetching match details...");
64    match client.get_match("match-id-here").await {
65        Ok(match_details) => {
66            println!("Match ID: {}", match_details.match_id);
67            println!("Game: {}", match_details.game);
68            println!("Status: {}", match_details.status);
69        }
70        Err(e) => eprintln!("Error fetching match: {}", e),
71    }
72
73    // Example 6: Get match stats
74    println!("\nFetching match stats...");
75    match client.get_match_stats("match-id-here").await {
76        Ok(stats) => {
77            println!("Rounds: {}", stats.rounds.len());
78        }
79        Err(e) => eprintln!("Error fetching match stats: {}", e),
80    }
81
82    // Example 7: Search for players
83    println!("\nSearching for players...");
84    match client
85        .search_players("player_name", Some("cs2"), None, Some(0), Some(20))
86        .await
87    {
88        Ok(results) => {
89            println!("Found {} players", results.items.len());
90            for player in results.items.iter().take(5) {
91                println!("  - {} ({})", player.nickname, player.player_id);
92            }
93        }
94        Err(e) => eprintln!("Error searching players: {}", e),
95    }
96
97    // Example 8: Get all games
98    println!("\nFetching all games...");
99    match client.get_all_games(Some(0), Some(20)).await {
100        Ok(games) => {
101            println!("Found {} games", games.items.len());
102            for game in games.items.iter().take(5) {
103                println!("  - {} ({})", game.long_label, game.game_id);
104            }
105        }
106        Err(e) => eprintln!("Error fetching games: {}", e),
107    }
108
109    // Example 9: Get hub details
110    println!("\nFetching hub details...");
111    match client.get_hub("hub-id-here", None).await {
112        Ok(hub) => {
113            println!("Hub: {}", hub.name);
114            println!("Game: {}", hub.game_id);
115        }
116        Err(e) => eprintln!("Error fetching hub: {}", e),
117    }
118
119    // Example 10: Get global ranking
120    println!("\nFetching global ranking...");
121    match client
122        .get_global_ranking("cs2", "EU", None, Some(0), Some(20))
123        .await
124    {
125        Ok(ranking) => {
126            println!("Found {} players in ranking", ranking.items.len());
127            for entry in ranking.items.iter().take(5) {
128                println!(
129                    "  {}: {} - ELO: {}",
130                    entry.position, entry.nickname, entry.faceit_elo
131                );
132            }
133        }
134        Err(e) => eprintln!("Error fetching ranking: {}", e),
135    }
136
137    // Example 11: Using the builder pattern with authentication
138    println!("\nCreating client with builder...");
139    let _custom_client = HttpClient::builder()
140        .api_key("your-api-key-or-access-token-here")
141        .timeout(std::time::Duration::from_secs(60))
142        .build()?;
143
144    println!("Client created with custom configuration");
145
146    Ok(())
147}
Source

pub async fn get_hub_matches( &self, hub_id: &str, match_type: Option<&str>, offset: Option<i64>, limit: Option<i64>, ) -> Result<MatchesList, Error>

Get hub matches

§Arguments
  • hub_id - The hub ID
  • match_type - Optional match type filter (“all”, “upcoming”, “ongoing”, “past”)
  • offset - Optional offset for pagination (default: 0)
  • limit - Optional limit for pagination (default: 20, max: 100)
§Examples
let client = HttpClient::new();
let matches = client.get_hub_matches("hub-id", Some("all"), Some(0), Some(20)).await?;
Source

pub async fn get_hub_members( &self, hub_id: &str, offset: Option<i64>, limit: Option<i64>, ) -> Result<HubMembers, Error>

Get hub members

§Arguments
  • hub_id - The hub ID
  • offset - Optional offset for pagination (default: 0, max: 1000)
  • limit - Optional limit for pagination (default: 50, max: 50)
§Examples
let client = HttpClient::new();
let members = client.get_hub_members("hub-id", Some(0), Some(50)).await?;
Source

pub async fn get_hub_stats( &self, hub_id: &str, offset: Option<i64>, limit: Option<i64>, ) -> Result<HubStats, Error>

Get hub statistics

§Arguments
  • hub_id - The hub ID
  • offset - Optional offset for pagination (default: 0)
  • limit - Optional limit for pagination (default: 20, max: 100)
§Examples
let client = HttpClient::new();
let stats = client.get_hub_stats("hub-id", Some(0), Some(20)).await?;
Source

pub async fn get_championships( &self, game: &str, championship_type: Option<&str>, offset: Option<i64>, limit: Option<i64>, ) -> Result<ChampionshipsList, Error>

Get championships for a game

§Arguments
  • game - The game ID (required)
  • championship_type - Optional type filter (“all”, “upcoming”, “ongoing”, “past”)
  • offset - Optional offset for pagination (default: 0)
  • limit - Optional limit for pagination (default: 10, max: 10)
§Examples
let client = HttpClient::new();
let championships = client.get_championships("cs2", Some("all"), Some(0), Some(10)).await?;
Source

pub async fn get_championship( &self, championship_id: &str, expanded: Option<&[&str]>, ) -> Result<Championship, Error>

Get championship details

§Arguments
  • championship_id - The championship ID
  • expanded - Optional list of entities to expand (e.g., [“organizer”, “game”])
§Examples
let client = HttpClient::new();
let championship = client.get_championship("championship-id", None).await?;
Source

pub async fn get_championship_matches( &self, championship_id: &str, match_type: Option<&str>, offset: Option<i64>, limit: Option<i64>, ) -> Result<MatchesList, Error>

Get championship matches

§Arguments
  • championship_id - The championship ID
  • match_type - Optional match type filter (“all”, “upcoming”, “ongoing”, “past”)
  • offset - Optional offset for pagination (default: 0)
  • limit - Optional limit for pagination (default: 20, max: 100)
§Examples
let client = HttpClient::new();
let matches = client.get_championship_matches("championship-id", Some("all"), Some(0), Some(20)).await?;
Source

pub async fn search_players( &self, nickname: &str, game: Option<&str>, country: Option<&str>, offset: Option<i64>, limit: Option<i64>, ) -> Result<UsersSearchList, Error>

Search for players

§Arguments
  • nickname - Player nickname to search for (required)
  • game - Optional game ID filter
  • country - Optional country code filter (ISO 3166-1)
  • offset - Optional offset for pagination (default: 0)
  • limit - Optional limit for pagination (default: 20, max: 100)
§Examples
let client = HttpClient::new();
let results = client.search_players("player_name", Some("cs2"), None, Some(0), Some(20)).await?;
Examples found in repository?
examples/basic_usage.rs (line 85)
4async fn main() -> Result<(), faceit::error::Error> {
5    // Create a client (without authentication)
6    let client = HttpClient::new();
7
8    // Or create a client with API key or access token:
9    // let client = Client::builder()
10    //     .api_key("your-api-key-or-access-token")
11    //     .build()?;
12
13    // Example 1: Get player by ID
14    println!("Fetching player by ID...");
15    match client.get_player("player-id-here").await {
16        Ok(player) => {
17            println!("Player: {}", player.nickname);
18            if let Some(country) = player.country {
19                println!("Country: {}", country);
20            }
21        }
22        Err(e) => eprintln!("Error fetching player: {}", e),
23    }
24
25    // Example 2: Get player from lookup by nickname
26    println!("\nFetching player from lookup...");
27    match client
28        .get_player_from_lookup(Some("player_nickname"), Some("cs2"), None)
29        .await
30    {
31        Ok(player) => {
32            println!("Player: {}", player.nickname);
33        }
34        Err(e) => eprintln!("Error fetching player: {}", e),
35    }
36
37    // Example 3: Get player stats
38    println!("\nFetching player stats...");
39    match client.get_player_stats("player-id-here", "cs2").await {
40        Ok(stats) => {
41            println!("Player ID: {}", stats.player_id);
42            println!("Game ID: {}", stats.game_id);
43        }
44        Err(e) => eprintln!("Error fetching stats: {}", e),
45    }
46
47    // Example 4: Get player match history
48    println!("\nFetching player match history...");
49    match client
50        .get_player_history("player-id-here", "cs2", None, None, Some(0), Some(20))
51        .await
52    {
53        Ok(history) => {
54            println!("Found {} matches", history.items.len());
55            if let Some(first_match) = history.items.first() {
56                println!("Most recent match: {}", first_match.match_id);
57            }
58        }
59        Err(e) => eprintln!("Error fetching history: {}", e),
60    }
61
62    // Example 5: Get match details
63    println!("\nFetching match details...");
64    match client.get_match("match-id-here").await {
65        Ok(match_details) => {
66            println!("Match ID: {}", match_details.match_id);
67            println!("Game: {}", match_details.game);
68            println!("Status: {}", match_details.status);
69        }
70        Err(e) => eprintln!("Error fetching match: {}", e),
71    }
72
73    // Example 6: Get match stats
74    println!("\nFetching match stats...");
75    match client.get_match_stats("match-id-here").await {
76        Ok(stats) => {
77            println!("Rounds: {}", stats.rounds.len());
78        }
79        Err(e) => eprintln!("Error fetching match stats: {}", e),
80    }
81
82    // Example 7: Search for players
83    println!("\nSearching for players...");
84    match client
85        .search_players("player_name", Some("cs2"), None, Some(0), Some(20))
86        .await
87    {
88        Ok(results) => {
89            println!("Found {} players", results.items.len());
90            for player in results.items.iter().take(5) {
91                println!("  - {} ({})", player.nickname, player.player_id);
92            }
93        }
94        Err(e) => eprintln!("Error searching players: {}", e),
95    }
96
97    // Example 8: Get all games
98    println!("\nFetching all games...");
99    match client.get_all_games(Some(0), Some(20)).await {
100        Ok(games) => {
101            println!("Found {} games", games.items.len());
102            for game in games.items.iter().take(5) {
103                println!("  - {} ({})", game.long_label, game.game_id);
104            }
105        }
106        Err(e) => eprintln!("Error fetching games: {}", e),
107    }
108
109    // Example 9: Get hub details
110    println!("\nFetching hub details...");
111    match client.get_hub("hub-id-here", None).await {
112        Ok(hub) => {
113            println!("Hub: {}", hub.name);
114            println!("Game: {}", hub.game_id);
115        }
116        Err(e) => eprintln!("Error fetching hub: {}", e),
117    }
118
119    // Example 10: Get global ranking
120    println!("\nFetching global ranking...");
121    match client
122        .get_global_ranking("cs2", "EU", None, Some(0), Some(20))
123        .await
124    {
125        Ok(ranking) => {
126            println!("Found {} players in ranking", ranking.items.len());
127            for entry in ranking.items.iter().take(5) {
128                println!(
129                    "  {}: {} - ELO: {}",
130                    entry.position, entry.nickname, entry.faceit_elo
131                );
132            }
133        }
134        Err(e) => eprintln!("Error fetching ranking: {}", e),
135    }
136
137    // Example 11: Using the builder pattern with authentication
138    println!("\nCreating client with builder...");
139    let _custom_client = HttpClient::builder()
140        .api_key("your-api-key-or-access-token-here")
141        .timeout(std::time::Duration::from_secs(60))
142        .build()?;
143
144    println!("Client created with custom configuration");
145
146    Ok(())
147}
Source

pub async fn search_teams( &self, nickname: &str, game: Option<&str>, offset: Option<i64>, limit: Option<i64>, ) -> Result<TeamsSearchList, Error>

Search for teams

§Arguments
  • nickname - Team nickname to search for (required)
  • game - Optional game ID filter
  • offset - Optional offset for pagination (default: 0)
  • limit - Optional limit for pagination (default: 20, max: 100)
§Examples
let client = HttpClient::new();
let results = client.search_teams("team_name", Some("cs2"), Some(0), Some(20)).await?;
Source

pub async fn search_hubs( &self, name: &str, game: Option<&str>, region: Option<&str>, offset: Option<i64>, limit: Option<i64>, ) -> Result<CompetitionsSearchList, Error>

Search for hubs

§Arguments
  • name - Hub name to search for (required)
  • game - Optional game ID filter
  • region - Optional region filter
  • offset - Optional offset for pagination (default: 0)
  • limit - Optional limit for pagination (default: 20, max: 100)
§Examples
let client = HttpClient::new();
let results = client.search_hubs("hub_name", Some("cs2"), Some("EU"), Some(0), Some(20)).await?;
Source

pub async fn get_global_ranking( &self, game_id: &str, region: &str, country: Option<&str>, offset: Option<i64>, limit: Option<i64>, ) -> Result<GlobalRankingList, Error>

Get global ranking for a game and region

§Arguments
  • game_id - The game ID
  • region - The region (required)
  • country - Optional country code filter (ISO 3166-1)
  • offset - Optional offset for pagination (default: 0)
  • limit - Optional limit for pagination (default: 20, max: 100)
§Examples
let client = HttpClient::new();
let ranking = client.get_global_ranking("cs2", "EU", None, Some(0), Some(20)).await?;
Examples found in repository?
examples/basic_usage.rs (line 122)
4async fn main() -> Result<(), faceit::error::Error> {
5    // Create a client (without authentication)
6    let client = HttpClient::new();
7
8    // Or create a client with API key or access token:
9    // let client = Client::builder()
10    //     .api_key("your-api-key-or-access-token")
11    //     .build()?;
12
13    // Example 1: Get player by ID
14    println!("Fetching player by ID...");
15    match client.get_player("player-id-here").await {
16        Ok(player) => {
17            println!("Player: {}", player.nickname);
18            if let Some(country) = player.country {
19                println!("Country: {}", country);
20            }
21        }
22        Err(e) => eprintln!("Error fetching player: {}", e),
23    }
24
25    // Example 2: Get player from lookup by nickname
26    println!("\nFetching player from lookup...");
27    match client
28        .get_player_from_lookup(Some("player_nickname"), Some("cs2"), None)
29        .await
30    {
31        Ok(player) => {
32            println!("Player: {}", player.nickname);
33        }
34        Err(e) => eprintln!("Error fetching player: {}", e),
35    }
36
37    // Example 3: Get player stats
38    println!("\nFetching player stats...");
39    match client.get_player_stats("player-id-here", "cs2").await {
40        Ok(stats) => {
41            println!("Player ID: {}", stats.player_id);
42            println!("Game ID: {}", stats.game_id);
43        }
44        Err(e) => eprintln!("Error fetching stats: {}", e),
45    }
46
47    // Example 4: Get player match history
48    println!("\nFetching player match history...");
49    match client
50        .get_player_history("player-id-here", "cs2", None, None, Some(0), Some(20))
51        .await
52    {
53        Ok(history) => {
54            println!("Found {} matches", history.items.len());
55            if let Some(first_match) = history.items.first() {
56                println!("Most recent match: {}", first_match.match_id);
57            }
58        }
59        Err(e) => eprintln!("Error fetching history: {}", e),
60    }
61
62    // Example 5: Get match details
63    println!("\nFetching match details...");
64    match client.get_match("match-id-here").await {
65        Ok(match_details) => {
66            println!("Match ID: {}", match_details.match_id);
67            println!("Game: {}", match_details.game);
68            println!("Status: {}", match_details.status);
69        }
70        Err(e) => eprintln!("Error fetching match: {}", e),
71    }
72
73    // Example 6: Get match stats
74    println!("\nFetching match stats...");
75    match client.get_match_stats("match-id-here").await {
76        Ok(stats) => {
77            println!("Rounds: {}", stats.rounds.len());
78        }
79        Err(e) => eprintln!("Error fetching match stats: {}", e),
80    }
81
82    // Example 7: Search for players
83    println!("\nSearching for players...");
84    match client
85        .search_players("player_name", Some("cs2"), None, Some(0), Some(20))
86        .await
87    {
88        Ok(results) => {
89            println!("Found {} players", results.items.len());
90            for player in results.items.iter().take(5) {
91                println!("  - {} ({})", player.nickname, player.player_id);
92            }
93        }
94        Err(e) => eprintln!("Error searching players: {}", e),
95    }
96
97    // Example 8: Get all games
98    println!("\nFetching all games...");
99    match client.get_all_games(Some(0), Some(20)).await {
100        Ok(games) => {
101            println!("Found {} games", games.items.len());
102            for game in games.items.iter().take(5) {
103                println!("  - {} ({})", game.long_label, game.game_id);
104            }
105        }
106        Err(e) => eprintln!("Error fetching games: {}", e),
107    }
108
109    // Example 9: Get hub details
110    println!("\nFetching hub details...");
111    match client.get_hub("hub-id-here", None).await {
112        Ok(hub) => {
113            println!("Hub: {}", hub.name);
114            println!("Game: {}", hub.game_id);
115        }
116        Err(e) => eprintln!("Error fetching hub: {}", e),
117    }
118
119    // Example 10: Get global ranking
120    println!("\nFetching global ranking...");
121    match client
122        .get_global_ranking("cs2", "EU", None, Some(0), Some(20))
123        .await
124    {
125        Ok(ranking) => {
126            println!("Found {} players in ranking", ranking.items.len());
127            for entry in ranking.items.iter().take(5) {
128                println!(
129                    "  {}: {} - ELO: {}",
130                    entry.position, entry.nickname, entry.faceit_elo
131                );
132            }
133        }
134        Err(e) => eprintln!("Error fetching ranking: {}", e),
135    }
136
137    // Example 11: Using the builder pattern with authentication
138    println!("\nCreating client with builder...");
139    let _custom_client = HttpClient::builder()
140        .api_key("your-api-key-or-access-token-here")
141        .timeout(std::time::Duration::from_secs(60))
142        .build()?;
143
144    println!("Client created with custom configuration");
145
146    Ok(())
147}
Source

pub async fn get_player_ranking( &self, game_id: &str, region: &str, player_id: &str, country: Option<&str>, limit: Option<i64>, ) -> Result<PlayerGlobalRanking, Error>

Get player ranking in global ranking

§Arguments
  • game_id - The game ID
  • region - The region (required)
  • player_id - The player ID (required)
  • country - Optional country code filter (ISO 3166-1)
  • limit - Optional limit for pagination (default: 20, max: 100)
§Examples
let client = HttpClient::new();
let ranking = client.get_player_ranking("cs2", "EU", "player-id", None, Some(20)).await?;

Trait Implementations§

Source§

impl Default for Client

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Client

§

impl !RefUnwindSafe for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl !UnwindSafe for Client

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more