Any

Struct Any 

Source
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,

Source§

fn recv(&mut self, data: &mut Cursor<&[u8]>) -> Vec<GenericEvent<PacketIdType>>

Source§

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§

const IS_ANY: bool = true

Indicates if this role type can represent any MQTT role Read more
Source§

const IS_CLIENT: bool = false

Indicates if this role type represents an MQTT client Read more
Source§

const IS_SERVER: bool = false

Indicates if this role type represents an MQTT server/broker Read more
Source§

impl<PacketIdType> Sendable<Any, PacketIdType> for GenericPacket<PacketIdType>
where PacketIdType: IsPacketId,

Source§

fn dispatch_send( self, connection: &mut GenericConnection<Any, PacketIdType>, ) -> Vec<GenericEvent<PacketIdType>>

Source§

impl SendableRole<Any> for Auth

Source§

impl SendableRole<Any> for Connack

Source§

impl SendableRole<Any> for Connack

Source§

impl SendableRole<Any> for Connect

Source§

impl SendableRole<Any> for Connect

Source§

impl SendableRole<Any> for Disconnect

Source§

impl SendableRole<Any> for Disconnect

Source§

impl<PacketIdType> SendableRole<Any> for GenericPuback<PacketIdType>
where PacketIdType: IsPacketId,

Source§

impl<PacketIdType> SendableRole<Any> for GenericPuback<PacketIdType>
where PacketIdType: IsPacketId,

Source§

impl<PacketIdType> SendableRole<Any> for GenericPubcomp<PacketIdType>
where PacketIdType: IsPacketId,

Source§

impl<PacketIdType> SendableRole<Any> for GenericPubcomp<PacketIdType>
where PacketIdType: IsPacketId,

Source§

impl<PacketIdType> SendableRole<Any> for GenericPublish<PacketIdType>
where PacketIdType: IsPacketId,

Source§

impl<PacketIdType> SendableRole<Any> for GenericPublish<PacketIdType>
where PacketIdType: IsPacketId,

Source§

impl<PacketIdType> SendableRole<Any> for GenericPubrec<PacketIdType>
where PacketIdType: IsPacketId,

Source§

impl<PacketIdType> SendableRole<Any> for GenericPubrec<PacketIdType>
where PacketIdType: IsPacketId,

Source§

impl<PacketIdType> SendableRole<Any> for GenericPubrel<PacketIdType>
where PacketIdType: IsPacketId,

Source§

impl<PacketIdType> SendableRole<Any> for GenericPubrel<PacketIdType>
where PacketIdType: IsPacketId,

Source§

impl<PacketIdType> SendableRole<Any> for GenericSuback<PacketIdType>
where PacketIdType: IsPacketId,

Source§

impl<PacketIdType> SendableRole<Any> for GenericSuback<PacketIdType>
where PacketIdType: IsPacketId,

Source§

impl<PacketIdType> SendableRole<Any> for GenericSubscribe<PacketIdType>
where PacketIdType: IsPacketId,

Source§

impl<PacketIdType> SendableRole<Any> for GenericSubscribe<PacketIdType>
where PacketIdType: IsPacketId,

Source§

impl<PacketIdType> SendableRole<Any> for GenericUnsuback<PacketIdType>
where PacketIdType: IsPacketId,

Source§

impl<PacketIdType> SendableRole<Any> for GenericUnsuback<PacketIdType>
where PacketIdType: IsPacketId,

Source§

impl<PacketIdType> SendableRole<Any> for GenericUnsubscribe<PacketIdType>
where PacketIdType: IsPacketId,

Source§

impl<PacketIdType> SendableRole<Any> for GenericUnsubscribe<PacketIdType>
where PacketIdType: IsPacketId,

Source§

impl SendableRole<Any> for Pingreq

Source§

impl SendableRole<Any> for Pingreq

Source§

impl SendableRole<Any> for Pingresp

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.