diff --git a/src/broker.rs b/src/broker.rs index 9c5e32b..95eef32 100644 --- a/src/broker.rs +++ b/src/broker.rs @@ -14,13 +14,13 @@ pub trait Broker { /// A broker that is specified using a qualified domain-name. The name will be resolved at some /// point in the future. #[derive(Debug)] -pub struct NamedBroker { +pub struct NamedBroker { raw: heapless::String, resolver: R, addr: SocketAddr, } -impl NamedBroker { +impl NamedBroker { /// Construct a new named broker. /// /// # Args diff --git a/src/config.rs b/src/config.rs index 34b705e..4549549 100644 --- a/src/config.rs +++ b/src/config.rs @@ -16,7 +16,7 @@ pub enum BufferConfig { } #[derive(Debug)] -pub(crate) struct Config<'a, Broker: crate::Broker> { +pub(crate) struct Config<'a, Broker> { pub(crate) broker: Broker, pub(crate) rx_buffer: &'a mut [u8], pub(crate) tx_buffer: &'a mut [u8], @@ -30,7 +30,7 @@ pub(crate) struct Config<'a, Broker: crate::Broker> { /// Configuration specifying the operational state of the MQTT client. #[derive(Debug)] -pub struct ConfigBuilder<'a, Broker: crate::Broker> { +pub struct ConfigBuilder<'a, Broker> { buffer: &'a mut [u8], broker: Broker, rx_config: Option, diff --git a/src/message_types.rs b/src/message_types.rs index bfc26ca..2a51a9b 100644 --- a/src/message_types.rs +++ b/src/message_types.rs @@ -43,7 +43,7 @@ impl<'a> ControlPacket for ConnAck<'a> { const MESSAGE_TYPE: MessageType = MessageType::ConnAck; } -impl<'a, P: crate::publication::ToPayload> Pub<'a, P> { +impl<'a, P> Pub<'a, P> { pub fn fixed_header_flags(&self) -> u8 { *0u8.set_bits(1..=2, self.qos as u8) .set_bit(0, self.retain == Retain::Retained) diff --git a/src/mqtt_client.rs b/src/mqtt_client.rs index a869f64..e768eaa 100644 --- a/src/mqtt_client.rs +++ b/src/mqtt_client.rs @@ -260,12 +260,7 @@ impl From> for Error { } /// The client that can be used for interacting with the MQTT broker. -pub struct MqttClient< - 'buf, - TcpStack: TcpClientStack, - Clock: embedded_time::Clock, - Broker: crate::Broker, -> { +pub struct MqttClient<'buf, TcpStack: TcpClientStack, Clock: embedded_time::Clock, Broker> { sm: sm::StateMachine>, network: InterfaceHolder<'buf, TcpStack>, will: Option>, @@ -673,12 +668,7 @@ impl<'buf, TcpStack: TcpClientStack, Clock: embedded_time::Clock, Broker: crate: /// # Note /// To connect and maintain an MQTT connection, the `Minimq::poll()` method must be called /// regularly. -pub struct Minimq<'buf, TcpStack, Clock, Broker> -where - TcpStack: TcpClientStack, - Clock: embedded_time::Clock, - Broker: crate::Broker, -{ +pub struct Minimq<'buf, TcpStack: TcpClientStack, Clock: embedded_time::Clock, Broker> { client: MqttClient<'buf, TcpStack, Clock, Broker>, packet_reader: PacketReader<'buf>, } diff --git a/src/packets.rs b/src/packets.rs index 9471c06..4e52dc5 100644 --- a/src/packets.rs +++ b/src/packets.rs @@ -88,7 +88,7 @@ pub struct ConnAck<'a> { /// An MQTT PUBLISH packet, containing data to be sent or received. #[derive(Serialize)] -pub struct Pub<'a, P: crate::publication::ToPayload> { +pub struct Pub<'a, P> { /// The topic that the message was received on. pub topic: Utf8String<'a>, @@ -115,7 +115,7 @@ pub struct Pub<'a, P: crate::publication::ToPayload> { pub dup: bool, } -impl<'a, P: crate::publication::ToPayload> core::fmt::Debug for Pub<'a, P> { +impl<'a, P> core::fmt::Debug for Pub<'a, P> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { f.debug_struct("Pub") .field("topic", &self.topic) diff --git a/src/publication.rs b/src/publication.rs index 10c4aff..3e88ef4 100644 --- a/src/publication.rs +++ b/src/publication.rs @@ -44,17 +44,17 @@ impl ToPayload for &[u8; N] { /// # Note /// This is "deferred" because the closure will only be called once the publication is actually /// sent. -pub struct DeferredPublication Result> { +pub struct DeferredPublication { func: F, } -impl Result> DeferredPublication { +impl Result> DeferredPublication { pub fn new<'a>(func: F) -> Publication<'a, Self> { Publication::new(Self { func }) } } -impl Result> ToPayload for DeferredPublication { +impl Result> ToPayload for DeferredPublication { type Error = E; fn serialize(self, buffer: &mut [u8]) -> Result { (self.func)(buffer) @@ -73,7 +73,7 @@ impl Result> ToPayload for DeferredPublicat /// It is expected that the user provide a topic either by directly specifying a publication topic /// in [Publication::topic], or by parsing a topic from the [Property::ResponseTopic] property /// contained within received properties by using the [Publication::reply] API. -pub struct Publication<'a, P: ToPayload> { +pub struct Publication<'a, P> { topic: Option<&'a str>, properties: Properties<'a>, qos: QoS, diff --git a/src/varint.rs b/src/varint.rs index 6be3db6..5235937 100644 --- a/src/varint.rs +++ b/src/varint.rs @@ -38,7 +38,7 @@ impl VarintWriter for VarintBuffer { struct VarintVisitor; -struct VarintParser<'de, T: serde::de::SeqAccess<'de>> { +struct VarintParser<'de, T> { seq: T, _data: core::marker::PhantomData<&'de ()>, }