Skip to content

Commit

Permalink
feat(decode): traits change to decode
Browse files Browse the repository at this point in the history
  • Loading branch information
tu6ge committed Dec 18, 2022
1 parent c13ca08 commit a9b3a8d
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion examples/parse_xml.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use aliyun_oss_client::traits::{RefineObject, RefineObjectList};
use aliyun_oss_client::decode::{RefineObject, RefineObjectList};
use thiserror::Error;

struct MyFile {
Expand Down
2 changes: 1 addition & 1 deletion src/bucket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ use crate::client::ClientArc;
#[cfg(feature = "blocking")]
use crate::client::ClientRc;
use crate::config::BucketBase;
use crate::decode::{RefineBucket, RefineBucketList, RefineObjectList};
use crate::errors::{OssError, OssResult};
#[cfg(feature = "blocking")]
use crate::file::blocking::AlignBuilder as BlockingAlignBuilder;
use crate::file::AlignBuilder;
use crate::object::{Object, ObjectList};
use crate::traits::{RefineBucket, RefineBucketList, RefineObjectList};
use crate::types::{
CanonicalizedResource, InvalidEndPoint, Query, QueryKey, QueryValue, BUCKET_INFO,
};
Expand Down
7 changes: 6 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,14 @@ pub mod blocking;
/// 封装了 reqwest::RequestBuilder 模块
pub mod builder;

/// 解析 aliyun OSS 接口返回的 xml 格式的各种 trait
/// 解析 aliyun OSS 接口返回的 xml
#[deprecated(since = "0.11.0", note = "plase use decode mod")]
pub mod traits;

/// 解析 aliyun OSS 接口返回的 xml
#[path = "traits.rs"]
pub mod decode;

/// 异常处理模块
pub mod errors;

Expand Down
4 changes: 2 additions & 2 deletions src/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ use crate::client::ClientArc;
#[cfg(feature = "blocking")]
use crate::client::ClientRc;
use crate::config::{BucketBase, ObjectBase, ObjectPath};
use crate::decode::{RefineObject, RefineObjectList};
use crate::errors::{OssError, OssResult};
#[cfg(feature = "blocking")]
use crate::file::blocking::AlignBuilder as BlockingAlignBuilder;
use crate::file::AlignBuilder;
use crate::traits::{RefineObject, RefineObjectList};
use crate::types::{
CanonicalizedResource, Query, QueryKey, QueryValue, UrlQuery, CONTINUATION_TOKEN,
};
Expand Down Expand Up @@ -567,7 +567,7 @@ impl Client {
/// ```rust
/// use aliyun_oss_client::{
/// builder::BuilderError,
/// traits::{RefineObject, RefineObjectList},
/// decode::{RefineObject, RefineObjectList},
/// Client,
/// };
/// use dotenv::dotenv;
Expand Down
20 changes: 10 additions & 10 deletions src/tests/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ mod object_list_xml {

#[test]
fn from_xml() {
use crate::traits::RefineObject;
use crate::traits::RefineObjectList;
use crate::decode::RefineObject;
use crate::decode::RefineObjectList;

#[derive(Default)]
struct ObjectA {}
Expand Down Expand Up @@ -170,8 +170,8 @@ mod object_list_xml {
#[cfg(feature = "bench")]
#[bench]
fn from_xml_bench(b: &mut test::Bencher) {
use crate::traits::RefineObject;
use crate::traits::RefineObjectList;
use crate::decode::RefineObject;
use crate::decode::RefineObjectList;

#[derive(Default)]
struct ObjectA {}
Expand Down Expand Up @@ -316,8 +316,8 @@ mod object_list_xml {
#[cfg(feature = "bench")]
#[bench]
fn from_xml_bench_real_object(b: &mut test::Bencher) {
use crate::traits::RefineObject;
use crate::traits::RefineObjectList;
use crate::decode::RefineObject;
use crate::decode::RefineObjectList;

let xml = r#"<?xml version="1.0" encoding="UTF-8"?>
<ListBucketResult>
Expand Down Expand Up @@ -362,8 +362,8 @@ mod object_list_xml {

#[test]
fn from_xml_has_next() {
use crate::traits::RefineObject;
use crate::traits::RefineObjectList;
use crate::decode::RefineObject;
use crate::decode::RefineObjectList;

#[derive(Default)]
struct ObjectA {}
Expand Down Expand Up @@ -435,7 +435,7 @@ mod bucket_xml {

#[test]
fn from_xml() {
use crate::traits::RefineBucket;
use crate::decode::RefineBucket;

struct BucketA {}

Expand Down Expand Up @@ -512,7 +512,7 @@ mod bucket_list_xml {

#[test]
fn from_xml() {
use crate::traits::{RefineBucket, RefineBucketList};
use crate::decode::{RefineBucket, RefineBucketList};

#[derive(Default)]
struct BucketA {}
Expand Down
2 changes: 1 addition & 1 deletion src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//!
//! ## 示例
//! ```
//! use aliyun_oss_client::traits::{RefineObject, RefineObjectList};
//! use aliyun_oss_client::decode::{RefineObject, RefineObjectList};
//! use thiserror::Error;
//!
//! struct MyFile {
Expand Down

0 comments on commit a9b3a8d

Please sign in to comment.