pub trait CoreWSLDistributionInformation {
// Required methods
fn id(&self) -> UserDistributionID;
fn name(&self) -> OsString;
fn package_family_name(&self) -> Option<OsString>;
fn flavor(&self) -> Result<Option<OsString>>;
fn version(&self) -> Result<Option<OsString>>;
}Expand description
A trait representing the core information of a WSL distribution.
This trait abstracts the common properties of a WSL distribution, such as its unique ID, display name, and package family name (if applicable).
Required Methods§
Sourcefn id(&self) -> UserDistributionID
fn id(&self) -> UserDistributionID
Retrieves the unique ID of the distribution.
The ID is guaranteed to remain the same across reboots.
§Returns
The UserDistributionID representing the distribution’s unique identifier.
Sourcefn package_family_name(&self) -> Option<OsString>
fn package_family_name(&self) -> Option<OsString>
Retrieves the package family name of the distribution, if available.
The package family name is applicable if the distribution is packaged.
§Returns
Some(package_family_name): If the distribution has a package family name.None: If the distribution is not packaged or the information is unavailable.
Sourcefn flavor(&self) -> Result<Option<OsString>>
fn flavor(&self) -> Result<Option<OsString>>
Retrieves the type of distribution (ubuntu, debian, …), if available.
This requires WSLVersionCapability::DistributionFlavor (2.4.4).
§Returns
Ok(Some(flavor): If the distribution has a flavor.Ok(None): If the distribution does not have a falvour.Err(e): if the API version is too low to retrieve this information.
§Errors
Returns an error if the API version is too low to retrieve this information.
Sourcefn version(&self) -> Result<Option<OsString>>
fn version(&self) -> Result<Option<OsString>>
Retrieves the version of the distribution, if available
This requires WSLVersionCapability::DistributionVersion (2.4.4).
§Returns
Ok(Some(version): If the distribution version is available.Ok(None): If the distribution does not have a specified version.Err(e): if the API version is too low to retrieve this information.
§Errors
Returns an error if the API version is too low to retrieve this information.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".