Skip to main content

CoreDistributionInformation

Trait CoreDistributionInformation 

Source
pub trait CoreDistributionInformation {
    // 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§

Source

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.

Source

fn name(&self) -> OsString

Retrieves the name of the distribution.

§Returns

An OsString containing the display name of the distribution.

Source

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.
Source

fn flavor(&self) -> Result<Option<OsString>>

Retrieves the type of distribution (ubuntu, debian, …), if available.

§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.

Source

fn version(&self) -> Result<Option<OsString>>

Retrieves the version of the distribution, if available

§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.

Implementors§