pub struct Client { /* private fields */ }Expand description
The main entry point into the steam client.
This provides access to all of the steamworks api that clients can use.
Implementations§
Source§impl Client
impl Client
Sourcepub fn init() -> SIResult<Client>
pub fn init() -> SIResult<Client>
Attempts to initialize the steamworks api without full API integration through SteamAPI_InitFlat added in SDK 1.59 and returns a client to access the rest of the api.
This should only ever have one instance per a program.
§Errors
This can fail if:
-
The steam client isn’t running
-
The app ID of the game couldn’t be determined.
If the game isn’t being run through steam this can be provided by placing a
steam_appid.txtwith the ID inside in the current working directory. Alternatively, you can useClient::init_app(<app_id>)to force a specific app ID. -
The game isn’t running on the same user/level as the steam client
-
The user doesn’t own a license for the game.
-
The app ID isn’t completely set up.
Sourcepub fn init_app<ID: Into<AppId>>(app_id: ID) -> SIResult<Client>
pub fn init_app<ID: Into<AppId>>(app_id: ID) -> SIResult<Client>
Attempts to initialize the steamworks api with the APP_ID without full API integration through SteamAPI_InitFlat and returns a client to access the rest of the api.
This should only ever have one instance per a program.
§Errors
This can fail if:
- The steam client isn’t running
- The game isn’t running on the same user/level as the steam client
- The user doesn’t own a license for the game.
- The app ID isn’t completely set up.
Source§impl Client
impl Client
Sourcepub fn run_callbacks(&self)
pub fn run_callbacks(&self)
Runs any currently pending callbacks
This runs all currently pending callbacks on the current thread.
This should be called frequently (e.g. once per a frame) in order to reduce the latency between recieving events.
Sourcepub fn process_callbacks(&self, callback_handler: impl FnMut(CallbackResult))
pub fn process_callbacks(&self, callback_handler: impl FnMut(CallbackResult))
Runs any currently pending callbacks.
This is identical to run_callbacks in every way, except that
callback_handler is called for every callback invoked.
This option provides an alternative for handling callbacks that
can doesn’t require the handler to be Send, and 'static.
This should be called frequently (e.g. once per a frame) in order to reduce the latency between recieving events.
Sourcepub fn register_callback<C, F>(&self, f: F) -> CallbackHandle
pub fn register_callback<C, F>(&self, f: F) -> CallbackHandle
Registers the passed function as a callback for the given type.
The callback will be run on the thread that run_callbacks
is called when the event arrives.
If the callback handler cannot be made Send or 'static
the call to run_callbacks should be replaced with a call to
process_callbacks instead.
Sourcepub fn matchmaking(&self) -> Matchmaking
pub fn matchmaking(&self) -> Matchmaking
Returns an accessor to the steam matchmaking interface
Sourcepub fn matchmaking_servers(&self) -> MatchmakingServers
pub fn matchmaking_servers(&self) -> MatchmakingServers
Returns an accessor to the steam matchmaking_servers interface
Sourcepub fn networking(&self) -> Networking
pub fn networking(&self) -> Networking
Returns an accessor to the steam networking interface
Sourcepub fn user_stats(&self) -> UserStats
pub fn user_stats(&self) -> UserStats
Returns an accessor to the steam user stats interface
Sourcepub fn remote_play(&self) -> RemotePlay
pub fn remote_play(&self) -> RemotePlay
Returns an accessor to the steam remote play interface
Sourcepub fn remote_storage(&self) -> RemoteStorage
pub fn remote_storage(&self) -> RemoteStorage
Returns an accessor to the steam remote storage interface
Sourcepub fn screenshots(&self) -> Screenshots
pub fn screenshots(&self) -> Screenshots
Returns an accessor to the steam screenshots interface