Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cosmos-sdk-proto: add serde derive macros #471

Merged
merged 24 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add wasmd, update plugins
  • Loading branch information
ash-burnt committed Jun 1, 2024
commit 11179f168ac93df3852705c88a9b1b34097cc46d
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @generated
/// Module is the module config object for the cosmos.app v1 app module.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Module {}
include!("cosmos.app.module.v1alpha1.serde.rs");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ impl<'de> serde::Deserialize<'de> for Module {
formatter.write_str("struct cosmos.app.module.v1alpha1.Module")
}

fn visit_map<V>(self, mut map: V) -> std::result::Result<Module, V::Error>
fn visit_map<V>(self, mut map_: V) -> std::result::Result<Module, V::Error>
where
V: serde::de::MapAccess<'de>,
{
while map.next_key::<GeneratedField>()?.is_some() {
let _ = map.next_value::<serde::de::IgnoredAny>()?;
while map_.next_key::<GeneratedField>()?.is_some() {
let _ = map_.next_value::<serde::de::IgnoredAny>()?;
}
Ok(Module {})
}
Expand Down
7 changes: 7 additions & 0 deletions cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.app.v1alpha1.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @generated
/// ModuleDescriptor describes an app module.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ModuleDescriptor {
/// go_import names the package that should be imported by an app to load the
Expand All @@ -24,6 +25,7 @@ pub struct ModuleDescriptor {
pub can_migrate_from: ::prost::alloc::vec::Vec<MigrateFromInfo>,
}
/// PackageReference is a reference to a protobuf package used by a module.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PackageReference {
/// name is the fully-qualified name of the package.
Expand Down Expand Up @@ -69,6 +71,7 @@ pub struct PackageReference {
}
/// MigrateFromInfo is information on a module version that a newer module
/// can migrate from.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MigrateFromInfo {
/// module is the fully-qualified protobuf name of the module config object
Expand All @@ -83,13 +86,15 @@ pub struct MigrateFromInfo {
/// allow a mixture of declarative and imperative app wiring, however, apps
/// that strive for the maximum ease of maintainability should be able to describe
/// their state machine with a config object alone.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Config {
/// modules are the module configurations for the app.
#[prost(message, repeated, tag = "1")]
pub modules: ::prost::alloc::vec::Vec<ModuleConfig>,
}
/// ModuleConfig is a module configuration for an app.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ModuleConfig {
/// name is the unique name of the module within the app. It should be a name
Expand All @@ -110,9 +115,11 @@ pub struct ModuleConfig {
pub config: ::core::option::Option<::prost_types::Any>,
}
/// QueryConfigRequest is the Query/Config request type.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryConfigRequest {}
/// QueryConfigRequest is the Query/Config response type.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryConfigResponse {
/// config is the current app config.
Expand Down
50 changes: 25 additions & 25 deletions cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.app.v1alpha1.serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,18 @@ impl<'de> serde::Deserialize<'de> for Config {
formatter.write_str("struct cosmos.app.v1alpha1.Config")
}

fn visit_map<V>(self, mut map: V) -> std::result::Result<Config, V::Error>
fn visit_map<V>(self, mut map_: V) -> std::result::Result<Config, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut modules__ = None;
while let Some(k) = map.next_key()? {
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Modules => {
if modules__.is_some() {
return Err(serde::de::Error::duplicate_field("modules"));
}
modules__ = Some(map.next_value()?);
modules__ = Some(map_.next_value()?);
}
}
}
Expand Down Expand Up @@ -161,18 +161,18 @@ impl<'de> serde::Deserialize<'de> for MigrateFromInfo {
formatter.write_str("struct cosmos.app.v1alpha1.MigrateFromInfo")
}

fn visit_map<V>(self, mut map: V) -> std::result::Result<MigrateFromInfo, V::Error>
fn visit_map<V>(self, mut map_: V) -> std::result::Result<MigrateFromInfo, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut module__ = None;
while let Some(k) = map.next_key()? {
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Module => {
if module__.is_some() {
return Err(serde::de::Error::duplicate_field("module"));
}
module__ = Some(map.next_value()?);
module__ = Some(map_.next_value()?);
}
}
}
Expand Down Expand Up @@ -266,25 +266,25 @@ impl<'de> serde::Deserialize<'de> for ModuleConfig {
formatter.write_str("struct cosmos.app.v1alpha1.ModuleConfig")
}

