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 SteamApp
s 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
Auto Trait Implementations
impl RefUnwindSafe for SteamDir
impl Send for SteamDir
impl Sync for SteamDir
impl Unpin for SteamDir
impl UnwindSafe for SteamDir
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,