Skip to main content

CommandCustomHeader

Trait CommandCustomHeader 

Source
pub trait CommandCustomHeader: AsAny {
Show 18 methods // Required method fn to_map(&self) -> Option<HashMap<CheetahString, CheetahString>>; // Provided methods fn check_fields(&self) -> Result<()> { ... } fn encode_into_map(&self, out: &mut HeaderMap) { ... } fn try_encode_into_map( &self, out: &mut HeaderMap, ) -> Result<(), ProtocolContractViolation> { ... } fn resolve_wire_key(&self, _key: &str) -> Option<ResolvedHeaderKey> { ... } fn canonical_wire_key(&self, key: &str) -> Option<&'static str> { ... } fn contains_wire_key(&self, key: &str) -> bool { ... } fn encoded_len_hint(&self) -> usize { ... } fn encode_capability(&self) -> HeaderEncodeCapability { ... } fn encode_direct_binary( &self, _out: &mut BytesMut, ) -> Result<(), ProtocolContractViolation> { ... } fn supports_direct_json_fields(&self) -> bool { ... } fn encode_direct_json_fields( &self, _out: &mut BytesMut, ) -> Result<(), ProtocolContractViolation> { ... } fn write_if_not_null(&self, out: &mut BytesMut, key: &str, value: &str) { ... } fn encode_fast(&mut self, out: &mut BytesMut) { ... } fn decode_fast( &mut self, _fields: &HashMap<CheetahString, CheetahString>, ) -> Result<()> { ... } fn support_fast_codec(&self) -> bool { ... } fn get_and_check_not_none( &self, map: &HashMap<CheetahString, CheetahString>, field: &CheetahString, ) -> Result<CheetahString> { ... } fn get_and_check_not_none_ref<'a>( &self, map: &'a HashMap<CheetahString, CheetahString>, field: &CheetahString, ) -> Result<&'a CheetahString> { ... }
}

Required Methods§

Source

fn to_map(&self) -> Option<HashMap<CheetahString, CheetahString>>

Converts the implementing type to a map.

Returns an Option that contains a HashMap of string keys and string values,
representing the implementing type’s fields.
If the conversion is successful, a map is returned; explicitly audited fieldless headers return an empty map. If conversion fails, None is returned.

Provided Methods§

Source

fn check_fields(&self) -> Result<()>

Checks the fields of the implementing type.

Returns a typed result indicating whether the fields are valid.

If the fields are valid, the Ok variant is returned with an empty () value. If the fields are invalid, an error governed by a stable rocketmq_error::ErrorDescriptor is returned.

Source

fn encode_into_map(&self, out: &mut HeaderMap)

Appends this header’s extension fields to an existing map.

Generated implementations write directly into out. The default preserves compatibility for handwritten implementations.

Source

fn try_encode_into_map( &self, out: &mut HeaderMap, ) -> Result<(), ProtocolContractViolation>

Validates and appends this header’s fields to an existing map.

Typed codecs override this method to preserve classified failures. The default adapts handwritten implementations without changing their object-safe trait surface or silently treating None as a successful conversion.

§Errors

Returns ProtocolContractViolation::LegacyValidation when check_fields fails, or ProtocolContractViolation::LegacyMapConversionFailed when a legacy to_map implementation returns None.

Source

fn resolve_wire_key(&self, _key: &str) -> Option<ResolvedHeaderKey>

Resolves a canonical key or decode alias for typed headers.

Source

fn canonical_wire_key(&self, key: &str) -> Option<&'static str>

Resolves a key and returns its canonical wire key.

Source

fn contains_wire_key(&self, key: &str) -> bool

Returns whether a canonical key or alias belongs to this header schema.

Source

fn encoded_len_hint(&self) -> usize

Returns a saturating extension-field payload capacity hint.

Source

fn encode_capability(&self) -> HeaderEncodeCapability

Returns the authoritative encoding path for this header.

Source

fn encode_direct_binary( &self, _out: &mut BytesMut, ) -> Result<(), ProtocolContractViolation>

