From 7d832550518b6e6b49c7947a7fd28bd6cadf062e Mon Sep 17 00:00:00 2001 From: goose Date: Fri, 20 Feb 2026 09:44:48 -0300 Subject: [PATCH] fix: Implement std::fmt::Display for Permission to resolve compilation errors --- backend/src/models/permission.rs | 17 +++- backend/tmp/_normogen-backend-dev_logs.txt | 97 ---------------------- 2 files changed, 14 insertions(+), 100 deletions(-) delete mode 100644 backend/tmp/_normogen-backend-dev_logs.txt diff --git a/backend/src/models/permission.rs b/backend/src/models/permission.rs index c8a5a4d..5f5d5b6 100644 --- a/backend/src/models/permission.rs +++ b/backend/src/models/permission.rs @@ -1,9 +1,8 @@ use serde::{Deserialize, Serialize}; -use strum::{Display, EnumString}; +use std::fmt; -#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Display, EnumString)] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(rename_all = "lowercase")] -#[strum(serialize_all = "lowercase")] pub enum Permission { Read, Write, @@ -12,6 +11,18 @@ pub enum Permission { Admin, } +impl fmt::Display for Permission { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::Read => write!(f, "read"), + Self::Write => write!(f, "write"), + Self::Delete => write!(f, "delete"), + Self::Share => write!(f, "share"), + Self::Admin => write!(f, "admin"), + } + } +} + impl Permission { pub fn can_read(&self) -> bool { matches!(self, Self::Read | Self::Admin) diff --git a/backend/tmp/_normogen-backend-dev_logs.txt b/backend/tmp/_normogen-backend-dev_logs.txt deleted file mode 100644 index 61016b8..0000000 --- a/backend/tmp/_normogen-backend-dev_logs.txt +++ /dev/null @@ -1,97 +0,0 @@ - candidate #3: `KeyInit` - candidate #4: `KeyIvInit` - candidate #5: `Mac` - candidate #6: `VariableOutput` - candidate #7: `VariableOutputCore` - candidate #8: `ahash::HashMapExt` - candidate #9: `ahash::HashSetExt` - candidate #10: `bitvec::store::BitStore` - candidate #11: `nonzero_ext::NonZero` - candidate #12: `parking_lot_core::thread_parker::ThreadParkerT` - candidate #13: `radium::Radium` - candidate #14: `rand::distr::uniform::UniformSampler` - candidate #15: `rand::distributions::uniform::UniformSampler` - candidate #16: `ring::aead::BoundKey` - candidate #17: `serde_with::duplicate_key_impls::error_on_duplicate::PreventDuplicateInsertsMap` - candidate #18: `serde_with::duplicate_key_impls::error_on_duplicate::PreventDuplicateInsertsSet` - candidate #19: `serde_with::duplicate_key_impls::first_value_wins::DuplicateInsertsFirstWinsMap` - candidate #20: `serde_with::duplicate_key_impls::first_value_wins::DuplicateInsertsFirstWinsSet` - candidate #21: `serde_with::duplicate_key_impls::last_value_wins::DuplicateInsertsLastWinsSet` - candidate #22: `trust_dns_proto::Executor` -error[E0599]: no function or associated item named `new` found for struct `PasswordService` in the current scope - --> src/models/user.rs:117:49 - | -117 | let password_service = PasswordService::new(); - | ^^^ function or associated item not found in `PasswordService` - | - ::: src/auth/password.rs:10:1 - | - 10 | pub struct PasswordService; - | -------------------------- function or associated item `new` not found for this struct - | - = help: items from traits can only be used if the trait is implemented and in scope - = note: the following traits define an item `new`, perhaps you need to implement one of them: - candidate #1: `Bit` - candidate #2: `Digest` - candidate #3: `KeyInit` - candidate #4: `KeyIvInit` - candidate #5: `Mac` - candidate #6: `VariableOutput` - candidate #7: `VariableOutputCore` - candidate #8: `ahash::HashMapExt` - candidate #9: `ahash::HashSetExt` - candidate #10: `bitvec::store::BitStore` - candidate #11: `nonzero_ext::NonZero` - candidate #12: `parking_lot_core::thread_parker::ThreadParkerT` - candidate #13: `radium::Radium` - candidate #14: `rand::distr::uniform::UniformSampler` - candidate #15: `rand::distributions::uniform::UniformSampler` - candidate #16: `ring::aead::BoundKey` - candidate #17: `serde_with::duplicate_key_impls::error_on_duplicate::PreventDuplicateInsertsMap` - candidate #18: `serde_with::duplicate_key_impls::error_on_duplicate::PreventDuplicateInsertsSet` - candidate #19: `serde_with::duplicate_key_impls::first_value_wins::DuplicateInsertsFirstWinsMap` - candidate #20: `serde_with::duplicate_key_impls::first_value_wins::DuplicateInsertsFirstWinsSet` - candidate #21: `serde_with::duplicate_key_impls::last_value_wins::DuplicateInsertsLastWinsSet` - candidate #22: `trust_dns_proto::Executor` -error[E0277]: the trait bound `fn(State, ..., ...) -> ... {setup_recovery}: Handler<_, _>` is not satisfied - --> src/main.rs:100:49 - | - 100 | .route("/api/auth/recovery/setup", post(handlers::setup_recovery)) - | ---- ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Handler<_, _>` is not implemented for fn item `fn(State, Claims, Json<...>) -> ... {setup_recovery}` - | | - | required by a bound introduced by this call - | - = note: Consider using `#[axum::debug_handler]` to improve the error message -help: the following other types implement trait `Handler` - --> /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/axum-0.7.9/src/routing/method_routing.rs:1309:1 - | -1309 | / impl Handler<(), S> for MethodRouter -1310 | | where -1311 | | S: Clone + 'static, - | |_______________________^ `MethodRouter` implements `Handler<(), S>` - | - ::: /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/axum-0.7.9/src/handler/mod.rs:303:1 - | - 303 | / impl Handler for Layered - 304 | | where - 305 | | L: Layer> + Clone + Send + 'static, - 306 | | H: Handler, -... | - 310 | | T: 'static, - 311 | | S: 'static, - | |_______________^ `axum::handler::Layered` implements `Handler` -note: required by a bound in `post` - --> /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/axum-0.7.9/src/routing/method_routing.rs:443:1 - | - 443 | top_level_handler_fn!(post, POST); - | ^^^^^^^^^^^^^^^^^^^^^^----^^^^^^^ - | | | - | | required by a bound in this function - | required by this bound in `post` - = note: the full name for the type has been written to '/app/target/debug/deps/normogen_backend-d569d515f613fad5.long-type-4867908669310830501.txt' - = note: consider using `--verbose` to print the full type name to the console - = note: this error originates in the macro `top_level_handler_fn` (in Nightly builds, run with -Z macro-backtrace for more info) -Some errors have detailed explanations: E0277, E0282, E0308, E0432, E0433, E0599, E0609, E0659. -For more information about an error, try `rustc --explain E0277`. -warning: `normogen-backend` (bin "normogen-backend") generated 2 warnings -error: could not compile `normogen-backend` (bin "normogen-backend") due to 32 previous errors; 2 warnings emitted