Skip to content

Commit

Permalink
[ISSUE #499]🎨Add default value for struct (#500)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxsm authored Jun 11, 2024
1 parent d8eb95d commit 799bedd
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion rocketmq-common/src/common/consumer/consume_from_where.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ use serde::Deserializer;
use serde::Serialize;
use serde::Serializer;

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
pub enum ConsumeFromWhere {
#[default]
ConsumeFromLastOffset,
ConsumeFromLastOffsetAndFromMinWhenBootFirst,
ConsumeFromMinOffset,
Expand Down
3 changes: 2 additions & 1 deletion rocketmq-remoting/src/protocol/heartbeat/consume_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ use serde::Serialize;
use serde::Serializer;

#[allow(clippy::enum_variant_names)]
#[derive(Debug, Clone, Copy, Hash, Eq, PartialEq)]
#[derive(Debug, Clone, Copy, Hash, Eq, PartialEq, Default)]
pub enum ConsumeType {
#[default]
ConsumeActively,
ConsumePassively,
ConsumePop,
Expand Down
2 changes: 1 addition & 1 deletion rocketmq-remoting/src/protocol/heartbeat/consumer_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use crate::protocol::heartbeat::consume_type::ConsumeType;
use crate::protocol::heartbeat::message_model::MessageModel;
use crate::protocol::heartbeat::subscription_data::SubscriptionData;

#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq)]
#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq, Default)]
#[serde(rename_all = "camelCase")]
pub struct ConsumerData {
pub group_name: String,
Expand Down
2 changes: 1 addition & 1 deletion rocketmq-remoting/src/protocol/heartbeat/heartbeat_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::protocol::heartbeat::consumer_data::ConsumerData;
use crate::protocol::heartbeat::producer_data::ProducerData;
use crate::protocol::RemotingSerializable;

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct HeartbeatData {
#[serde(rename = "clientID")]
Expand Down
3 changes: 2 additions & 1 deletion rocketmq-remoting/src/protocol/heartbeat/message_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ use serde::Deserializer;
use serde::Serialize;
use serde::Serializer;

#[derive(Debug, Clone, Copy, Hash, Eq, PartialEq)]
#[derive(Debug, Clone, Copy, Hash, Eq, PartialEq, Default)]
pub enum MessageModel {
Broadcasting,
#[default]
Clustering,
}

Expand Down

0 comments on commit 799bedd

Please sign in to comment.