Skip to content

Commit

Permalink
display view versin
Browse files Browse the repository at this point in the history
  • Loading branch information
JanKaul committed May 12, 2024
1 parent 75cdc4e commit 54f5bb1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions iceberg-rust-spec/src/spec/view_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,23 @@ pub struct Version {
pub default_namespace: Option<Vec<String>>,
}

impl fmt::Display for Version {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"{}",
&serde_json::to_string(self).map_err(|_| fmt::Error::default())?,
)
}
}

impl str::FromStr for Version {
type Err = Error;
fn from_str(s: &str) -> Result<Self, Self::Err> {
serde_json::from_str(s).map_err(Error::from)
}
}

#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)]
#[serde(rename_all = "kebab-case")]
/// Fields for the version 2 of the view metadata.
Expand Down

0 comments on commit 54f5bb1

Please sign in to comment.