pub struct MetadataMessage {
pub meta: Option<Meta>,
pub data: Option<Data>,
pub errors: Option<Vec<StatusMessage>>,
pub other: Option<HashMap<String, Value>>,
}
Expand description
The top-level type of a JSON file that conforms to the SDMX-JSON Metadata Message format.
§Deserializing
§From a string
use std::str::FromStr;
use std::fs::read_to_string;
use sdmx_json::metadata::MetadataMessage;
fn main() -> Result<(), Box<dyn std::error::Error + 'static>> {
let file = read_to_string("sdmx-data.json")?;
let message = MetadataMessage::from_str(file.as_str())?;
Ok(())
}
§From a byte slice
use std::fs::read;
use sdmx_json::metadata::MetadataMessage;
fn main() -> Result<(), Box<dyn std::error::Error + 'static>> {
let file = read("sdmx-data.json")?;
let message = MetadataMessage::try_from(file.as_slice())?;
Ok(())
}
§From a serde_json::Value
use serde_json::json;
use sdmx_json::metadata::MetadataMessage;
fn main() -> Result<(), Box<dyn std::error::Error + 'static>> {
let value = json!({}); // assuming this has content
let message = MetadataMessage::try_from(value);
Ok(())
}
Fields§
§meta: Option<Meta>
§data: Option<Data>
§errors: Option<Vec<StatusMessage>>
§other: Option<HashMap<String, Value>>
Trait Implementations§
Source§impl Clone for MetadataMessage
impl Clone for MetadataMessage
Source§fn clone(&self) -> MetadataMessage
fn clone(&self) -> MetadataMessage
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 MetadataMessage
impl Debug for MetadataMessage
Source§impl Default for MetadataMessage
impl Default for MetadataMessage
Source§fn default() -> MetadataMessage
fn default() -> MetadataMessage
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for MetadataMessage
impl<'de> Deserialize<'de> for MetadataMessage
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 FromStr for MetadataMessage
impl FromStr for MetadataMessage
Source§impl PartialEq for MetadataMessage
impl PartialEq for MetadataMessage
Source§impl SdmxMessage for MetadataMessage
impl SdmxMessage for MetadataMessage
Source§impl Serialize for MetadataMessage
impl Serialize for MetadataMessage
Source§impl<'a> TryFrom<&'a [u8]> for MetadataMessage
impl<'a> TryFrom<&'a [u8]> for MetadataMessage
Source§impl TryFrom<Value> for MetadataMessage
impl TryFrom<Value> for MetadataMessage
impl StructuralPartialEq for MetadataMessage
Auto Trait Implementations§
impl Freeze for MetadataMessage
impl RefUnwindSafe for MetadataMessage
impl Send for MetadataMessage
impl Sync for MetadataMessage
impl Unpin for MetadataMessage
impl UnwindSafe for MetadataMessage
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