Struct steamlocate::SteamDir[][src]

pub struct SteamDir {
    pub path: PathBuf,
    // some fields omitted
}

An instance of a Steam installation.

All functions of this struct will cache their results.

If you’d like to dispose of the cache or get uncached results, just instantiate a new SteamDir.

Example

let steamdir = SteamDir::locate();
println!("{:#?}", steamdir.unwrap());
SteamDir (
	path: "C:\\Program Files (x86)\\Steam"
)

Fields

path: PathBuf

The path to the Steam installation directory on this computer.

Example: C:\Program Files (x86)\Steam

Implementations

impl SteamDir[src]

pub fn libraryfolders(&mut self) -> &LibraryFolders[src]

Returns a reference to a LibraryFolders instance.

You can then index LibraryFolders.paths to get a reference to a Vec<PathBuf> of every library folder installed on the file system.

This function will cache its result.

pub fn apps(&mut self) -> &HashMap<u32, Option<SteamApp>>[src]

Returns a reference to HashMap<u32, Option<SteamApp>> of all SteamApps located on this computer.

All Option<SteamApp>s in this context will be Some, so you can safely unwrap() them without panicking.

This function will cache its results and will always return a reference to the same HashMap.

Example

let mut steamdir = SteamDir::locate().unwrap();
let apps: &HashMap<u32, Option<SteamApp>> = steamdir.apps();
println!("{:#?}", apps);
{
	4000: SteamApp (
		appid: u32: 4000,
		path: PathBuf: "C:\\Program Files (x86)\\steamapps\\common\\GarrysMod",
		vdf: <steamy_vdf::Table>,
		name: Some(String: "Garry's Mod"),
		last_user: Some(u64: 76561198040894045) // This will be a steamid_ng::SteamID if the "steamid_ng" feature is enabled
	)
	...
}

pub fn app(&mut self, app_id: &u32) -> Option<&SteamApp>[src]

Returns a Some reference to a SteamApp via its app ID.

If the Steam app is not installed on the system, this will return None.

This function will cache its (either Some and None) result and will always return a reference to the same SteamApp.

Example

let mut steamdir = SteamDir::locate().unwrap();
let gmod = steamdir.app(&4000);
println!("{:#?}", gmod.unwrap());
SteamApp (
	appid: u32: 4000,
	path: PathBuf: "C:\\Program Files (x86)\\steamapps\\common\\GarrysMod",
	vdf: <steamy_vdf::Table>,
	name: Some(String: "Garry's Mod"),
	last_user: Some(u64: 76561198040894045) // This will be a steamid_ng::SteamID if the "steamid_ng" feature is enabled
)

pub fn locate() -> Option<SteamDir>[src]

Locates the Steam installation directory on the filesystem and initializes a SteamDir (Linux)

Returns None if no Steam installation can be located.

Trait Implementations

impl Clone for SteamDir[src]

impl Debug for SteamDir[src]

impl Default for SteamDir[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.