pub struct VersionHistory { /* private fields */ }
Expand description

VersionHistory stores the history of Fuchsia API levels, and lets callers query the support status of API levels and ABI revisions.

Implementations§

source§

impl VersionHistory

source

pub const fn new(versions: &'static [Version]) -> Self

Outside of tests, callers should use the static [HISTORY] instance. However, for testing purposes, you may want to build your own hermetic “alternate history” that doesn’t change over time.

If you’re not testing versioning in particular, and you just want an API level/ABI revision that works, see [get_example_supported_version_for_tests].

source

pub fn get_abi_revision_for_platform_components(&self) -> AbiRevision

The ABI revision for components and packages that are “part of the platform” and never “move between releases”. For example:

  • Packages produced by the platform build have this ABI revision.
  • Components which are not packaged but are “part of the platform” nonetheless (e.g. components loaded from bootfs) have this ABI revision.
  • Most packages produced by assembly tools have this ABI revision.
    • The update package is a noteworthy exception, since it “moves between releases”, in that it is produced by assembly tools from one Fuchsia release, and then later read by the OS from a previous release (that is, the one performing the update).
source

pub fn get_misleading_version_for_ffx(&self) -> Version

ffx currently presents information suggesting that the platform supports a single API level and ABI revision. This is misleading and should be fixed. Until we do, we have to choose a particular Version for ffx to present.

TODO: https://fxbug.dev/326096999 - Remove this, or turn it into something that makes more sense.

source

pub fn get_example_supported_version_for_tests(&self) -> Version

API level to be used in tests that create components on the fly and need to specify a supported API level or ABI revision, but don’t particularly care which. The returned Version will be consistent within a given build, but may change from build to build.

source

pub fn check_api_level_for_build( &self, api_level: ApiLevel ) -> Result<AbiRevision, ApiLevelError>

Check whether the platform supports building components that target the given API level, and if so, returns the ABI revision associated with that API level.

TODO: https://fxbug.dev/326096347 - This doesn’t actually check that the API level is supported, merely that it exists. At time of writing, this is the behavior implemented by ffx package, so I’m keeping it consistent in the interest of no-op refactoring.

source

pub fn check_abi_revision_for_runtime( &self, abi_revision: AbiRevision ) -> Result<(), AbiRevisionError>

Check whether the operating system supports running components that target the given ABI revision.

source

pub fn version_from_api_level(&self, api_level: ApiLevel) -> Option<Version>

Trait Implementations§

source§

impl Debug for VersionHistory

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Hash for VersionHistory

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Ord for VersionHistory

source§

fn cmp(&self, other: &VersionHistory) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for VersionHistory

source§

fn eq(&self, other: &VersionHistory) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for VersionHistory

source§

fn partial_cmp(&self, other: &VersionHistory) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Eq for VersionHistory

source§

impl StructuralPartialEq for VersionHistory

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.