Appends this header directly to a ROCKETMQ extension-field payload.

Implementations must require only shared access so cloned remoting commands can encode the same immutable header. Callers must check Self::encode_capability before invoking this method. Implementations are responsible for validating the header before the first write; the frame entrypoint does not pre-validate because map and binary encoders already own the authoritative validation boundary.

§Errors

Returns a classified header codec error when validation or binary representation fails. The default reports that direct encoding is unavailable.

Source

fn supports_direct_json_fields(&self) -> bool

Returns whether this header can write its complete JSON extension-field object without first materializing a HeaderMap.

Source

fn encode_direct_json_fields( &self, _out: &mut BytesMut, ) -> Result<(), ProtocolContractViolation>

Writes this header as one complete JSON extension-field object.

Callers must check Self::supports_direct_json_fields before invoking this method. Implementations must validate before writing and must leave rollback to the enclosing frame encoder.

§Errors

Returns a classified header codec error when direct JSON encoding is unavailable or validation fails.

Source

fn write_if_not_null(&self, out: &mut BytesMut, key: &str, value: &str)

Writes the provided key to the out buffer if the value is not empty.

§Arguments
  • out - A mutable reference to a BytesMut buffer where the key will be written.
  • key - A string slice that represents the key to be written.
  • value - A string slice that represents the value associated with the key.
§Behavior

If value is not empty, the function will write the key to the out buffer twice, first with a short length prefix and then with a long length prefix.

Source

fn encode_fast(&mut self, out: &mut BytesMut)

Compatibility adapter for the legacy mutable fast-encoding API.

Production serialization uses Self::encode_capability and Self::encode_direct_binary directly. This adapter cannot propagate errors and remains only for existing callers during migration.

Source

fn decode_fast( &mut self, _fields: &HashMap<CheetahString, CheetahString>, ) -> Result<()>

A placeholder function for fast decoding.

This function currently does nothing and can be overridden by implementing types.

§Arguments
  • _fields - A reference to a HashMap that contains the fields to be decoded.
Source

fn support_fast_codec(&self) -> bool

Indicates whether the implementing type supports fast codec.

§Returns

This legacy capability is limited to hand-written fast decoding. Direct binary encoding is reported independently by Self::encode_capability. The default remains false so enabling generated direct encoding cannot route decoding through an unimplemented legacy hook.

Source

fn get_and_check_not_none( &self, map: &HashMap<CheetahString, CheetahString>, field: &CheetahString, ) -> Result<CheetahString>

Retrieves the value associated with the specified field from the provided map.

§Arguments
  • map - A reference to a HashMap containing CheetahString keys and values.
  • field - A reference to a CheetahString representing the field to retrieve.
§Returns
  • Ok(CheetahString) - If the field is found in the map, returns the associated value.
  • Err(Error) - If the field is not found in the map, returns an error indicating the field is required.
§Errors

This function returns a serialization error if the specified field is not found in the map.

Source

fn get_and_check_not_none_ref<'a>( &self, map: &'a HashMap<CheetahString, CheetahString>, field: &CheetahString, ) -> Result<&'a CheetahString>

Retrieves a borrowed value associated with the specified field from the provided map.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl CommandCustomHeader for AckMessageRequestHeader

Source§

impl CommandCustomHeader for AddBrokerRequestHeader

Source§

impl CommandCustomHeader for AddWritePermOfBrokerRequestHeader

Source§

impl CommandCustomHeader for AddWritePermOfBrokerResponseHeader

Source§

impl CommandCustomHeader for AlterSyncStateSetRequestHeader

Source§

impl CommandCustomHeader for AlterSyncStateSetResponseHeader

Source§

impl CommandCustomHeader for ApplyBrokerIdRequestHeader

Source§

impl CommandCustomHeader for ApplyBrokerIdResponseHeader

Source§

impl CommandCustomHeader for rocketmq_protocol::protocol::header::broker::broker_heartbeat_request_header::BrokerHeartbeatRequestHeader

