pub struct LicenseBlock {
pub license_id: [u8; 16],
pub licensee_hash: [u8; 32],
pub issued_at: u64,
pub expires_at: u64,
pub flags: u8,
pub seat_limit: u16,
pub query_limit: u32,
pub custom_terms: Vec<u8>,
}Expand description
Commercial license block
Fields§
§license_id: [u8; 16]Unique license identifier (UUID as 16 bytes)
licensee_hash: [u8; 32]SHA-256 hash of licensee identifier
issued_at: u64Issue timestamp (Unix epoch seconds)
expires_at: u64Expiration timestamp (Unix epoch seconds, 0 = never)
flags: u8License flags
seat_limit: u16Maximum concurrent seats (0 = unlimited)
query_limit: u32Maximum queries (0 = unlimited)
custom_terms: Vec<u8>Custom terms (optional, serialized)
Implementations§
Source§impl LicenseBlock
impl LicenseBlock
Sourcepub fn with_expiration(self, expires_at: u64) -> Self
pub fn with_expiration(self, expires_at: u64) -> Self
Set expiration timestamp
Sourcepub fn with_seat_limit(self, limit: u16) -> Self
pub fn with_seat_limit(self, limit: u16) -> Self
Set seat limit
Sourcepub fn with_query_limit(self, limit: u32) -> Self
pub fn with_query_limit(self, limit: u32) -> Self
Set query limit
Sourcepub fn with_watermark(self) -> Self
pub fn with_watermark(self) -> Self
Mark as watermarked
Sourcepub fn with_revocable(self) -> Self
pub fn with_revocable(self) -> Self
Mark as revocable
Sourcepub fn with_transferable(self) -> Self
pub fn with_transferable(self) -> Self
Mark as transferable
Sourcepub fn with_custom_terms(self, terms: Vec<u8>) -> Self
pub fn with_custom_terms(self, terms: Vec<u8>) -> Self
Set custom terms
Sourcepub fn to_bytes(&self) -> Vec<u8> ⓘ
pub fn to_bytes(&self) -> Vec<u8> ⓘ
Serialize to bytes
Format:
- license_id (16 bytes)
- licensee_hash (32 bytes)
- issued_at (8 bytes, LE)
- expires_at (8 bytes, LE)
- flags (1 byte)
- seat_limit (2 bytes, LE)
- query_limit (4 bytes, LE)
- custom_terms_len (4 bytes, LE) – added for deserialization
- custom_terms (variable)
Sourcepub fn from_bytes(buf: &[u8]) -> Result<Self>
pub fn from_bytes(buf: &[u8]) -> Result<Self>
Sourcepub const fn is_expiration_enforced(&self) -> bool
pub const fn is_expiration_enforced(&self) -> bool
Check if expiration is enforced
Sourcepub const fn is_seats_enforced(&self) -> bool
pub const fn is_seats_enforced(&self) -> bool
Check if seat limit is enforced
Sourcepub const fn is_query_limited(&self) -> bool
pub const fn is_query_limited(&self) -> bool
Check if query limit is enforced
Sourcepub const fn is_watermarked(&self) -> bool
pub const fn is_watermarked(&self) -> bool
Check if watermarked
Sourcepub const fn is_revocable(&self) -> bool
pub const fn is_revocable(&self) -> bool
Check if revocable
Sourcepub const fn is_transferable(&self) -> bool
pub const fn is_transferable(&self) -> bool
Check if transferable
Sourcepub fn license_id_string(&self) -> String
pub fn license_id_string(&self) -> String
Get license ID as UUID string
Trait Implementations§
Source§impl Clone for LicenseBlock
impl Clone for LicenseBlock
Source§fn clone(&self) -> LicenseBlock
fn clone(&self) -> LicenseBlock
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 LicenseBlock
impl Debug for LicenseBlock
Source§impl PartialEq for LicenseBlock
impl PartialEq for LicenseBlock
impl Eq for LicenseBlock
impl StructuralPartialEq for LicenseBlock
Auto Trait Implementations§
impl Freeze for LicenseBlock
impl RefUnwindSafe for LicenseBlock
impl Send for LicenseBlock
impl Sync for LicenseBlock
impl Unpin for LicenseBlock
impl UnsafeUnpin for LicenseBlock
impl UnwindSafe for LicenseBlock
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> 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.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.