pub struct Platform {
pub os: Os,
pub distro: Distro,
pub version: String,
pub arch: Arch,
}Expand description
Detected platform: OS, distro, version, and architecture.
Fields§
§os: Os§distro: Distro§version: String§arch: ArchImplementations§
Source§impl Platform
impl Platform
Sourcepub fn detect() -> Self
pub fn detect() -> Self
Detect the current platform.
- macOS: uses
cfg!(target_os)andsw_versfor version. - Linux: parses
/etc/os-release. - FreeBSD: uses
cfg!(target_os)andfreebsd-version.
Sourcepub fn matches_any(&self, tags: &[String]) -> bool
pub fn matches_any(&self, tags: &[String]) -> bool
Check whether this platform matches any tag in the given filter list.
Tags are matched against OS, distro, and arch names.
Returns true if any tag matches, or if the filter list is empty.
Sourcepub fn native_manager(&self) -> &str
pub fn native_manager(&self) -> &str
Return the canonical native package manager name for this platform.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Platform
impl RefUnwindSafe for Platform
impl Send for Platform
impl Sync for Platform
impl Unpin for Platform
impl UnsafeUnpin for Platform
impl UnwindSafe for Platform
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more