diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b0e9f7cabb4f..dd6c3a411a0b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,6 @@ jobs: build: runs-on: ${{ matrix.os }} - needs: check strategy: matrix: os: @@ -33,7 +32,6 @@ jobs: unit: runs-on: ${{ matrix.os }} - needs: check strategy: matrix: os: diff --git a/Cargo.toml b/Cargo.toml index ca309d37944c..ad98d51a707e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,7 +32,6 @@ aws-smithy-client = "0.38" aws-smithy-http = "0.38" aws-smithy-http-tower = "0.38" aws-types = { version = "0.8", features = ["hardcoded-credentials"] } -bitflags = "1" blocking = "1" bytes = "1" futures = { version = "0.3", features = ["alloc"] } diff --git a/examples/basic.rs b/examples/basic.rs index c87678e79b95..f766d11eab3c 100644 --- a/examples/basic.rs +++ b/examples/basic.rs @@ -56,7 +56,7 @@ async fn main() -> Result<()> { let meta = o.metadata().await?; if meta.path().contains("test_file") { let mode = meta.mode(); - assert!(mode.contains(ObjectMode::FILE)); + assert_eq!(mode, ObjectMode::FILE); found = true } diff --git a/src/object.rs b/src/object.rs index 7a97a8d7016a..8bda850f5ab9 100644 --- a/src/object.rs +++ b/src/object.rs @@ -12,13 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. use std::fmt::Debug; +use std::fmt::Display; +use std::fmt::Formatter; use std::future::Future; use std::pin::Pin; use std::sync::Arc; use std::task::Context; use std::task::Poll; -use bitflags::bitflags; use futures::future::BoxFuture; use futures::ready; @@ -185,12 +186,30 @@ impl Metadata { } } -bitflags! { - #[derive(Default)] - pub struct ObjectMode: u32 { - const FILE =1<<0; - const DIR = 1<<1; - const LINK = 1<<2; +/// ObjectMode represents the corresponding object's mode. +#[derive(Copy, Clone, Debug, Eq, PartialEq)] +pub enum ObjectMode { + /// FILE means the object has data to read. + FILE, + /// DIR means the object can be listed. + DIR, + /// Unknown means we don't know what we can do on thi object. + Unknown, +} + +impl Default for ObjectMode { + fn default() -> Self { + Self::Unknown + } +} + +impl Display for ObjectMode { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + match self { + ObjectMode::FILE => write!(f, "file"), + ObjectMode::DIR => write!(f, "dir"), + ObjectMode::Unknown => write!(f, "unknown"), + } } } diff --git a/tests/behavior/behavior.rs b/tests/behavior/behavior.rs index e7f93c4fe39e..edacee6b49e0 100644 --- a/tests/behavior/behavior.rs +++ b/tests/behavior/behavior.rs @@ -108,12 +108,7 @@ impl BehaviorTest { let meta = o.metadata().await?; if meta.path() == path { let mode = meta.mode(); - assert!( - mode.contains(ObjectMode::FILE), - "expected: {:?}, actual: {:?}", - ObjectMode::FILE, - mode - ); + assert_eq!(mode, ObjectMode::FILE); found = true }