pub struct ParamState {
pub value: Value,
pub revision: u64,
pub writer: String,
pub timestamp: u64,
pub strategy: ConflictStrategy,
pub lock_holder: Option<String>,
pub meta: Option<ParamMeta>,
}Expand description
State of a single parameter
Fields§
§value: ValueCurrent value
revision: u64Monotonic revision number
writer: StringSession ID of last writer
timestamp: u64Timestamp of last write (microseconds)
strategy: ConflictStrategyConflict resolution strategy
lock_holder: Option<String>Lock holder (if locked)
meta: Option<ParamMeta>Metadata
Implementations§
Source§impl ParamState
impl ParamState
Sourcepub fn with_strategy(self, strategy: ConflictStrategy) -> Self
pub fn with_strategy(self, strategy: ConflictStrategy) -> Self
Create with specific strategy
Sourcepub fn try_update(
&mut self,
new_value: Value,
writer: &str,
expected_revision: Option<u64>,
request_lock: bool,
release_lock: bool,
) -> Result<u64, UpdateError>
pub fn try_update( &mut self, new_value: Value, writer: &str, expected_revision: Option<u64>, request_lock: bool, release_lock: bool, ) -> Result<u64, UpdateError>
Attempt to update the value
Returns Ok(new_revision) if update was accepted, Err with reason if rejected.
Sourcepub fn validate_range(&self, value: &Value) -> bool
pub fn validate_range(&self, value: &Value) -> bool
Check if value is within range (if specified)
Trait Implementations§
Source§impl Clone for ParamState
impl Clone for ParamState
Source§fn clone(&self) -> ParamState
fn clone(&self) -> ParamState
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 moreAuto Trait Implementations§
impl Freeze for ParamState
impl RefUnwindSafe for ParamState
impl Send for ParamState
impl Sync for ParamState
impl Unpin for ParamState
impl UnwindSafe for ParamState
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