Source§

impl CommandCustomHeader for rocketmq_protocol::protocol::header::namesrv::broker_request::BrokerHeartbeatRequestHeader

Source§

impl CommandCustomHeader for ChangeInvisibleTimeRequestHeader

Source§

impl CommandCustomHeader for ChangeInvisibleTimeResponseHeader

Source§

impl CommandCustomHeader for CheckRocksdbCqWriteProgressRequestHeader

Source§

impl CommandCustomHeader for CheckTransactionStateRequestHeader

Source§

impl CommandCustomHeader for CheckTransactionStateResponseHeader

Source§

impl CommandCustomHeader for CleanBrokerDataRequestHeader

Source§

impl CommandCustomHeader for CloneGroupOffsetRequestHeader

Source§

impl CommandCustomHeader for ConsumeMessageDirectlyResultRequestHeader

Source§

impl CommandCustomHeader for ConsumerSendMsgBackRequestHeader

Source§

impl CommandCustomHeader for CreateAclRequestHeader

Source§

impl CommandCustomHeader for CreateTopicListRequestHeader

Source§

impl CommandCustomHeader for CreateTopicRequestHeader

Source§

impl CommandCustomHeader for CreateUserRequestHeader

Source§

impl CommandCustomHeader for DeleteAclRequestHeader

Source§

impl CommandCustomHeader for DeleteKVConfigRequestHeader

Source§

impl CommandCustomHeader for DeleteSubscriptionGroupRequestHeader

Source§

impl CommandCustomHeader for DeleteTopicFromNamesrvRequestHeader

Source§

impl CommandCustomHeader for DeleteTopicRequestHeader

Source§

impl CommandCustomHeader for DeleteUserRequestHeader

Source§

impl CommandCustomHeader for ElectMasterRequestHeader

Source§

impl CommandCustomHeader for ElectMasterResponseHeader

Source§

impl CommandCustomHeader for EmptyHeader

Source§

impl CommandCustomHeader for EndTransactionRequestHeader

Source§

impl CommandCustomHeader for ExchangeHAInfoRequestHeader

Source§

impl CommandCustomHeader for ExchangeHaInfoResponseHeader

Source§

impl CommandCustomHeader for ExportRocksdbConfigToJsonRequestHeader

Source§

impl CommandCustomHeader for GetAclRequestHeader

Source§

impl CommandCustomHeader for GetAllProducerInfoRequestHeader

Source§

impl CommandCustomHeader for GetAllSubscriptionGroupRequestHeader

Source§

impl CommandCustomHeader for GetAllSubscriptionGroupResponseHeader

Source§

impl CommandCustomHeader for GetAllTopicConfigRequestHeader

Source§

impl CommandCustomHeader for GetAllTopicConfigResponseHeader

Source§

impl CommandCustomHeader for GetBrokerConfigResponseHeader

Source§

impl CommandCustomHeader for GetBrokerMemberGroupRequestHeader

Source§

impl CommandCustomHeader for GetConsumeStatsInBrokerHeader

Source§

impl CommandCustomHeader for GetConsumeStatsRequestHeader

Source§

impl CommandCustomHeader for GetConsumerConnectionListRequestHeader

Source§

impl CommandCustomHeader for GetConsumerListByGroupRequestHeader

Source§

impl CommandCustomHeader for GetConsumerListByGroupResponseHeader

Source§

impl CommandCustomHeader for GetConsumerRunningInfoRequestHeader

Source§

impl CommandCustomHeader for GetConsumerStatusRequestHeader

Source§

impl CommandCustomHeader for GetEarliestMsgStoretimeRequestHeader

Source§

impl CommandCustomHeader for GetEarliestMsgStoretimeResponseHeader

Source§

impl CommandCustomHeader for GetKVConfigRequestHeader

Source§

impl CommandCustomHeader for GetKVConfigResponseHeader

Source§

impl CommandCustomHeader for GetKVListByNamespaceRequestHeader

Source§

impl CommandCustomHeader for GetLiteClientInfoRequestHeader

