pub struct Metadata { /* private fields */ }
Expand description
Top-level metadata
Examples
#[derive(serde::Deserialize)]
struct MyMetaData {
foo: i32,
bar: String
}
let yaml = "
time_units: generations
metadata:
foo: 1
bar: bananas
demes:
- name: A
epochs:
- start_size: 100
";
let graph = demes::loads(yaml).unwrap();
let yaml_metadata = graph.metadata().unwrap().as_yaml_string();
let my_metadata: MyMetaData = serde_yaml::from_str(&yaml_metadata).unwrap();
assert_eq!(my_metadata.foo, 1);
assert_eq!(&my_metadata.bar, "bananas");
Implementations
sourceimpl Metadata
impl Metadata
sourcepub fn as_yaml_string(&self) -> String
pub fn as_yaml_string(&self) -> String
Return the metadata as YAML
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Metadata
impl<'de> Deserialize<'de> for Metadata
sourcefn 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
impl Eq for Metadata
impl StructuralEq for Metadata
impl StructuralPartialEq for Metadata
Auto Trait Implementations
impl RefUnwindSafe for Metadata
impl Send for Metadata
impl Sync for Metadata
impl Unpin for Metadata
impl UnwindSafe for Metadata
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<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.