Skip to main content

Cle

Struct Cle 

Source
#[non_exhaustive]
pub struct Cle { pub events: Vec<CleEvent>, pub definitions: Option<CleDefinitions>, }
Expand description

TEA projection of CLE events. This is not a full ECMA-428 document.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§events: Vec<CleEvent>

Events.

§definitions: Option<CleDefinitions>

Definitions.

Implementations§

Source§

impl Cle

Source

pub fn status_for_semver(&self, version: &Version) -> LifecycleStatus

The lifecycle status of version, comparing versions as SemVer 2.0.

Experimental: may change in a 0.x minor release.

use libtea_core::Cle;

let cle: Cle = serde_json::from_str(r#"{"events": [
  {"id": 3, "type": "endOfLife", "effective": "2026-01-01T00:00:00Z",
   "published": "2025-01-01T00:00:00Z", "versions": [{"range": "vers:semver/<2.0.0"}]},
  {"id": 2, "type": "endOfSupport", "effective": "2025-06-01T00:00:00Z",
   "published": "2025-01-01T00:00:00Z", "versions": [{"range": "vers:pypi/<2.0"}]},
  {"id": 1, "type": "released", "effective": "2024-01-01T00:00:00Z",
   "published": "2024-01-01T00:00:00Z", "version": "1.4.0"}
]}"#).unwrap();
let status = cle.status_for_semver(&semver::Version::new(1, 4, 0));
assert_eq!(status.end_of_life.unwrap().as_str(), "2026-01-01T00:00:00Z");
assert_eq!(status.released.unwrap().as_str(), "2024-01-01T00:00:00Z");
// Not "no end of support": the range could not be evaluated as SemVer.
assert!(status.end_of_support.is_none());
assert_eq!(status.unevaluated.len(), 1);
Source

pub fn status_for_pypi(&self, version: &Pep440Version) -> LifecycleStatus

The lifecycle status of version, comparing versions with PEP 440 ordering: { version } specifiers by PEP 440 equality (1.0 equals 1.0.0), and vers:pypi ranges by VersRange::contains_pypi. Ranges of every other type are Unevaluated::UnsupportedScheme.

Experimental: may change in a 0.x minor release.

use libtea_core::{Cle, Pep440Version};

let cle: Cle = serde_json::from_str(r#"{"events": [
  {"id": 2, "type": "endOfSupport", "effective": "2025-06-01T00:00:00Z",
   "published": "2025-01-01T00:00:00Z", "versions": [{"range": "vers:pypi/<2.0"}]},
  {"id": 1, "type": "released", "effective": "2024-01-01T00:00:00Z",
   "published": "2024-01-01T00:00:00Z", "version": "1.4"}
]}"#).unwrap();
let status = cle.status_for_pypi(&Pep440Version::parse("1.4.0").unwrap());
assert_eq!(status.end_of_support.unwrap().as_str(), "2025-06-01T00:00:00Z");
assert_eq!(status.released.unwrap().as_str(), "2024-01-01T00:00:00Z");
assert!(status.unevaluated.is_empty());

Trait Implementations§

Source§

impl Clone for Cle

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Cle

Source§

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

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

impl<'de> Deserialize<'de> for Cle

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for Cle

Source§

impl PartialEq for Cle

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for Cle

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Cle

Auto Trait Implementations§

§

impl Forget for Cle

§

impl Freeze for Cle

§

impl Move for Cle

§

impl RefUnwindSafe for Cle

§

impl Send for Cle

§

impl Sync for Cle

§

impl Unpin for Cle

§

impl UnsafeUnpin for Cle

§

impl UnwindSafe for Cle

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.