Struct opcua_server::prelude::DataChangeFilter
source · [−]pub struct DataChangeFilter {
pub trigger: DataChangeTrigger,
pub deadband_type: u32,
pub deadband_value: f64,
}
Fields
trigger: DataChangeTrigger
deadband_type: u32
deadband_value: f64
Implementations
sourceimpl DataChangeFilter
impl DataChangeFilter
sourcepub fn compare(
&self,
v1: &DataValue,
v2: &DataValue,
eu_range: Option<(f64, f64)>
) -> bool
pub fn compare(
&self,
v1: &DataValue,
v2: &DataValue,
eu_range: Option<(f64, f64)>
) -> bool
Compares one data value to another and returns true if they differ, according to their trigger type of status, status/value or status/value/timestamp
sourcepub fn compare_value_option(
&self,
v1: &Option<Variant>,
v2: &Option<Variant>,
eu_range: Option<(f64, f64)>
) -> bool
pub fn compare_value_option(
&self,
v1: &Option<Variant>,
v2: &Option<Variant>,
eu_range: Option<(f64, f64)>
) -> bool
Compares two variant values to each other. Returns true if they are considered the “same”.
sourcepub fn compare_value(
&self,
v1: &Variant,
v2: &Variant,
eu_range: Option<(f64, f64)>
) -> Result<bool, StatusCode>
pub fn compare_value(
&self,
v1: &Variant,
v2: &Variant,
eu_range: Option<(f64, f64)>
) -> Result<bool, StatusCode>
Compares two values, either a straight value compare or a numeric comparison against the deadband settings. If deadband is asked for and the values are not convertible into a numeric value, the result is false. The value is true if the values are the same within the limits set.
The eu_range is the engineering unit range and represents the range that the value should typically operate between. It’s used for percentage change operations and ignored otherwise.
Errors
BadDeadbandFilterInvalid indicates the deadband settings were invalid, e.g. an invalid type, or the args were invalid. A (low, high) range must be supplied for a percentage deadband compare.
sourcepub fn abs_compare(v1: f64, v2: f64, threshold_diff: f64) -> bool
pub fn abs_compare(v1: f64, v2: f64, threshold_diff: f64) -> bool
Compares the difference between v1 and v2 to the threshold. The two values are considered equal if their difference is less than or equal to the threshold.
sourcepub fn pct_compare(
v1: f64,
v2: f64,
low: f64,
high: f64,
threshold_pct_change: f64
) -> bool
pub fn pct_compare(
v1: f64,
v2: f64,
low: f64,
high: f64,
threshold_pct_change: f64
) -> bool
Compares the percentage difference between v1 and v2 using the low-high range as the comparison. The two values are considered equal if their perentage difference is less than or equal to the threshold.
Trait Implementations
sourceimpl BinaryEncoder<DataChangeFilter> for DataChangeFilter
impl BinaryEncoder<DataChangeFilter> for DataChangeFilter
sourcefn byte_len(&self) -> usize
fn byte_len(&self) -> usize
Returns the exact byte length of the structure as it would be if encode
were called.
This may be called prior to writing to ensure the correct amount of space is available. Read more
sourcefn encode<S>(&self, stream: &mut S) -> Result<usize, StatusCode> where
S: Write,
fn encode<S>(&self, stream: &mut S) -> Result<usize, StatusCode> where
S: Write,
Encodes the instance to the write stream.
sourcefn decode<S>(
stream: &mut S,
decoding_options: &DecodingOptions
) -> Result<DataChangeFilter, StatusCode> where
S: Read,
fn decode<S>(
stream: &mut S,
decoding_options: &DecodingOptions
) -> Result<DataChangeFilter, StatusCode> where
S: Read,
Decodes an instance from the read stream. The decoding options contains restrictions set by
the server / client on the length of strings, arrays etc. If these limits are exceeded the
implementation should return with a BadDecodingError
as soon as possible. Read more
fn encode_to_vec(&self) -> Vec<u8, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
sourceimpl Clone for DataChangeFilter
impl Clone for DataChangeFilter
sourcefn clone(&self) -> DataChangeFilter
fn clone(&self) -> DataChangeFilter
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for DataChangeFilter
impl Debug for DataChangeFilter
sourceimpl PartialEq<DataChangeFilter> for DataChangeFilter
impl PartialEq<DataChangeFilter> for DataChangeFilter
sourcefn eq(&self, other: &DataChangeFilter) -> bool
fn eq(&self, other: &DataChangeFilter) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &DataChangeFilter) -> bool
fn ne(&self, other: &DataChangeFilter) -> bool
This method tests for !=
.
sourceimpl Serialize for DataChangeFilter
impl Serialize for DataChangeFilter
sourcefn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for DataChangeFilter
Auto Trait Implementations
impl RefUnwindSafe for DataChangeFilter
impl Send for DataChangeFilter
impl Sync for DataChangeFilter
impl Unpin for DataChangeFilter
impl UnwindSafe for DataChangeFilter
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more