pub struct Any;
Expand description
Generic MQTT role type
Represents a flexible MQTT role that can behave as either a client or server. This role type is useful for:
- Testing scenarios where both client and server behavior is needed
- Bridge implementations that act as both client and server
- Development tools that need to simulate both roles
- Generic code that works with any MQTT role
This is a zero-sized type used purely for compile-time role identification. When using the Any role, the implementation typically allows all MQTT packet types without role-based restrictions.
§Protocol Behavior
The Any role typically allows all MQTT packet types and behaviors, making it the most permissive role type. This flexibility comes at the cost of losing compile-time role-specific validations.
§Examples
ⓘ
use mqtt_protocol_core::mqtt;
// Any role can be used for flexible implementations
type FlexibleConnection = mqtt::connection::GenericConnection<mqtt::connection::Any, u16>;
// Role constants can be checked at compile time
assert_eq!(mqtt::connection::Any::IS_CLIENT, false);
assert_eq!(mqtt::connection::Any::IS_SERVER, false);
assert_eq!(mqtt::connection::Any::IS_ANY, true);
Trait Implementations§
Source§impl<PacketIdType> RecvBehavior<Any, PacketIdType> for GenericConnection<Any, PacketIdType>where
PacketIdType: IsPacketId,
impl<PacketIdType> RecvBehavior<Any, PacketIdType> for GenericConnection<Any, PacketIdType>where
PacketIdType: IsPacketId,
Source§impl RoleType for Any
Implementation of RoleType
for Any
impl RoleType for Any
Implementation of RoleType
for Any
Configures the Any role type with the appropriate role flags.
Only the IS_ANY
flag is set to true
, indicating this type
can represent any MQTT role (client, server, or both).
Source§impl<PacketIdType> Sendable<Any, PacketIdType> for GenericPacket<PacketIdType>where
PacketIdType: IsPacketId,
impl<PacketIdType> Sendable<Any, PacketIdType> for GenericPacket<PacketIdType>where
PacketIdType: IsPacketId,
fn dispatch_send( self, connection: &mut GenericConnection<Any, PacketIdType>, ) -> Vec<GenericEvent<PacketIdType>>
impl SendableRole<Any> for Auth
impl SendableRole<Any> for Connack
impl SendableRole<Any> for Connack
impl SendableRole<Any> for Connect
impl SendableRole<Any> for Connect
impl SendableRole<Any> for Disconnect
impl SendableRole<Any> for Disconnect
impl<PacketIdType> SendableRole<Any> for GenericPuback<PacketIdType>where
PacketIdType: IsPacketId,
impl<PacketIdType> SendableRole<Any> for GenericPuback<PacketIdType>where
PacketIdType: IsPacketId,
impl<PacketIdType> SendableRole<Any> for GenericPubcomp<PacketIdType>where
PacketIdType: IsPacketId,
impl<PacketIdType> SendableRole<Any> for GenericPubcomp<PacketIdType>where
PacketIdType: IsPacketId,
impl<PacketIdType> SendableRole<Any> for GenericPublish<PacketIdType>where
PacketIdType: IsPacketId,
impl<PacketIdType> SendableRole<Any> for GenericPublish<PacketIdType>where
PacketIdType: IsPacketId,
impl<PacketIdType> SendableRole<Any> for GenericPubrec<PacketIdType>where
PacketIdType: IsPacketId,
impl<PacketIdType> SendableRole<Any> for GenericPubrec<PacketIdType>where
PacketIdType: IsPacketId,
impl<PacketIdType> SendableRole<Any> for GenericPubrel<PacketIdType>where
PacketIdType: IsPacketId,
impl<PacketIdType> SendableRole<Any> for GenericPubrel<PacketIdType>where
PacketIdType: IsPacketId,
impl<PacketIdType> SendableRole<Any> for GenericSuback<PacketIdType>where
PacketIdType: IsPacketId,
impl<PacketIdType> SendableRole<Any> for GenericSuback<PacketIdType>where
PacketIdType: IsPacketId,
impl<PacketIdType> SendableRole<Any> for GenericSubscribe<PacketIdType>where
PacketIdType: IsPacketId,
impl<PacketIdType> SendableRole<Any> for GenericSubscribe<PacketIdType>where
PacketIdType: IsPacketId,
impl<PacketIdType> SendableRole<Any> for GenericUnsuback<PacketIdType>where
PacketIdType: IsPacketId,
impl<PacketIdType> SendableRole<Any> for GenericUnsuback<PacketIdType>where
PacketIdType: IsPacketId,
impl<PacketIdType> SendableRole<Any> for GenericUnsubscribe<PacketIdType>where
PacketIdType: IsPacketId,
impl<PacketIdType> SendableRole<Any> for GenericUnsubscribe<PacketIdType>where
PacketIdType: IsPacketId,
impl SendableRole<Any> for Pingreq
impl SendableRole<Any> for Pingreq
impl SendableRole<Any> for Pingresp
impl SendableRole<Any> for Pingresp
Auto Trait Implementations§
impl Freeze for Any
impl RefUnwindSafe for Any
impl Send for Any
impl Sync for Any
impl Unpin for Any
impl UnwindSafe for Any
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more