fn visit_map<V>(self, mut map: V) -> std::result::Result<ModuleConfig, V::Error>
fn visit_map<V>(self, mut map_: V) -> std::result::Result<ModuleConfig, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut name__ = None;
let mut config__ = None;
while let Some(k) = map.next_key()? {
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Name => {
if name__.is_some() {
return Err(serde::de::Error::duplicate_field("name"));
}
name__ = Some(map.next_value()?);
name__ = Some(map_.next_value()?);
}
GeneratedField::Config => {
if config__.is_some() {
return Err(serde::de::Error::duplicate_field("config"));
}
config__ = map.next_value()?;
config__ = map_.next_value()?;
}
}
}
Expand Down Expand Up @@ -396,32 +396,32 @@ impl<'de> serde::Deserialize<'de> for ModuleDescriptor {
formatter.write_str("struct cosmos.app.v1alpha1.ModuleDescriptor")
}

fn visit_map<V>(self, mut map: V) -> std::result::Result<ModuleDescriptor, V::Error>
fn visit_map<V>(self, mut map_: V) -> std::result::Result<ModuleDescriptor, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut go_import__ = None;
let mut use_package__ = None;
let mut can_migrate_from__ = None;
while let Some(k) = map.next_key()? {
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::GoImport => {
if go_import__.is_some() {
return Err(serde::de::Error::duplicate_field("goImport"));
}
go_import__ = Some(map.next_value()?);
go_import__ = Some(map_.next_value()?);
}
GeneratedField::UsePackage => {
if use_package__.is_some() {
return Err(serde::de::Error::duplicate_field("usePackage"));
}
use_package__ = Some(map.next_value()?);
use_package__ = Some(map_.next_value()?);
}
GeneratedField::CanMigrateFrom => {
if can_migrate_from__.is_some() {
return Err(serde::de::Error::duplicate_field("canMigrateFrom"));
}
can_migrate_from__ = Some(map.next_value()?);
can_migrate_from__ = Some(map_.next_value()?);
}
}
}
Expand Down Expand Up @@ -517,26 +517,26 @@ impl<'de> serde::Deserialize<'de> for PackageReference {
formatter.write_str("struct cosmos.app.v1alpha1.PackageReference")
}

fn visit_map<V>(self, mut map: V) -> std::result::Result<PackageReference, V::Error>
fn visit_map<V>(self, mut map_: V) -> std::result::Result<PackageReference, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut name__ = None;
let mut revision__ = None;
while let Some(k) = map.next_key()? {
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Name => {
if name__.is_some() {
return Err(serde::de::Error::duplicate_field("name"));
}
name__ = Some(map.next_value()?);
name__ = Some(map_.next_value()?);
}
GeneratedField::Revision => {
if revision__.is_some() {
return Err(serde::de::Error::duplicate_field("revision"));
}
revision__ = Some(
map.next_value::<::pbjson::private::NumberDeserialize<_>>()?
map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?
.0,
);
}
Expand Down Expand Up @@ -614,12 +614,12 @@ impl<'de> serde::Deserialize<'de> for QueryConfigRequest {
formatter.write_str("struct cosmos.app.v1alpha1.QueryConfigRequest")
}

fn visit_map<V>(self, mut map: V) -> std::result::Result<QueryConfigRequest, V::Error>
fn visit_map<V>(self, mut map_: V) -> std::result::Result<QueryConfigRequest, V::Error>
where
V: serde::de::MapAccess<'de>,
{
while map.next_key::<GeneratedField>()?.is_some() {
let _ = map.next_value::<serde::de::IgnoredAny>()?;
while map_.next_key::<GeneratedField>()?.is_some() {
let _ = map_.next_value::<serde::de::IgnoredAny>()?;
}
Ok(QueryConfigRequest {})
}
Expand Down Expand Up @@ -701,18 +701,18 @@ impl<'de> serde::Deserialize<'de> for QueryConfigResponse {
formatter.write_str("struct cosmos.app.v1alpha1.QueryConfigResponse")
}

fn visit_map<V>(self, mut map: V) -> std::result::Result<QueryConfigResponse, V::Error>
fn visit_map<V>(self, mut map_: V) -> std::result::Result<QueryConfigResponse, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut config__ = None;
while let Some(k) = map.next_key()? {
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Config => {
if config__.is_some() {
return Err(serde::de::Error::duplicate_field("config"));
}
config__ = map.next_value()?;
config__ = map_.next_value()?;
}
}
}
Expand Down
Loading