Source§

impl CommandCustomHeader for GetLiteGroupInfoRequestHeader

Source§

impl CommandCustomHeader for GetLiteTopicInfoRequestHeader

Source§

impl CommandCustomHeader for GetMaxOffsetRequestHeader

Source§

impl CommandCustomHeader for GetMaxOffsetResponseHeader

Source§

impl CommandCustomHeader for GetMetaDataResponseHeader

Source§

impl CommandCustomHeader for GetMinOffsetRequestHeader

Source§

impl CommandCustomHeader for GetMinOffsetResponseHeader

Source§

impl CommandCustomHeader for GetNamesrvConfigRequestHeader

Source§

impl CommandCustomHeader for GetNextBrokerIdRequestHeader

Source§

impl CommandCustomHeader for GetNextBrokerIdResponseHeader

Source§

impl CommandCustomHeader for GetParentTopicInfoRequestHeader

Source§

impl CommandCustomHeader for GetProducerConnectionListRequestHeader

Source§

impl CommandCustomHeader for GetReplicaInfoRequestHeader

Source§

impl CommandCustomHeader for GetReplicaInfoResponseHeader

Source§

impl CommandCustomHeader for GetRouteInfoRequestHeader

Source§

impl CommandCustomHeader for GetSubscriptionGroupConfigRequestHeader

Source§

impl CommandCustomHeader for GetTopicConfigRequestHeader

Source§

impl CommandCustomHeader for GetTopicStatsInfoRequestHeader

Source§

impl CommandCustomHeader for GetTopicStatsRequestHeader

Source§

impl CommandCustomHeader for GetTopicsByClusterRequestHeader

Source§

impl CommandCustomHeader for GetUserRequestHeader

Source§

impl CommandCustomHeader for HeartbeatRequestHeader

Source§

impl CommandCustomHeader for ListAclRequestHeader

Source§

impl CommandCustomHeader for ListUsersRequestHeader

Source§

impl CommandCustomHeader for LiteSubscriptionCtlRequestHeader

Source§

impl CommandCustomHeader for LockBatchMqRequestHeader

Source§

impl CommandCustomHeader for MaintenanceRequestHeader

Source§

impl CommandCustomHeader for NotificationRequestHeader

Source§

impl CommandCustomHeader for NotificationResponseHeader

Source§

impl CommandCustomHeader for NotifyBrokerRoleChangedRequestHeader

Source§

impl CommandCustomHeader for NotifyConsumerIdsChangedRequestHeader

Source§

impl CommandCustomHeader for NotifyMinBrokerIdChangeRequestHeader

Source§

impl CommandCustomHeader for NotifyUnsubscribeLiteRequestHeader

Source§

impl CommandCustomHeader for PeekMessageRequestHeader

Source§

impl CommandCustomHeader for PollingInfoRequestHeader

Source§

impl CommandCustomHeader for PollingInfoResponseHeader

Source§

impl CommandCustomHeader for PopLiteMessageRequestHeader

Source§

impl CommandCustomHeader for PopLiteMessageResponseHeader

Source§

impl CommandCustomHeader for PopMessageRequestHeader

Source§

impl CommandCustomHeader for PopMessageResponseHeader

Source§

impl CommandCustomHeader for PullMessageRequestHeader

Source§

impl CommandCustomHeader for PullMessageResponseHeader

Source§

impl CommandCustomHeader for PutKVConfigRequestHeader

Source§

impl CommandCustomHeader for QueryConsumeQueueRequestHeader

Source§

impl CommandCustomHeader for QueryConsumeTimeSpanRequestHeader

Source§

impl CommandCustomHeader for QueryConsumerOffsetRequestHeader

Source§

impl CommandCustomHeader for QueryConsumerOffsetResponseHeader

Source§

impl CommandCustomHeader for QueryCorrectionOffsetHeader

Source§

impl CommandCustomHeader for QueryDataVersionRequestHeader

Source§

impl CommandCustomHeader for QueryDataVersionResponseHeader

