pub struct RegulationData {
pub regulator: String,
pub target: String,
pub sign: Monotonicity,
pub essential: Essentiality,
}
Expand description
Structure for sending simplified data about Regulation
to the frontend.
Some fields of RegulationData
are simplified compared to Regulation
(e.g., pure Strings
instead
of more complex typesafe structs) to allow for easier (de)serialization.
Fields§
§regulator: String
§target: String
§sign: Monotonicity
§essential: Essentiality
Implementations§
source§impl RegulationData
impl RegulationData
sourcepub fn new(
regulator_id: &str,
target_id: &str,
essential: Essentiality,
sign: Monotonicity,
) -> RegulationData
pub fn new( regulator_id: &str, target_id: &str, essential: Essentiality, sign: Monotonicity, ) -> RegulationData
Create new RegulationData
object given references to individual components.
sourcepub fn from_reg(regulation: &Regulation) -> RegulationData
pub fn from_reg(regulation: &Regulation) -> RegulationData
Create new RegulationData
object given a regulation
.
sourcepub fn try_from_reg_str(regulation_str: &str) -> Result<RegulationData, String>
pub fn try_from_reg_str(regulation_str: &str) -> Result<RegulationData, String>
Try to create new RegulationData
object given a string encoding a regulation.
sourcepub fn to_reg(&self) -> Result<Regulation, String>
pub fn to_reg(&self) -> Result<Regulation, String>
Extract new Regulation
instance from this data.
Trait Implementations§
source§impl Clone for RegulationData
impl Clone for RegulationData
source§fn clone(&self) -> RegulationData
fn clone(&self) -> RegulationData
Returns a copy 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 RegulationData
impl Debug for RegulationData
source§impl<'de> Deserialize<'de> for RegulationData
impl<'de> Deserialize<'de> for RegulationData
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<'de> JsonSerde<'de> for RegulationData
impl<'de> JsonSerde<'de> for RegulationData
source§fn to_json_str(&self) -> String
fn to_json_str(&self) -> String
Wrapper for json serialization.
source§fn to_pretty_json_str(&self) -> String
fn to_pretty_json_str(&self) -> String
Wrapper for pretty json serialization with indentation.
source§impl PartialEq for RegulationData
impl PartialEq for RegulationData
source§impl Serialize for RegulationData
impl Serialize for RegulationData
impl StructuralPartialEq for RegulationData
Auto Trait Implementations§
impl Freeze for RegulationData
impl RefUnwindSafe for RegulationData
impl Send for RegulationData
impl Sync for RegulationData
impl Unpin for RegulationData
impl UnwindSafe for RegulationData
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)