Skip to content

Commit

Permalink
feat: derive Deserialize/Serialize for ObjectMetaData (#420)
Browse files Browse the repository at this point in the history
* feat: derive Deserialize/Serialize for ObjectMetaData

* feat: let serde to be a feature which is disabled by default

* fix: tweak feature order
  • Loading branch information
killme2008 authored Jul 5, 2022
1 parent 8a6e7c3 commit 7994bfb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ all-features = true
[features]
compress = ["async-compression"]
retry = ["backon"]
serde = ["time/serde"]
services-hdfs = ["hdrs"]
services-http = ["radix_trie"]
testing = ["uuid"]
Expand Down
4 changes: 4 additions & 0 deletions src/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ use crate::path::get_basename;
use crate::path::normalize_path;
use crate::Accessor;
use crate::BytesWrite;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};

/// Handler for all object related operations.
#[derive(Clone, Debug)]
Expand Down Expand Up @@ -722,6 +724,7 @@ impl Object {

/// Metadata carries all object metadata.
#[derive(Debug, Clone, Default)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct ObjectMetadata {
mode: ObjectMode,

Expand Down Expand Up @@ -808,6 +811,7 @@ impl ObjectMetadata {

/// ObjectMode represents the corresponding object's mode.
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum ObjectMode {
/// FILE means the object has data to read.
FILE,
Expand Down

1 comment on commit 7994bfb

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for opendal ready!

✅ Preview
https://opendal-689hw9ukb-databend.vercel.app

Built with commit 7994bfb.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.