Source§

impl CommandCustomHeader for QueryMessageRequestHeader

Source§

impl CommandCustomHeader for QueryMessageResponseHeader

Source§

impl CommandCustomHeader for QuerySubscriptionByConsumerRequestHeader

Source§

impl CommandCustomHeader for QueryTopicConsumeByWhoRequestHeader

Source§

impl CommandCustomHeader for QueryTopicsByConsumerRequestHeader

Source§

impl CommandCustomHeader for RecallMessageRequestHeader

Source§

impl CommandCustomHeader for RecallMessageResponseHeader

Source§

impl CommandCustomHeader for RegisterBrokerRequestHeader

Source§

impl CommandCustomHeader for RegisterBrokerResponseHeader

Source§

impl CommandCustomHeader for RegisterBrokerToControllerRequestHeader

Source§

impl CommandCustomHeader for RegisterBrokerToControllerResponseHeader

Source§

impl CommandCustomHeader for RegisterTopicRequestHeader

Source§

impl CommandCustomHeader for RemoveBrokerRequestHeader

Source§

impl CommandCustomHeader for ReplyMessageRequestHeader

Source§

impl CommandCustomHeader for ResetMasterFlushOffsetHeader

Source§

impl CommandCustomHeader for ResetOffsetRequestHeader

Source§

impl CommandCustomHeader for ResumeCheckHalfMessageRequestHeader

Source§

impl CommandCustomHeader for RpcRequestHeader

Source§

impl CommandCustomHeader for SearchOffsetRequestHeader

Source§

impl CommandCustomHeader for SearchOffsetResponseHeader

Source§

impl CommandCustomHeader for SendMessageRequestHeader

Source§

impl CommandCustomHeader for SendMessageRequestHeaderV2

Source§

impl CommandCustomHeader for SendMessageResponseHeader

Source§

impl CommandCustomHeader for rocketmq_protocol::rpc::topic_request_header::TopicRequestHeader

Source§

impl CommandCustomHeader for rocketmq_protocol::protocol::header::namesrv::topic_operation_header::TopicRequestHeader

Source§

impl CommandCustomHeader for TriggerLiteDispatchRequestHeader

Source§

impl CommandCustomHeader for UnRegisterBrokerRequestHeader

Source§

impl CommandCustomHeader for UnlockBatchMqRequestHeader

Source§

impl CommandCustomHeader for UnregisterClientRequestHeader

Source§

impl CommandCustomHeader for UpdateAclRequestHeader

Source§

impl CommandCustomHeader for UpdateBrokerConfigRequestHeader

Source§

impl CommandCustomHeader for UpdateBrokerConfigResponseHeader

Source§

impl CommandCustomHeader for UpdateConsumerOffsetConditionalHeader

Source§

impl CommandCustomHeader for UpdateConsumerOffsetRequestHeader

Source§

impl CommandCustomHeader for UpdateConsumerOffsetResponseHeader

Source§

impl CommandCustomHeader for UpdateGlobalWhiteAddrsConfigRequestHeader

Source§

impl CommandCustomHeader for UpdateGroupForbiddenRequestHeader

Source§

impl CommandCustomHeader for UpdateSubscriptionGroupConfigCasRequestHeader

Source§

impl CommandCustomHeader for UpdateSubscriptionGroupConfigCasResponseHeader

Source§

impl CommandCustomHeader for UpdateTopicConfigCasRequestHeader

Source§

impl CommandCustomHeader for UpdateTopicConfigCasResponseHeader

Source§

impl CommandCustomHeader for UpdateUserRequestHeader

Source§

impl CommandCustomHeader for ViewBrokerStatsDataRequestHeader

Source§

impl CommandCustomHeader for ViewMessageRequestHeader

Source§

impl CommandCustomHeader for ViewMessageResponseHeader

Source§

impl CommandCustomHeader for WipeWritePermOfBrokerRequestHeader

Source§

impl CommandCustomHeader for WipeWritePermOfBrokerResponseHeader