pub struct PHPVersionRange {
pub min: Option<PHPVersion>,
pub max: Option<PHPVersion>,
}Expand description
Represents a range of PHP versions, defined by a minimum and maximum version.
This is useful for specifying compatibility ranges, such as “supports PHP 7.0 to 7.4”.
§Examples
use mago_php_version::PHPVersion;
use mago_php_version::PHPVersionRange;
let range = PHPVersionRange::between(PHPVersion::new(7, 0, 0), PHPVersion::new(7, 4, 99));
assert!(range.includes(PHPVersion::new(7, 2, 0))); // true
assert!(!range.includes(PHPVersion::new(8, 0, 0))); // falseFields§
§min: Option<PHPVersion>§max: Option<PHPVersion>Implementations§
Source§impl PHPVersionRange
impl PHPVersionRange
Sourcepub const PHP7: PHPVersionRange
pub const PHP7: PHPVersionRange
Represents the range of PHP versions from 7.0.0 to 7.99.99.
Sourcepub const PHP8: PHPVersionRange
pub const PHP8: PHPVersionRange
Represents the range of PHP versions from 8.0.0 to 8.99.99.
Sourcepub const fn until(version: PHPVersion) -> Self
pub const fn until(version: PHPVersion) -> Self
Creates a new PHPVersionRange that includes all versions up to (and including) the specified version.
Sourcepub const fn from(version: PHPVersion) -> Self
pub const fn from(version: PHPVersion) -> Self
Creates a new PHPVersionRange that includes all versions from (and including) the specified version.
Sourcepub const fn between(min: PHPVersion, max: PHPVersion) -> Self
pub const fn between(min: PHPVersion, max: PHPVersion) -> Self
Creates a new PHPVersionRange that includes all versions between (and including) the specified minimum and maximum versions.
Sourcepub const fn includes(&self, version: PHPVersion) -> bool
pub const fn includes(&self, version: PHPVersion) -> bool
Checks if this version range supports the given PHPVersion.
Trait Implementations§
Source§impl Clone for PHPVersionRange
impl Clone for PHPVersionRange
Source§fn clone(&self) -> PHPVersionRange
fn clone(&self) -> PHPVersionRange
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PHPVersionRange
impl Debug for PHPVersionRange
Source§impl Default for PHPVersionRange
impl Default for PHPVersionRange
Source§fn default() -> PHPVersionRange
fn default() -> PHPVersionRange
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for PHPVersionRange
impl<'de> Deserialize<'de> for PHPVersionRange
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 Hash for PHPVersionRange
impl Hash for PHPVersionRange
Source§impl JsonSchema for PHPVersionRange
impl JsonSchema for PHPVersionRange
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl Ord for PHPVersionRange
impl Ord for PHPVersionRange
Source§fn cmp(&self, other: &PHPVersionRange) -> Ordering
fn cmp(&self, other: &PHPVersionRange) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for PHPVersionRange
impl PartialEq for PHPVersionRange
Source§impl PartialOrd for PHPVersionRange
impl PartialOrd for PHPVersionRange
Source§impl Serialize for PHPVersionRange
impl Serialize for PHPVersionRange
impl Copy for PHPVersionRange
impl Eq for PHPVersionRange
impl StructuralPartialEq for PHPVersionRange
Auto Trait Implementations§
impl Freeze for PHPVersionRange
impl RefUnwindSafe for PHPVersionRange
impl Send for PHPVersionRange
impl Sync for PHPVersionRange
impl Unpin for PHPVersionRange
impl UnwindSafe for PHPVersionRange
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.