ValidationContext

Struct ValidationContext 

Source
pub struct ValidationContext {
    pub current_time: Option<DateTime<Utc>>,
    pub current_hostname: Option<String>,
    pub current_machine_id: Option<String>,
    pub current_software_version: Option<Version>,
    pub current_connection_count: Option<u32>,
    pub requested_features: Vec<String>,
    pub custom_values: HashMap<String, Value>,
}
Expand description

Context information provided during license validation.

This structure contains all the runtime information needed to validate a license against the current execution environment.

Fields§

§current_time: Option<DateTime<Utc>>

The current date and time to check against temporal constraints. If None, uses the system’s current time.

§current_hostname: Option<String>

The current hostname to check against hostname constraints.

§current_machine_id: Option<String>

The current machine identifier to check against machine ID constraints.

§current_software_version: Option<Version>

The current software version to check against version constraints.

§current_connection_count: Option<u32>

The current number of connections to check against connection limits.

§requested_features: Vec<String>

Features being requested for this validation. Each feature will be checked against the license constraints.

§custom_values: HashMap<String, Value>

Custom values to check against custom constraints.

Implementations§

Source§

impl ValidationContext

Source

pub fn new() -> Self

Creates a new empty validation context.

Source

pub fn with_time(self, time: DateTime<Utc>) -> Self

Sets the current time for validation.

Source

pub fn with_hostname(self, hostname: impl Into<String>) -> Self

Sets the current hostname for validation.

Source

pub fn with_machine_id(self, machine_id: impl Into<String>) -> Self

Sets the current machine identifier for validation.

Source

pub fn with_software_version(self, version: Version) -> Self

Sets the current software version for validation.

Source

pub fn with_connection_count(self, count: u32) -> Self

Sets the current connection count for validation.

Source

pub fn with_feature(self, feature: impl Into<String>) -> Self

Adds a requested feature to check against the license.

Source

pub fn with_features( self, features: impl IntoIterator<Item = impl Into<String>>, ) -> Self

Adds multiple requested features to check against the license.

Source

pub fn with_custom_value(self, key: impl Into<String>, value: Value) -> Self

Adds a custom value for constraint checking.

Trait Implementations§

Source§

impl Clone for ValidationContext

Source§

fn clone(&self) -> ValidationContext

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ValidationContext

Source§

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

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

impl Default for ValidationContext

Source§

fn default() -> ValidationContext

Returns the “default value” for a type. Read more

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> 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> 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 = 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>,

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V