New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Encapsulate Metadata's data. #91
Conversation
src/chunks/metadata.rs
Outdated
@@ -12,7 +13,30 @@ use crate::io::{Error, ErrorKind, ReadMetadata, Result}; | |||
/// | |||
/// finalfusion metadata in TOML format. | |||
#[derive(Clone, Debug, PartialEq)] | |||
pub struct Metadata(pub Value); | |||
pub struct Metadata { | |||
data: Value, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inner
|
||
impl Metadata { | ||
/// Construct new `Metadata`. | ||
pub fn new(data: Value) -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a From
counterpart would be nice here as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried to implement TryFrom<V> where V: Serialize
, but that fails because of blanket impls...
--> src/chunks/metadata.rs:43:1
|
43 | impl<V> TryFrom<V> for Metadata where V: Serialize {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: conflicting implementation in crate `core`:
- impl<T, U> std::convert::TryFrom<U> for T
where U: std::convert::Into<T>;
db41e76
to
95019b6
Compare
Restrict interface to Metadata's data, impl Deref(Mut) with target toml::Value for Metadata.
95019b6
to
3c50780
Compare
Is this and #90 good to go? |
Restrict interface to Metadata's data, impl Deref(Mut) with
target toml::Value for Metadata.