Skip to content

Commit

Permalink
Improvement/derive display (#1134)
Browse files Browse the repository at this point in the history
* Implement Display for agent config structs and AriesMessage type

Signed-off-by: Patrik Stas <[email protected]>
  • Loading branch information
Patrik-Stas authored Feb 27, 2024
1 parent bd90961 commit 1181f6a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions aries/agents/rust/aries-vcx-agent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ log = "0.4.17"
uuid = "1.2.1"
thiserror = "1.0.37"
url = { version = "2.3.1", features = ["serde"] }
display_as_json = { path = "../../../../misc/display_as_json" }
4 changes: 3 additions & 1 deletion aries/agents/rust/aries-vcx-agent/src/agent/agent_config.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use aries_vcx_core::wallet::indy::{IssuerConfig, WalletConfig};
use display_as_json::Display;
use serde::Serialize;

#[derive(Clone)]
#[derive(Clone, Serialize, Display)]
pub struct AgentConfig {
pub config_wallet: WalletConfig,
pub config_issuer: IssuerConfig,
Expand Down
6 changes: 5 additions & 1 deletion aries/agents/rust/aries-vcx-agent/src/agent/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ use aries_vcx_core::{
use did_peer::resolver::PeerDidResolver;
use did_resolver_registry::ResolverRegistry;
use did_resolver_sov::resolution::DidSovResolver;
use display_as_json::Display;
use serde::Serialize;

use crate::{
agent::{agent_config::AgentConfig, agent_struct::Agent},
Expand All @@ -37,17 +39,19 @@ use crate::{
},
};

#[derive(Serialize, Display)]
pub struct WalletInitConfig {
pub wallet_name: String,
pub wallet_key: String,
pub wallet_kdf: String,
}

#[derive(Serialize, Display)]
pub struct PoolInitConfig {
pub genesis_path: String,
pub pool_name: String,
}

#[derive(Serialize, Display)]
pub struct InitConfig {
pub enterprise_seed: String,
pub pool_config: PoolInitConfig,
Expand Down
3 changes: 2 additions & 1 deletion aries/messages/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub mod msg_parts;
pub mod msg_types;

use derive_more::From;
use display_as_json::Display;
use misc::utils;
use msg_fields::protocols::{
cred_issuance::{v1::CredentialIssuanceV1, v2::CredentialIssuanceV2, CredentialIssuance},
Expand Down Expand Up @@ -55,7 +56,7 @@ use crate::{
///
/// It also automatically appends the correct `@type` field when serializing
/// a message.
#[derive(Clone, Debug, From, PartialEq)]
#[derive(Clone, Debug, Display, From, PartialEq)]
pub enum AriesMessage {
Routing(Forward),
Connection(Connection),
Expand Down

0 comments on commit 1181f6a

Please sign in to comment.