pub struct ObservationData {
pub id: String,
pub name: String,
pub annotation: String,
pub dataset: String,
pub values: String,
}
Expand description
Structure for sending data about Observation
to the frontend.
Contains also ID of the corresponding dataset. Some fields are further simplified compared to
original typesafe versions (e.g., pure Strings
are used instead of more complex typesafe
structs) to allow for easier (de)serialization.
Fields§
§id: String
§name: String
§annotation: String
§dataset: String
§values: String
Implementations§
source§impl ObservationData
impl ObservationData
sourcepub fn new(
obs_id: &str,
name: &str,
annot: &str,
dataset_id: &str,
values: &str,
) -> ObservationData
pub fn new( obs_id: &str, name: &str, annot: &str, dataset_id: &str, values: &str, ) -> ObservationData
Create new ObservationData
instance given all its components.
sourcepub fn from_obs(obs: &Observation, dataset_id: &DatasetId) -> ObservationData
pub fn from_obs(obs: &Observation, dataset_id: &DatasetId) -> ObservationData
Create new ObservationData
instance given a reference to a observation, and ID of
its dataset.
sourcepub fn to_observation(&self) -> Result<Observation, String>
pub fn to_observation(&self) -> Result<Observation, String>
Extract the corresponding Observation
from the ObservationData
.
There is a syntax check just to make sure that the data are valid.
Trait Implementations§
source§impl Clone for ObservationData
impl Clone for ObservationData
source§fn clone(&self) -> ObservationData
fn clone(&self) -> ObservationData
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 ObservationData
impl Debug for ObservationData
source§impl<'de> Deserialize<'de> for ObservationData
impl<'de> Deserialize<'de> for ObservationData
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 ObservationData
impl<'de> JsonSerde<'de> for ObservationData
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 ObservationData
impl PartialEq for ObservationData
source§impl Serialize for ObservationData
impl Serialize for ObservationData
impl StructuralPartialEq for ObservationData
Auto Trait Implementations§
impl Freeze for ObservationData
impl RefUnwindSafe for ObservationData
impl Send for ObservationData
impl Sync for ObservationData
impl Unpin for ObservationData
impl UnwindSafe for ObservationData
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
)