From 7a5099bc3c55b883d61cab43eb22f83b22939e64 Mon Sep 17 00:00:00 2001 From: Gerrit Sangel <gerrit.sangel@stud.uni-due.de> Date: Tue, 19 May 2020 13:10:05 +0200 Subject: [PATCH 001/133] Timestamp should be u64 per AMQP spec --- types/src/types.rs | 4 ++-- types/src/value.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/types/src/types.rs b/types/src/types.rs index 63958c22..0b08ed2a 100644 --- a/types/src/types.rs +++ b/types/src/types.rs @@ -41,7 +41,7 @@ pub enum AMQPType { LongString, /// An array of AMQPValue FieldArray, - /// A timestamp (u32) + /// A timestamp (u64) Timestamp, /// A Map<String, AMQPValue> FieldTable, @@ -141,7 +141,7 @@ pub type LongLongUInt = u64; pub type Float = f32; /// A f64 pub type Double = f64; -/// A timestamp (u32) +/// A timestamp (u64) pub type Timestamp = LongLongUInt; /// No value pub type Void = (); diff --git a/types/src/value.rs b/types/src/value.rs index 46acd477..0b023232 100644 --- a/types/src/value.rs +++ b/types/src/value.rs @@ -34,7 +34,7 @@ pub enum AMQPValue { LongString(LongString), /// An array of AMQPValue FieldArray(FieldArray), - /// A timestamp (u32) + /// A timestamp (u64) Timestamp(Timestamp), /// A Map<String, AMQPValue> FieldTable(FieldTable), From 3d9161afee3b328fd0c145ea63f499d653139876 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Tue, 19 May 2020 17:44:47 +0200 Subject: [PATCH 002/133] update tcp-stream Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- tcp/Cargo.toml | 2 +- tcp/src/lib.rs | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index b37d28ad..6992ad75 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -31,7 +31,7 @@ version = "=6.0.0-rc4" path = "../uri" [dependencies.tcp-stream] -version = "^0.18" +version = "^0.19" default-features = false [badges] diff --git a/tcp/src/lib.rs b/tcp/src/lib.rs index a4a45e55..e1b6ee1d 100644 --- a/tcp/src/lib.rs +++ b/tcp/src/lib.rs @@ -16,7 +16,9 @@ use std::{ }; /// Re-export TcpStream -pub use tcp_stream::{HandshakeError, HandshakeResult, Identity, MidHandshakeTlsStream, TcpStream, TLSConfig}; +pub use tcp_stream::{ + HandshakeError, HandshakeResult, Identity, MidHandshakeTlsStream, TLSConfig, TcpStream, +}; #[cfg(feature = "native-tls")] pub use tcp_stream::NativeTlsConnector; @@ -85,6 +87,10 @@ mod sys { impl TcpStreamWrapper { /// Clone the TcpStream. Original one needs to last at least for the same lifetime. + /// + /// # Safety + /// + /// The inner TcpStream won't be closed on drop and the original one needs to live longer pub unsafe fn new(socket: &TcpStream) -> Self { Self(ManuallyDrop::new(TcpStream::from_raw_fd( socket.as_raw_fd(), From b8c051b20a3673c8cd37d80464d1b78eb748af56 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Tue, 19 May 2020 17:45:14 +0200 Subject: [PATCH 003/133] v6.0.0-rc5 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/Cargo.toml | 4 ++-- codegen/src/lib.rs | 2 +- protocol/Cargo.toml | 10 +++++----- protocol/src/lib.rs | 2 +- tcp/Cargo.toml | 4 ++-- tcp/src/lib.rs | 2 +- types/Cargo.toml | 2 +- types/src/lib.rs | 2 +- uri/Cargo.toml | 2 +- uri/src/lib.rs | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index a5571e59..364b2081 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "6.0.0-rc4" # remember to update html_root_url +version = "6.0.0-rc5" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" @@ -18,7 +18,7 @@ handlebars = "^3.0" serde_json = "^1.0" [dependencies.amq-protocol-types] -version = "=6.0.0-rc4" +version = "=6.0.0-rc5" path = "../types" [dependencies.serde] diff --git a/codegen/src/lib.rs b/codegen/src/lib.rs index efafa74d..0e80d451 100644 --- a/codegen/src/lib.rs +++ b/codegen/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/6.0.0-rc4/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/6.0.0-rc5/")] //! # AMQP code generation utilities //! diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index df7cf7ab..37fd14a4 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "6.0.0-rc4" # remember to update html_root_url +version = "6.0.0-rc5" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" @@ -25,20 +25,20 @@ vendored-openssl = ["amq-protocol-tcp/vendored-openssl"] verbose-errors = ["amq-protocol-types/verbose-errors"] [build-dependencies.amq-protocol-codegen] -version = "=6.0.0-rc4" +version = "=6.0.0-rc5" path = "../codegen" [dependencies.amq-protocol-tcp] -version = "=6.0.0-rc4" +version = "=6.0.0-rc5" default-features = false path = "../tcp" [dependencies.amq-protocol-types] -version = "=6.0.0-rc4" +version = "=6.0.0-rc5" path = "../types" [dependencies.amq-protocol-uri] -version = "=6.0.0-rc4" +version = "=6.0.0-rc5" path = "../uri" [dependencies.cookie-factory] diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs index 88e04e88..05737fb9 100644 --- a/protocol/src/lib.rs +++ b/protocol/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol/6.0.0-rc4/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol/6.0.0-rc5/")] //! # AMQP manipulation library //! diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index 6992ad75..ca136d9d 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "6.0.0-rc4" # remember to update html_root_url +version = "6.0.0-rc5" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" @@ -27,7 +27,7 @@ vendored-openssl = ["tcp-stream/vendored-openssl"] log = "^0.4" [dependencies.amq-protocol-uri] -version = "=6.0.0-rc4" +version = "=6.0.0-rc5" path = "../uri" [dependencies.tcp-stream] diff --git a/tcp/src/lib.rs b/tcp/src/lib.rs index e1b6ee1d..f479769e 100644 --- a/tcp/src/lib.rs +++ b/tcp/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/6.0.0-rc4/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/6.0.0-rc5/")] //! # AMQP URI TCP connection handling //! diff --git a/types/Cargo.toml b/types/Cargo.toml index 4b4088df..60c4794b 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "6.0.0-rc4" # remember to update html_root_url +version = "6.0.0-rc5" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/types/src/lib.rs b/types/src/lib.rs index 137ddded..284c4eb6 100644 --- a/types/src/lib.rs +++ b/types/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-types/6.0.0-rc4/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-types/6.0.0-rc5/")] //! # AMQP types manipulation library //! diff --git a/uri/Cargo.toml b/uri/Cargo.toml index 633d190d..ca838c47 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "6.0.0-rc4" # remember to update html_root_url +version = "6.0.0-rc5" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" diff --git a/uri/src/lib.rs b/uri/src/lib.rs index bf836653..71a1e51d 100644 --- a/uri/src/lib.rs +++ b/uri/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/6.0.0-rc4/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/6.0.0-rc5/")] //! # AMQP URI manipulation library //! From 9e66f35ecf46b7ae76b74d1b48b71d8bc5d16f67 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Wed, 20 May 2020 17:23:21 +0200 Subject: [PATCH 004/133] codegen: drop method_has_flag Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/src/templating.rs | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/codegen/src/templating.rs b/codegen/src/templating.rs index 26000538..642a7b90 100644 --- a/codegen/src/templating.rs +++ b/codegen/src/templating.rs @@ -49,7 +49,6 @@ impl<'a> HandlebarsAMQPExtension for CodeGenerator<'a> { self.register_helper("sanitize_name", Box::new(SanitizeNameHelper)); self.register_helper("pass_by_ref", Box::new(PassByRefHelper)); self.register_helper("use_str_ref", Box::new(UseStrRefHelper)); - self.register_helper("method_has_flag", Box::new(MethodHasFlagHelper)); self.register_helper("each_argument", Box::new(EachArgumentHelper)); self.register_helper("amqp_value_ref", Box::new(AMQPValueRefHelper)); self @@ -236,36 +235,6 @@ impl HelperDef for UseStrRefHelper { } } -/// Helper for checking if a method has the given flag argument -pub struct MethodHasFlagHelper; -impl HelperDef for MethodHasFlagHelper { - fn call_inner<'reg: 'rc, 'rc>( - &self, - h: &Helper<'reg, 'rc>, - _: &'reg Handlebars<'_>, - _: &'rc Context, - _: &mut RenderContext<'reg, 'rc>, - ) -> Result<Option<ScopedJson<'reg, 'rc>>, RenderError> { - let arg0 = h.param(0).ok_or_else(|| { - RenderError::new("First param not found for helper \"method_has_flag\"") - })?; - let arg1 = h.param(1).ok_or_else(|| { - RenderError::new("Second param not found for helper \"method_has_flag\"") - })?; - let method = serde_json::from_value::<AMQPMethod>(arg0.value().clone()).map_err(|_| { - RenderError::new("Non-AMQPMethod first param given to helper \"method_has_flag\"") - })?; - let flag = arg1.value().as_str().ok_or_else(|| { - RenderError::new("Non-string second param given to helper \"method_has_flag\"") - })?; - let has_flag = method.arguments.iter().any(|arg| match arg { - AMQPArgument::Value(_) => false, - AMQPArgument::Flags(f) => f.flags.iter().any(|f| f.name == flag), - }); - Ok(Some(ScopedJson::Derived(JsonValue::from(has_flag)))) - } -} - /// Helper to walk through a Vec of [AMQPArgument](../specs.AMQPArgument.html). pub struct EachArgumentHelper; impl HelperDef for EachArgumentHelper { From 69844130bbfec034cfd284b6d048e0e10490081e Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Thu, 21 May 2020 20:49:15 +0200 Subject: [PATCH 005/133] v6.0.0-rc6 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/Cargo.toml | 4 ++-- codegen/src/lib.rs | 2 +- protocol/Cargo.toml | 10 +++++----- protocol/src/lib.rs | 2 +- tcp/Cargo.toml | 4 ++-- tcp/src/lib.rs | 2 +- types/Cargo.toml | 2 +- types/src/lib.rs | 2 +- uri/Cargo.toml | 2 +- uri/src/lib.rs | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 364b2081..4f84f19b 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "6.0.0-rc5" # remember to update html_root_url +version = "6.0.0-rc6" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" @@ -18,7 +18,7 @@ handlebars = "^3.0" serde_json = "^1.0" [dependencies.amq-protocol-types] -version = "=6.0.0-rc5" +version = "=6.0.0-rc6" path = "../types" [dependencies.serde] diff --git a/codegen/src/lib.rs b/codegen/src/lib.rs index 0e80d451..8d747bef 100644 --- a/codegen/src/lib.rs +++ b/codegen/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/6.0.0-rc5/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/6.0.0-rc6/")] //! # AMQP code generation utilities //! diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index 37fd14a4..7293ad0c 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "6.0.0-rc5" # remember to update html_root_url +version = "6.0.0-rc6" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" @@ -25,20 +25,20 @@ vendored-openssl = ["amq-protocol-tcp/vendored-openssl"] verbose-errors = ["amq-protocol-types/verbose-errors"] [build-dependencies.amq-protocol-codegen] -version = "=6.0.0-rc5" +version = "=6.0.0-rc6" path = "../codegen" [dependencies.amq-protocol-tcp] -version = "=6.0.0-rc5" +version = "=6.0.0-rc6" default-features = false path = "../tcp" [dependencies.amq-protocol-types] -version = "=6.0.0-rc5" +version = "=6.0.0-rc6" path = "../types" [dependencies.amq-protocol-uri] -version = "=6.0.0-rc5" +version = "=6.0.0-rc6" path = "../uri" [dependencies.cookie-factory] diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs index 05737fb9..7f6ea7ac 100644 --- a/protocol/src/lib.rs +++ b/protocol/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol/6.0.0-rc5/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol/6.0.0-rc6/")] //! # AMQP manipulation library //! diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index ca136d9d..b0c8ee18 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "6.0.0-rc5" # remember to update html_root_url +version = "6.0.0-rc6" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" @@ -27,7 +27,7 @@ vendored-openssl = ["tcp-stream/vendored-openssl"] log = "^0.4" [dependencies.amq-protocol-uri] -version = "=6.0.0-rc5" +version = "=6.0.0-rc6" path = "../uri" [dependencies.tcp-stream] diff --git a/tcp/src/lib.rs b/tcp/src/lib.rs index f479769e..583a22a2 100644 --- a/tcp/src/lib.rs +++ b/tcp/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/6.0.0-rc5/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/6.0.0-rc6/")] //! # AMQP URI TCP connection handling //! diff --git a/types/Cargo.toml b/types/Cargo.toml index 60c4794b..222f524b 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "6.0.0-rc5" # remember to update html_root_url +version = "6.0.0-rc6" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/types/src/lib.rs b/types/src/lib.rs index 284c4eb6..01f156e6 100644 --- a/types/src/lib.rs +++ b/types/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-types/6.0.0-rc5/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-types/6.0.0-rc6/")] //! # AMQP types manipulation library //! diff --git a/uri/Cargo.toml b/uri/Cargo.toml index ca838c47..62d64966 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "6.0.0-rc5" # remember to update html_root_url +version = "6.0.0-rc6" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" diff --git a/uri/src/lib.rs b/uri/src/lib.rs index 71a1e51d..5ddfee03 100644 --- a/uri/src/lib.rs +++ b/uri/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/6.0.0-rc5/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/6.0.0-rc6/")] //! # AMQP URI manipulation library //! From 4a87484b6b952924af1c6291dd3b56011de4330d Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Fri, 22 May 2020 07:32:18 +0200 Subject: [PATCH 006/133] frame parsing: try to add a cut Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- protocol/src/frame/parsing.rs | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/protocol/src/frame/parsing.rs b/protocol/src/frame/parsing.rs index ba71de7b..f1d102d2 100644 --- a/protocol/src/frame/parsing.rs +++ b/protocol/src/frame/parsing.rs @@ -8,7 +8,7 @@ use crate::{ use nom::{ branch::alt, bytes::streaming::{tag, take}, - combinator::{all_consuming, flat_map, map, map_opt, map_res}, + combinator::{all_consuming, cut, flat_map, map, map_opt, map_res}, error::context, sequence::{pair, tuple}, }; @@ -86,19 +86,21 @@ pub fn parse_frame<I: ParsableInput>(i: I) -> ParserResult<I, AMQPFrame> { pub fn parse_raw_frame<I: ParsableInput>(i: I) -> ParserResult<I, AMQPRawFrame<I>> { context( "parse_raw_frame", - flat_map( - tuple((parse_frame_type, parse_id, parse_long_uint)), - move |(frame_type, channel_id, size)| { - map( - pair(take(size), tag(&[constants::FRAME_END][..])), - move |(payload, _)| AMQPRawFrame { - frame_type, - channel_id, - payload, - }, - ) - }, - ), + flat_map(parse_frame_type, move |frame_type| { + cut(flat_map( + pair(parse_id, parse_long_uint), + move |(channel_id, size)| { + map( + pair(take(size), tag(&[constants::FRAME_END][..])), + move |(payload, _)| AMQPRawFrame { + frame_type, + channel_id, + payload, + }, + ) + }, + )) + }), )(i) } From 153ac395556c725723fe97c43d82c5c612e8b12e Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Fri, 22 May 2020 07:46:13 +0200 Subject: [PATCH 007/133] parse frame: reorder Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- protocol/src/frame/parsing.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol/src/frame/parsing.rs b/protocol/src/frame/parsing.rs index f1d102d2..3166193e 100644 --- a/protocol/src/frame/parsing.rs +++ b/protocol/src/frame/parsing.rs @@ -59,6 +59,7 @@ pub fn parse_frame<I: ParsableInput>(i: I) -> ParserResult<I, AMQPFrame> { context( "parse_frame", alt(( + map(parse_protocol_header, AMQPFrame::ProtocolHeader), map_res( parse_raw_frame, |AMQPRawFrame { @@ -77,7 +78,6 @@ pub fn parse_frame<I: ParsableInput>(i: I) -> ParserResult<I, AMQPFrame> { AMQPFrameType::Heartbeat => Ok(AMQPFrame::Heartbeat(channel_id)), }, ), - map(parse_protocol_header, AMQPFrame::ProtocolHeader), )), )(i) } From 59d8b62475e049363494ac6fb6e30c0d4287690f Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Fri, 22 May 2020 08:09:32 +0200 Subject: [PATCH 008/133] v6.0.0-rc7 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/Cargo.toml | 4 ++-- codegen/src/lib.rs | 2 +- protocol/Cargo.toml | 10 +++++----- protocol/src/lib.rs | 2 +- tcp/Cargo.toml | 4 ++-- tcp/src/lib.rs | 2 +- types/Cargo.toml | 2 +- types/src/lib.rs | 2 +- uri/Cargo.toml | 2 +- uri/src/lib.rs | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 4f84f19b..fc5c2b7d 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "6.0.0-rc6" # remember to update html_root_url +version = "6.0.0-rc7" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" @@ -18,7 +18,7 @@ handlebars = "^3.0" serde_json = "^1.0" [dependencies.amq-protocol-types] -version = "=6.0.0-rc6" +version = "=6.0.0-rc7" path = "../types" [dependencies.serde] diff --git a/codegen/src/lib.rs b/codegen/src/lib.rs index 8d747bef..92881461 100644 --- a/codegen/src/lib.rs +++ b/codegen/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/6.0.0-rc6/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/6.0.0-rc7/")] //! # AMQP code generation utilities //! diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index 7293ad0c..8816ce9e 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "6.0.0-rc6" # remember to update html_root_url +version = "6.0.0-rc7" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" @@ -25,20 +25,20 @@ vendored-openssl = ["amq-protocol-tcp/vendored-openssl"] verbose-errors = ["amq-protocol-types/verbose-errors"] [build-dependencies.amq-protocol-codegen] -version = "=6.0.0-rc6" +version = "=6.0.0-rc7" path = "../codegen" [dependencies.amq-protocol-tcp] -version = "=6.0.0-rc6" +version = "=6.0.0-rc7" default-features = false path = "../tcp" [dependencies.amq-protocol-types] -version = "=6.0.0-rc6" +version = "=6.0.0-rc7" path = "../types" [dependencies.amq-protocol-uri] -version = "=6.0.0-rc6" +version = "=6.0.0-rc7" path = "../uri" [dependencies.cookie-factory] diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs index 7f6ea7ac..0f8c78b7 100644 --- a/protocol/src/lib.rs +++ b/protocol/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol/6.0.0-rc6/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol/6.0.0-rc7/")] //! # AMQP manipulation library //! diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index b0c8ee18..57f2de6f 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "6.0.0-rc6" # remember to update html_root_url +version = "6.0.0-rc7" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" @@ -27,7 +27,7 @@ vendored-openssl = ["tcp-stream/vendored-openssl"] log = "^0.4" [dependencies.amq-protocol-uri] -version = "=6.0.0-rc6" +version = "=6.0.0-rc7" path = "../uri" [dependencies.tcp-stream] diff --git a/tcp/src/lib.rs b/tcp/src/lib.rs index 583a22a2..ea80b864 100644 --- a/tcp/src/lib.rs +++ b/tcp/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/6.0.0-rc6/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/6.0.0-rc7/")] //! # AMQP URI TCP connection handling //! diff --git a/types/Cargo.toml b/types/Cargo.toml index 222f524b..f875af87 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "6.0.0-rc6" # remember to update html_root_url +version = "6.0.0-rc7" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/types/src/lib.rs b/types/src/lib.rs index 01f156e6..681e96a6 100644 --- a/types/src/lib.rs +++ b/types/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-types/6.0.0-rc6/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-types/6.0.0-rc7/")] //! # AMQP types manipulation library //! diff --git a/uri/Cargo.toml b/uri/Cargo.toml index 62d64966..b57c94f8 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "6.0.0-rc6" # remember to update html_root_url +version = "6.0.0-rc7" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" diff --git a/uri/src/lib.rs b/uri/src/lib.rs index 5ddfee03..7dcfe199 100644 --- a/uri/src/lib.rs +++ b/uri/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/6.0.0-rc6/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/6.0.0-rc7/")] //! # AMQP URI manipulation library //! From 0a5e5965bc154d93b1881b4a3ae7f8b1624ba0d0 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Fri, 22 May 2020 10:21:20 +0200 Subject: [PATCH 009/133] rework protocol header parsing Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- protocol/src/frame/parsing.rs | 71 +++++++++++++++++++---------------- protocol/src/frame/structs.rs | 2 + 2 files changed, 41 insertions(+), 32 deletions(-) diff --git a/protocol/src/frame/parsing.rs b/protocol/src/frame/parsing.rs index 3166193e..f5e692d5 100644 --- a/protocol/src/frame/parsing.rs +++ b/protocol/src/frame/parsing.rs @@ -6,9 +6,8 @@ use crate::{ types::parsing::*, }; use nom::{ - branch::alt, bytes::streaming::{tag, take}, - combinator::{all_consuming, cut, flat_map, map, map_opt, map_res}, + combinator::{all_consuming, flat_map, map, map_opt, map_res}, error::context, sequence::{pair, tuple}, }; @@ -25,7 +24,7 @@ pub fn parse_protocol_header<I: ParsableInput>(i: I) -> ParserResult<I, Protocol "parse_protocol_header", map( tuple(( - tag(metadata::NAME.as_bytes()), + tag(&metadata::NAME.as_bytes()[1..]), tag(&[0][..]), parse_short_short_uint, parse_short_short_uint, @@ -45,6 +44,7 @@ pub fn parse_frame_type<I: ParsableInput>(i: I) -> ParserResult<I, AMQPFrameType context( "parse_frame_type", map_opt(parse_short_short_uint, |method| match method { + c if c == metadata::NAME.as_bytes()[0] => Some(AMQPFrameType::ProtocolHeader), constants::FRAME_METHOD => Some(AMQPFrameType::Method), constants::FRAME_HEADER => Some(AMQPFrameType::Header), constants::FRAME_BODY => Some(AMQPFrameType::Body), @@ -58,36 +58,43 @@ pub fn parse_frame_type<I: ParsableInput>(i: I) -> ParserResult<I, AMQPFrameType pub fn parse_frame<I: ParsableInput>(i: I) -> ParserResult<I, AMQPFrame> { context( "parse_frame", - alt(( - map(parse_protocol_header, AMQPFrame::ProtocolHeader), - map_res( - parse_raw_frame, - |AMQPRawFrame { - channel_id, - frame_type, - payload, - }: AMQPRawFrame<I>| match frame_type { - AMQPFrameType::Method => all_consuming(parse_class)(payload) - .map(|(_, m)| AMQPFrame::Method(channel_id, m)), - AMQPFrameType::Header => all_consuming(parse_content_header)(payload) - .map(|(_, h)| AMQPFrame::Header(channel_id, h.class_id, Box::new(h))), - AMQPFrameType::Body => Ok(AMQPFrame::Body( - channel_id, - payload.iter_elements().collect(), - )), - AMQPFrameType::Heartbeat => Ok(AMQPFrame::Heartbeat(channel_id)), - }, - ), - )), + flat_map(parse_frame_type, move |frame_type| { + move |i: I| match frame_type { + AMQPFrameType::ProtocolHeader => { + map(parse_protocol_header, AMQPFrame::ProtocolHeader)(i) + } + frame_type => map_res( + parse_raw_frame(frame_type), + |AMQPRawFrame { + channel_id, + frame_type, + payload, + }: AMQPRawFrame<I>| match frame_type { + AMQPFrameType::Method => all_consuming(parse_class)(payload) + .map(|(_, m)| AMQPFrame::Method(channel_id, m)), + AMQPFrameType::Header => all_consuming(parse_content_header)(payload) + .map(|(_, h)| AMQPFrame::Header(channel_id, h.class_id, Box::new(h))), + AMQPFrameType::Body => Ok(AMQPFrame::Body( + channel_id, + payload.iter_elements().collect(), + )), + AMQPFrameType::Heartbeat => Ok(AMQPFrame::Heartbeat(channel_id)), + _ => Ok(AMQPFrame::Heartbeat(0)), // FIXME + }, + )(i), + } + }), )(i) } /// Parse a raw AMQP frame -pub fn parse_raw_frame<I: ParsableInput>(i: I) -> ParserResult<I, AMQPRawFrame<I>> { - context( - "parse_raw_frame", - flat_map(parse_frame_type, move |frame_type| { - cut(flat_map( +pub fn parse_raw_frame<I: ParsableInput>( + frame_type: AMQPFrameType, +) -> impl FnMut(I) -> ParserResult<I, AMQPRawFrame<I>> { + move |i: I| { + context( + "parse_raw_frame", + flat_map( pair(parse_id, parse_long_uint), move |(channel_id, size)| { map( @@ -99,9 +106,9 @@ pub fn parse_raw_frame<I: ParsableInput>(i: I) -> ParserResult<I, AMQPRawFrame<I }, ) }, - )) - }), - )(i) + ), + )(i) + } } /// Parse a content header frame diff --git a/protocol/src/frame/structs.rs b/protocol/src/frame/structs.rs index 2ca09269..47b48d3a 100644 --- a/protocol/src/frame/structs.rs +++ b/protocol/src/frame/structs.rs @@ -32,6 +32,8 @@ impl From<ShortUInt> for AMQPChannel { /// The type of AMQP Frame #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum AMQPFrameType { + /// The Protocol Header, + ProtocolHeader, /// Call a method Method, /// Content header From b3051e87d6575f38e04d6d7b5e094f18377e60c9 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Fri, 22 May 2020 10:29:26 +0200 Subject: [PATCH 010/133] v6.0.0-rc8 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/Cargo.toml | 4 ++-- codegen/src/lib.rs | 2 +- protocol/Cargo.toml | 10 +++++----- protocol/src/lib.rs | 2 +- tcp/Cargo.toml | 4 ++-- tcp/src/lib.rs | 2 +- types/Cargo.toml | 2 +- types/src/lib.rs | 2 +- uri/Cargo.toml | 2 +- uri/src/lib.rs | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index fc5c2b7d..482b33d1 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "6.0.0-rc7" # remember to update html_root_url +version = "6.0.0-rc8" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" @@ -18,7 +18,7 @@ handlebars = "^3.0" serde_json = "^1.0" [dependencies.amq-protocol-types] -version = "=6.0.0-rc7" +version = "=6.0.0-rc8" path = "../types" [dependencies.serde] diff --git a/codegen/src/lib.rs b/codegen/src/lib.rs index 92881461..03023979 100644 --- a/codegen/src/lib.rs +++ b/codegen/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/6.0.0-rc7/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/6.0.0-rc8/")] //! # AMQP code generation utilities //! diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index 8816ce9e..9799a78f 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "6.0.0-rc7" # remember to update html_root_url +version = "6.0.0-rc8" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" @@ -25,20 +25,20 @@ vendored-openssl = ["amq-protocol-tcp/vendored-openssl"] verbose-errors = ["amq-protocol-types/verbose-errors"] [build-dependencies.amq-protocol-codegen] -version = "=6.0.0-rc7" +version = "=6.0.0-rc8" path = "../codegen" [dependencies.amq-protocol-tcp] -version = "=6.0.0-rc7" +version = "=6.0.0-rc8" default-features = false path = "../tcp" [dependencies.amq-protocol-types] -version = "=6.0.0-rc7" +version = "=6.0.0-rc8" path = "../types" [dependencies.amq-protocol-uri] -version = "=6.0.0-rc7" +version = "=6.0.0-rc8" path = "../uri" [dependencies.cookie-factory] diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs index 0f8c78b7..b8abc1b6 100644 --- a/protocol/src/lib.rs +++ b/protocol/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol/6.0.0-rc7/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol/6.0.0-rc8/")] //! # AMQP manipulation library //! diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index 57f2de6f..30a45bef 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "6.0.0-rc7" # remember to update html_root_url +version = "6.0.0-rc8" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" @@ -27,7 +27,7 @@ vendored-openssl = ["tcp-stream/vendored-openssl"] log = "^0.4" [dependencies.amq-protocol-uri] -version = "=6.0.0-rc7" +version = "=6.0.0-rc8" path = "../uri" [dependencies.tcp-stream] diff --git a/tcp/src/lib.rs b/tcp/src/lib.rs index ea80b864..fb2ebbcf 100644 --- a/tcp/src/lib.rs +++ b/tcp/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/6.0.0-rc7/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/6.0.0-rc8/")] //! # AMQP URI TCP connection handling //! diff --git a/types/Cargo.toml b/types/Cargo.toml index f875af87..e6da1035 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "6.0.0-rc7" # remember to update html_root_url +version = "6.0.0-rc8" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/types/src/lib.rs b/types/src/lib.rs index 681e96a6..8a5db3a1 100644 --- a/types/src/lib.rs +++ b/types/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-types/6.0.0-rc7/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-types/6.0.0-rc8/")] //! # AMQP types manipulation library //! diff --git a/uri/Cargo.toml b/uri/Cargo.toml index b57c94f8..454e7ac6 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "6.0.0-rc7" # remember to update html_root_url +version = "6.0.0-rc8" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" diff --git a/uri/src/lib.rs b/uri/src/lib.rs index 7dcfe199..13595900 100644 --- a/uri/src/lib.rs +++ b/uri/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/6.0.0-rc7/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/6.0.0-rc8/")] //! # AMQP URI manipulation library //! From 2a3fb374cb4b81953d0fda1f81798b54c15b6aed Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Fri, 22 May 2020 22:31:27 +0200 Subject: [PATCH 011/133] codegen: add incude_more helper Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/src/templating.rs | 47 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/codegen/src/templating.rs b/codegen/src/templating.rs index 642a7b90..bc5ab872 100644 --- a/codegen/src/templating.rs +++ b/codegen/src/templating.rs @@ -7,7 +7,12 @@ use handlebars::{ }; use serde_json::{self, Value}; -use std::{collections::HashMap, fs::File, io::Write, path::Path}; +use std::{ + collections::HashMap, + fs::{self, File}, + io::Write, + path::Path, +}; /// Type alias to avoid making our users explicitly depend on an extra dependency pub type CodeGenerator<'a> = Handlebars<'a>; @@ -47,6 +52,7 @@ impl<'a> HandlebarsAMQPExtension for CodeGenerator<'a> { self.register_helper("snake", Box::new(SnakeHelper)); self.register_helper("snake_type", Box::new(SnakeTypeHelper)); self.register_helper("sanitize_name", Box::new(SanitizeNameHelper)); + self.register_helper("include_more", Box::new(IncludeMoreHelper)); self.register_helper("pass_by_ref", Box::new(PassByRefHelper)); self.register_helper("use_str_ref", Box::new(UseStrRefHelper)); self.register_helper("each_argument", Box::new(EachArgumentHelper)); @@ -186,6 +192,45 @@ impl HelperDef for SanitizeNameHelper { } } +/// Helper to include additional code such as rustdoc +pub struct IncludeMoreHelper; +impl HelperDef for IncludeMoreHelper { + fn call<'reg: 'rc, 'rc>( + &self, + h: &Helper<'reg, 'rc>, + _: &'reg Handlebars<'_>, + _: &'rc Context, + _: &mut RenderContext<'reg, 'rc>, + out: &mut dyn Output, + ) -> HelperResult { + let amqp_class = h + .param(0) + .ok_or_else(|| RenderError::new("Param not found for helper \"include_more\""))?; + let amqp_method = h + .param(1) + .ok_or_else(|| RenderError::new("Param not found for helper \"include_more\""))?; + let amqp_class = amqp_class + .value() + .as_str() + .ok_or_else(|| RenderError::new("Non-string param given to helper \"include_more\""))?; + let amqp_method = amqp_method + .value() + .as_str() + .ok_or_else(|| RenderError::new("Non-string param given to helper \"include_more\""))?; + if let Ok(cargo_manifest_dir) = std::env::var("CARGO_MANIFEST_DIR") { + let include = Path::new(&cargo_manifest_dir) + .join("templates") + .join("includes") + .join(amqp_class) + .join(format!("{}.rs", amqp_method)); + if let Ok(include) = fs::read_to_string(include) { + out.write(&include)?; + } + } + Ok(()) + } +} + /// Helper to check whether a param is passed by ref or not pub struct PassByRefHelper; impl HelperDef for PassByRefHelper { From b865651597949ce29cea327367b1a831bd82ed9f Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Fri, 22 May 2020 22:34:03 +0200 Subject: [PATCH 012/133] frame parsing: fix Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- protocol/src/frame/parsing.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/protocol/src/frame/parsing.rs b/protocol/src/frame/parsing.rs index f5e692d5..d1852434 100644 --- a/protocol/src/frame/parsing.rs +++ b/protocol/src/frame/parsing.rs @@ -70,6 +70,10 @@ pub fn parse_frame<I: ParsableInput>(i: I) -> ParserResult<I, AMQPFrame> { frame_type, payload, }: AMQPRawFrame<I>| match frame_type { + // This should be unreachable be better have a sensitive value anyways + AMQPFrameType::ProtocolHeader => { + Ok(AMQPFrame::ProtocolHeader(ProtocolVersion::amqp_0_9_1())) + } AMQPFrameType::Method => all_consuming(parse_class)(payload) .map(|(_, m)| AMQPFrame::Method(channel_id, m)), AMQPFrameType::Header => all_consuming(parse_content_header)(payload) @@ -79,7 +83,6 @@ pub fn parse_frame<I: ParsableInput>(i: I) -> ParserResult<I, AMQPFrame> { payload.iter_elements().collect(), )), AMQPFrameType::Heartbeat => Ok(AMQPFrame::Heartbeat(channel_id)), - _ => Ok(AMQPFrame::Heartbeat(0)), // FIXME }, )(i), } From b6fd686bc7cab12c615bd8d150e7a27d1509b096 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Fri, 22 May 2020 22:34:45 +0200 Subject: [PATCH 013/133] v6.0.0-rc9 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/Cargo.toml | 4 ++-- codegen/src/lib.rs | 2 +- protocol/Cargo.toml | 10 +++++----- protocol/src/lib.rs | 2 +- tcp/Cargo.toml | 4 ++-- tcp/src/lib.rs | 2 +- types/Cargo.toml | 2 +- types/src/lib.rs | 2 +- uri/Cargo.toml | 2 +- uri/src/lib.rs | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 482b33d1..8e5334c5 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "6.0.0-rc8" # remember to update html_root_url +version = "6.0.0-rc9" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" @@ -18,7 +18,7 @@ handlebars = "^3.0" serde_json = "^1.0" [dependencies.amq-protocol-types] -version = "=6.0.0-rc8" +version = "=6.0.0-rc9" path = "../types" [dependencies.serde] diff --git a/codegen/src/lib.rs b/codegen/src/lib.rs index 03023979..8ab6c236 100644 --- a/codegen/src/lib.rs +++ b/codegen/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/6.0.0-rc8/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/6.0.0-rc9/")] //! # AMQP code generation utilities //! diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index 9799a78f..ba1d1233 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "6.0.0-rc8" # remember to update html_root_url +version = "6.0.0-rc9" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" @@ -25,20 +25,20 @@ vendored-openssl = ["amq-protocol-tcp/vendored-openssl"] verbose-errors = ["amq-protocol-types/verbose-errors"] [build-dependencies.amq-protocol-codegen] -version = "=6.0.0-rc8" +version = "=6.0.0-rc9" path = "../codegen" [dependencies.amq-protocol-tcp] -version = "=6.0.0-rc8" +version = "=6.0.0-rc9" default-features = false path = "../tcp" [dependencies.amq-protocol-types] -version = "=6.0.0-rc8" +version = "=6.0.0-rc9" path = "../types" [dependencies.amq-protocol-uri] -version = "=6.0.0-rc8" +version = "=6.0.0-rc9" path = "../uri" [dependencies.cookie-factory] diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs index b8abc1b6..4dbda1f3 100644 --- a/protocol/src/lib.rs +++ b/protocol/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol/6.0.0-rc8/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol/6.0.0-rc9/")] //! # AMQP manipulation library //! diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index 30a45bef..db86b426 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "6.0.0-rc8" # remember to update html_root_url +version = "6.0.0-rc9" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" @@ -27,7 +27,7 @@ vendored-openssl = ["tcp-stream/vendored-openssl"] log = "^0.4" [dependencies.amq-protocol-uri] -version = "=6.0.0-rc8" +version = "=6.0.0-rc9" path = "../uri" [dependencies.tcp-stream] diff --git a/tcp/src/lib.rs b/tcp/src/lib.rs index fb2ebbcf..7eb55c6b 100644 --- a/tcp/src/lib.rs +++ b/tcp/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/6.0.0-rc8/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/6.0.0-rc9/")] //! # AMQP URI TCP connection handling //! diff --git a/types/Cargo.toml b/types/Cargo.toml index e6da1035..0868ef3f 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "6.0.0-rc8" # remember to update html_root_url +version = "6.0.0-rc9" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/types/src/lib.rs b/types/src/lib.rs index 8a5db3a1..d71283f0 100644 --- a/types/src/lib.rs +++ b/types/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-types/6.0.0-rc8/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-types/6.0.0-rc9/")] //! # AMQP types manipulation library //! diff --git a/uri/Cargo.toml b/uri/Cargo.toml index 454e7ac6..08e4b181 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "6.0.0-rc8" # remember to update html_root_url +version = "6.0.0-rc9" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" diff --git a/uri/src/lib.rs b/uri/src/lib.rs index 13595900..1023df65 100644 --- a/uri/src/lib.rs +++ b/uri/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/6.0.0-rc8/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/6.0.0-rc9/")] //! # AMQP URI manipulation library //! From a8499eb5a5adbfd8825b4de780f7cb75c164da8a Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Wed, 3 Jun 2020 10:39:02 +0200 Subject: [PATCH 014/133] tcp: update tcp-stream Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- tcp/Cargo.toml | 2 +- tcp/src/lib.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index db86b426..d04a4fde 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -31,7 +31,7 @@ version = "=6.0.0-rc9" path = "../uri" [dependencies.tcp-stream] -version = "^0.19" +version = "^0.19.2" default-features = false [badges] diff --git a/tcp/src/lib.rs b/tcp/src/lib.rs index 7eb55c6b..0d5cf4d9 100644 --- a/tcp/src/lib.rs +++ b/tcp/src/lib.rs @@ -17,7 +17,8 @@ use std::{ /// Re-export TcpStream pub use tcp_stream::{ - HandshakeError, HandshakeResult, Identity, MidHandshakeTlsStream, TLSConfig, TcpStream, + HandshakeError, HandshakeResult, Identity, MidHandshakeTlsStream, OwnedIdentity, + OwnedTLSConfig, TLSConfig, TcpStream, }; #[cfg(feature = "native-tls")] From a0cdf339f8066a168b39240afebee37aca4a9fef Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Wed, 3 Jun 2020 10:42:24 +0200 Subject: [PATCH 015/133] v6.0.0-rc10 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/Cargo.toml | 4 ++-- codegen/src/lib.rs | 2 +- protocol/Cargo.toml | 10 +++++----- protocol/src/lib.rs | 2 +- tcp/Cargo.toml | 4 ++-- tcp/src/lib.rs | 2 +- types/Cargo.toml | 2 +- types/src/lib.rs | 2 +- uri/Cargo.toml | 2 +- uri/src/lib.rs | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 8e5334c5..59dec5d3 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "6.0.0-rc9" # remember to update html_root_url +version = "6.0.0-rc10" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" @@ -18,7 +18,7 @@ handlebars = "^3.0" serde_json = "^1.0" [dependencies.amq-protocol-types] -version = "=6.0.0-rc9" +version = "=6.0.0-rc10" path = "../types" [dependencies.serde] diff --git a/codegen/src/lib.rs b/codegen/src/lib.rs index 8ab6c236..fa0c05aa 100644 --- a/codegen/src/lib.rs +++ b/codegen/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/6.0.0-rc9/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/6.0.0-rc10/")] //! # AMQP code generation utilities //! diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index ba1d1233..bb18a0ac 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "6.0.0-rc9" # remember to update html_root_url +version = "6.0.0-rc10" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" @@ -25,20 +25,20 @@ vendored-openssl = ["amq-protocol-tcp/vendored-openssl"] verbose-errors = ["amq-protocol-types/verbose-errors"] [build-dependencies.amq-protocol-codegen] -version = "=6.0.0-rc9" +version = "=6.0.0-rc10" path = "../codegen" [dependencies.amq-protocol-tcp] -version = "=6.0.0-rc9" +version = "=6.0.0-rc10" default-features = false path = "../tcp" [dependencies.amq-protocol-types] -version = "=6.0.0-rc9" +version = "=6.0.0-rc10" path = "../types" [dependencies.amq-protocol-uri] -version = "=6.0.0-rc9" +version = "=6.0.0-rc10" path = "../uri" [dependencies.cookie-factory] diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs index 4dbda1f3..27c247f3 100644 --- a/protocol/src/lib.rs +++ b/protocol/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol/6.0.0-rc9/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol/6.0.0-rc10/")] //! # AMQP manipulation library //! diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index d04a4fde..5884bedb 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "6.0.0-rc9" # remember to update html_root_url +version = "6.0.0-rc10" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" @@ -27,7 +27,7 @@ vendored-openssl = ["tcp-stream/vendored-openssl"] log = "^0.4" [dependencies.amq-protocol-uri] -version = "=6.0.0-rc9" +version = "=6.0.0-rc10" path = "../uri" [dependencies.tcp-stream] diff --git a/tcp/src/lib.rs b/tcp/src/lib.rs index 0d5cf4d9..497bf08d 100644 --- a/tcp/src/lib.rs +++ b/tcp/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/6.0.0-rc9/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/6.0.0-rc10/")] //! # AMQP URI TCP connection handling //! diff --git a/types/Cargo.toml b/types/Cargo.toml index 0868ef3f..ac4375c0 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "6.0.0-rc9" # remember to update html_root_url +version = "6.0.0-rc10" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/types/src/lib.rs b/types/src/lib.rs index d71283f0..d385c1b7 100644 --- a/types/src/lib.rs +++ b/types/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-types/6.0.0-rc9/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-types/6.0.0-rc10/")] //! # AMQP types manipulation library //! diff --git a/uri/Cargo.toml b/uri/Cargo.toml index 08e4b181..8fb16346 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "6.0.0-rc9" # remember to update html_root_url +version = "6.0.0-rc10" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" diff --git a/uri/src/lib.rs b/uri/src/lib.rs index 1023df65..57d32bb8 100644 --- a/uri/src/lib.rs +++ b/uri/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/6.0.0-rc9/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/6.0.0-rc10/")] //! # AMQP URI manipulation library //! From b3491104b4bc0cfc75402d3ab61cc914dccd7f0e Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Tue, 9 Jun 2020 11:01:07 +0200 Subject: [PATCH 016/133] codegen: better error message Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/src/templating.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codegen/src/templating.rs b/codegen/src/templating.rs index bc5ab872..03936cfb 100644 --- a/codegen/src/templating.rs +++ b/codegen/src/templating.rs @@ -69,8 +69,8 @@ impl<'a> HandlebarsAMQPExtension for CodeGenerator<'a> { metadata: Option<Value>, ) { let dest_path = Path::new(out_dir).join(format!("{}.rs", target)); - let mut f = - File::create(&dest_path).unwrap_or_else(|_| panic!("Failed to create {}.rs", target)); + let mut f = File::create(&dest_path) + .unwrap_or_else(|err| panic!("Failed to create {:?}: {}", dest_path, err)); let specs = AMQProtocolDefinition::load(metadata); let mut codegen = CodeGenerator::default().register_amqp_helpers(); let mut data = HashMap::new(); From 1c0f8ef3eb4262fe6b7cebd22f52c9001c9f146e Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Tue, 9 Jun 2020 11:08:35 +0200 Subject: [PATCH 017/133] tcp: update tcp-stream Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- tcp/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index 5884bedb..97571fa5 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -31,7 +31,7 @@ version = "=6.0.0-rc10" path = "../uri" [dependencies.tcp-stream] -version = "^0.19.2" +version = "^0.19.3" default-features = false [badges] From 169186580445537b740cd997b67f9afc211609eb Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Tue, 9 Jun 2020 11:01:58 +0200 Subject: [PATCH 018/133] protocol: make code generation optional Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- protocol/Cargo.toml | 7 +- protocol/build.rs | 21 +- protocol/src/generated.rs | 4465 +++++++++++++++++++++++++++++++++++++ protocol/src/protocol.rs | 3 + regen-code.sh | 11 + 5 files changed, 4500 insertions(+), 7 deletions(-) create mode 100644 protocol/src/generated.rs create mode 100755 regen-code.sh diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index bb18a0ac..688eb4e4 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -16,6 +16,8 @@ name = "amq_protocol" [features] default = ["native-tls"] +codegen = ["codegen-internal"] +codegen-internal = ["amq-protocol-codegen"] native-tls = ["amq-protocol-tcp/native-tls"] openssl = ["amq-protocol-tcp/openssl"] rustls = ["amq-protocol-tcp/rustls"] @@ -25,8 +27,9 @@ vendored-openssl = ["amq-protocol-tcp/vendored-openssl"] verbose-errors = ["amq-protocol-types/verbose-errors"] [build-dependencies.amq-protocol-codegen] -version = "=6.0.0-rc10" -path = "../codegen" +version = "=6.0.0-rc10" +path = "../codegen" +optional = true [dependencies.amq-protocol-tcp] version = "=6.0.0-rc10" diff --git a/protocol/build.rs b/protocol/build.rs index d75d7c09..96ec5f15 100644 --- a/protocol/build.rs +++ b/protocol/build.rs @@ -1,13 +1,24 @@ -use amq_protocol_codegen::{CodeGenerator, HandlebarsAMQPExtension}; +fn main() { + println!("cargo:rerun-if-env-changed=AMQ_PROTOCOL_CODEGEN_DIR"); + println!("cargo:rerun-if-env-changed=AMQ_PROTOCOL_CODEGEN_FILE"); + + #[cfg(feature = "codegen")] + codegen() +} -use std::env; +#[cfg(feature = "codegen")] +fn codegen() { + use amq_protocol_codegen::{CodeGenerator, HandlebarsAMQPExtension}; -fn main() { - let out_dir = env::var("OUT_DIR").expect("OUT_DIR is not defined"); + let out_dir = std::env::var("AMQ_PROTOCOL_CODEGEN_DIR") + .or(std::env::var("OUT_DIR")) + .expect("OUT_DIR is not defined"); + let out_file = + std::env::var("AMQ_PROTOCOL_CODEGEN_FILE").unwrap_or_else(|_| "protocol".to_string()); let template = include_str!(concat!( env!("CARGO_MANIFEST_DIR"), "/templates/protocol.rs" )); - CodeGenerator::simple_codegen(&out_dir, "protocol", "protocol", template, "protocol"); + CodeGenerator::simple_codegen(&out_dir, &out_file, "protocol", template, "protocol"); } diff --git a/protocol/src/generated.rs b/protocol/src/generated.rs new file mode 100644 index 00000000..21806328 --- /dev/null +++ b/protocol/src/generated.rs @@ -0,0 +1,4465 @@ +/// Protocol metadata +pub mod metadata { + use super::*; + + /// The name of the protocol + pub const NAME: &str = "AMQP"; + /// The major version of the protocol + pub const MAJOR_VERSION: ShortShortUInt = 0; + /// The minor version of the protocol + pub const MINOR_VERSION: ShortShortUInt = 9; + /// The revision (version) of the protocol + pub const REVISION: ShortShortUInt = 1; + /// The default port of the protocol + pub const PORT: LongUInt = 5672; + /// The copyright holding the protocol + pub const COPYRIGHT: &str = r#"Copyright (C) 2008-2020 VMware, Inc. or its affiliates. + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this file (the "Software"), to deal in the +Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, +sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Class information entered from amqp_xml0-8.pdf and domain types from amqp-xml-doc0-9.pdf +Updated for 0-9-1 by Tony Garnock-Jones + +b3cb053f15e7b98808c0ccc67f23cb3e amqp_xml0-8.pdf +http://twiststandards.org/?option=com_docman&task=cat_view&gid=28&Itemid=90 +8444db91e2949dbecfb2585e9eef6d64 amqp-xml-doc0-9.pdf +https://jira.amqp.org/confluence/download/attachments/720900/amqp-xml-doc0-9.pdf?version=1 +"#; +} + +/// Protocol constants +pub mod constants { + use super::*; + + /// FRAME-METHOD (Generated) + pub const FRAME_METHOD: ShortShortUInt = 1; + /// FRAME-HEADER (Generated) + pub const FRAME_HEADER: ShortShortUInt = 2; + /// FRAME-BODY (Generated) + pub const FRAME_BODY: ShortShortUInt = 3; + /// FRAME-HEARTBEAT (Generated) + pub const FRAME_HEARTBEAT: ShortShortUInt = 8; + /// FRAME-MIN-SIZE (Generated) + pub const FRAME_MIN_SIZE: ShortUInt = 4096; + /// FRAME-END (Generated) + pub const FRAME_END: ShortShortUInt = 206; + /// REPLY-SUCCESS (Generated) + pub const REPLY_SUCCESS: ShortShortUInt = 200; +} + +/// The available soft AMQP errors +#[derive(Clone, Debug, PartialEq)] +pub enum AMQPSoftError { + /// CONTENT-TOO-LARGE (Generated) + CONTENTTOOLARGE, + /// NO-ROUTE (Generated) + NOROUTE, + /// NO-CONSUMERS (Generated) + NOCONSUMERS, + /// ACCESS-REFUSED (Generated) + ACCESSREFUSED, + /// NOT-FOUND (Generated) + NOTFOUND, + /// RESOURCE-LOCKED (Generated) + RESOURCELOCKED, + /// PRECONDITION-FAILED (Generated) + PRECONDITIONFAILED, +} + +impl AMQPSoftError { + /// Get the id of the soft error + pub fn get_id(&self) -> ShortUInt { + match *self { + AMQPSoftError::CONTENTTOOLARGE => 311, + AMQPSoftError::NOROUTE => 312, + AMQPSoftError::NOCONSUMERS => 313, + AMQPSoftError::ACCESSREFUSED => 403, + AMQPSoftError::NOTFOUND => 404, + AMQPSoftError::RESOURCELOCKED => 405, + AMQPSoftError::PRECONDITIONFAILED => 406, + } + } + + /// Get the soft error corresponding to an id + pub fn from_id(id: ShortUInt) -> Option<AMQPSoftError> { + match id { + 311 => Some(AMQPSoftError::CONTENTTOOLARGE), + 312 => Some(AMQPSoftError::NOROUTE), + 313 => Some(AMQPSoftError::NOCONSUMERS), + 403 => Some(AMQPSoftError::ACCESSREFUSED), + 404 => Some(AMQPSoftError::NOTFOUND), + 405 => Some(AMQPSoftError::RESOURCELOCKED), + 406 => Some(AMQPSoftError::PRECONDITIONFAILED), + _ => None, + } + } +} + +impl fmt::Display for AMQPSoftError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + AMQPSoftError::CONTENTTOOLARGE => write!(f, "CONTENT-TOO-LARGE"), + AMQPSoftError::NOROUTE => write!(f, "NO-ROUTE"), + AMQPSoftError::NOCONSUMERS => write!(f, "NO-CONSUMERS"), + AMQPSoftError::ACCESSREFUSED => write!(f, "ACCESS-REFUSED"), + AMQPSoftError::NOTFOUND => write!(f, "NOT-FOUND"), + AMQPSoftError::RESOURCELOCKED => write!(f, "RESOURCE-LOCKED"), + AMQPSoftError::PRECONDITIONFAILED => write!(f, "PRECONDITION-FAILED"), + } + } +} + +/// The available hard AMQP errors +#[derive(Clone, Debug, PartialEq)] +pub enum AMQPHardError { + /// CONNECTION-FORCED (Generated) + CONNECTIONFORCED, + /// INVALID-PATH (Generated) + INVALIDPATH, + /// FRAME-ERROR (Generated) + FRAMEERROR, + /// SYNTAX-ERROR (Generated) + SYNTAXERROR, + /// COMMAND-INVALID (Generated) + COMMANDINVALID, + /// CHANNEL-ERROR (Generated) + CHANNELERROR, + /// UNEXPECTED-FRAME (Generated) + UNEXPECTEDFRAME, + /// RESOURCE-ERROR (Generated) + RESOURCEERROR, + /// NOT-ALLOWED (Generated) + NOTALLOWED, + /// NOT-IMPLEMENTED (Generated) + NOTIMPLEMENTED, + /// INTERNAL-ERROR (Generated) + INTERNALERROR, +} + +impl AMQPHardError { + /// Get the id of the hard error + pub fn get_id(&self) -> ShortUInt { + match *self { + AMQPHardError::CONNECTIONFORCED => 320, + AMQPHardError::INVALIDPATH => 402, + AMQPHardError::FRAMEERROR => 501, + AMQPHardError::SYNTAXERROR => 502, + AMQPHardError::COMMANDINVALID => 503, + AMQPHardError::CHANNELERROR => 504, + AMQPHardError::UNEXPECTEDFRAME => 505, + AMQPHardError::RESOURCEERROR => 506, + AMQPHardError::NOTALLOWED => 530, + AMQPHardError::NOTIMPLEMENTED => 540, + AMQPHardError::INTERNALERROR => 541, + } + } + + /// Get the hard error corresponding to an id + pub fn from_id(id: ShortUInt) -> Option<AMQPHardError> { + match id { + 320 => Some(AMQPHardError::CONNECTIONFORCED), + 402 => Some(AMQPHardError::INVALIDPATH), + 501 => Some(AMQPHardError::FRAMEERROR), + 502 => Some(AMQPHardError::SYNTAXERROR), + 503 => Some(AMQPHardError::COMMANDINVALID), + 504 => Some(AMQPHardError::CHANNELERROR), + 505 => Some(AMQPHardError::UNEXPECTEDFRAME), + 506 => Some(AMQPHardError::RESOURCEERROR), + 530 => Some(AMQPHardError::NOTALLOWED), + 540 => Some(AMQPHardError::NOTIMPLEMENTED), + 541 => Some(AMQPHardError::INTERNALERROR), + _ => None, + } + } +} + +impl fmt::Display for AMQPHardError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + AMQPHardError::CONNECTIONFORCED => write!(f, "CONNECTION-FORCED"), + AMQPHardError::INVALIDPATH => write!(f, "INVALID-PATH"), + AMQPHardError::FRAMEERROR => write!(f, "FRAME-ERROR"), + AMQPHardError::SYNTAXERROR => write!(f, "SYNTAX-ERROR"), + AMQPHardError::COMMANDINVALID => write!(f, "COMMAND-INVALID"), + AMQPHardError::CHANNELERROR => write!(f, "CHANNEL-ERROR"), + AMQPHardError::UNEXPECTEDFRAME => write!(f, "UNEXPECTED-FRAME"), + AMQPHardError::RESOURCEERROR => write!(f, "RESOURCE-ERROR"), + AMQPHardError::NOTALLOWED => write!(f, "NOT-ALLOWED"), + AMQPHardError::NOTIMPLEMENTED => write!(f, "NOT-IMPLEMENTED"), + AMQPHardError::INTERNALERROR => write!(f, "INTERNAL-ERROR"), + } + } +} + +use self::access::parse_access; +use self::basic::parse_basic; +use self::channel::parse_channel; +use self::confirm::parse_confirm; +use self::connection::parse_connection; +use self::exchange::parse_exchange; +use self::queue::parse_queue; +use self::tx::parse_tx; +/// Parse an AMQP class +pub fn parse_class<I: ParsableInput>(i: I) -> ParserResult<I, AMQPClass> { + context( + "parse_class", + map_opt( + flat_map(parse_id, |id| { + move |i| match id { + 10 => map(map(parse_connection, AMQPClass::Connection), Some)(i), + 20 => map(map(parse_channel, AMQPClass::Channel), Some)(i), + 30 => map(map(parse_access, AMQPClass::Access), Some)(i), + 40 => map(map(parse_exchange, AMQPClass::Exchange), Some)(i), + 50 => map(map(parse_queue, AMQPClass::Queue), Some)(i), + 60 => map(map(parse_basic, AMQPClass::Basic), Some)(i), + 90 => map(map(parse_tx, AMQPClass::Tx), Some)(i), + 85 => map(map(parse_confirm, AMQPClass::Confirm), Some)(i), + _ => Ok((i, None)), + } + }), + std::convert::identity, + ), + )(i) +} + +/// Serialize an AMQP class +pub fn gen_class<'a, W: Write + BackToTheBuffer + 'a>( + class: &'a AMQPClass, +) -> impl SerializeFn<W> + 'a { + move |input| match *class { + AMQPClass::Connection(ref connection) => connection::gen_connection(connection)(input), + AMQPClass::Channel(ref channel) => channel::gen_channel(channel)(input), + AMQPClass::Access(ref access) => access::gen_access(access)(input), + AMQPClass::Exchange(ref exchange) => exchange::gen_exchange(exchange)(input), + AMQPClass::Queue(ref queue) => queue::gen_queue(queue)(input), + AMQPClass::Basic(ref basic) => basic::gen_basic(basic)(input), + AMQPClass::Tx(ref tx) => tx::gen_tx(tx)(input), + AMQPClass::Confirm(ref confirm) => confirm::gen_confirm(confirm)(input), + } +} + +/// The available AMQP classes +#[derive(Clone, Debug, PartialEq)] +pub enum AMQPClass { + /// connection (Generated) + Connection(connection::AMQPMethod), + /// channel (Generated) + Channel(channel::AMQPMethod), + /// access (Generated) + Access(access::AMQPMethod), + /// exchange (Generated) + Exchange(exchange::AMQPMethod), + /// queue (Generated) + Queue(queue::AMQPMethod), + /// basic (Generated) + Basic(basic::AMQPMethod), + /// tx (Generated) + Tx(tx::AMQPMethod), + /// confirm (Generated) + Confirm(confirm::AMQPMethod), +} + +impl AMQPClass { + /// Get the AMQP class id (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + match self { + AMQPClass::Connection(_) => 10, + AMQPClass::Channel(_) => 20, + AMQPClass::Access(_) => 30, + AMQPClass::Exchange(_) => 40, + AMQPClass::Queue(_) => 50, + AMQPClass::Basic(_) => 60, + AMQPClass::Tx(_) => 90, + AMQPClass::Confirm(_) => 85, + } + } + + /// Get the AMQP method id (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + match self { + AMQPClass::Connection(connection::AMQPMethod::Start(_)) => 10, + AMQPClass::Connection(connection::AMQPMethod::StartOk(_)) => 11, + AMQPClass::Connection(connection::AMQPMethod::Secure(_)) => 20, + AMQPClass::Connection(connection::AMQPMethod::SecureOk(_)) => 21, + AMQPClass::Connection(connection::AMQPMethod::Tune(_)) => 30, + AMQPClass::Connection(connection::AMQPMethod::TuneOk(_)) => 31, + AMQPClass::Connection(connection::AMQPMethod::Open(_)) => 40, + AMQPClass::Connection(connection::AMQPMethod::OpenOk(_)) => 41, + AMQPClass::Connection(connection::AMQPMethod::Close(_)) => 50, + AMQPClass::Connection(connection::AMQPMethod::CloseOk(_)) => 51, + AMQPClass::Connection(connection::AMQPMethod::Blocked(_)) => 60, + AMQPClass::Connection(connection::AMQPMethod::Unblocked(_)) => 61, + AMQPClass::Connection(connection::AMQPMethod::UpdateSecret(_)) => 70, + AMQPClass::Connection(connection::AMQPMethod::UpdateSecretOk(_)) => 71, + AMQPClass::Channel(channel::AMQPMethod::Open(_)) => 10, + AMQPClass::Channel(channel::AMQPMethod::OpenOk(_)) => 11, + AMQPClass::Channel(channel::AMQPMethod::Flow(_)) => 20, + AMQPClass::Channel(channel::AMQPMethod::FlowOk(_)) => 21, + AMQPClass::Channel(channel::AMQPMethod::Close(_)) => 40, + AMQPClass::Channel(channel::AMQPMethod::CloseOk(_)) => 41, + AMQPClass::Access(access::AMQPMethod::Request(_)) => 10, + AMQPClass::Access(access::AMQPMethod::RequestOk(_)) => 11, + AMQPClass::Exchange(exchange::AMQPMethod::Declare(_)) => 10, + AMQPClass::Exchange(exchange::AMQPMethod::DeclareOk(_)) => 11, + AMQPClass::Exchange(exchange::AMQPMethod::Delete(_)) => 20, + AMQPClass::Exchange(exchange::AMQPMethod::DeleteOk(_)) => 21, + AMQPClass::Exchange(exchange::AMQPMethod::Bind(_)) => 30, + AMQPClass::Exchange(exchange::AMQPMethod::BindOk(_)) => 31, + AMQPClass::Exchange(exchange::AMQPMethod::Unbind(_)) => 40, + AMQPClass::Exchange(exchange::AMQPMethod::UnbindOk(_)) => 51, + AMQPClass::Queue(queue::AMQPMethod::Declare(_)) => 10, + AMQPClass::Queue(queue::AMQPMethod::DeclareOk(_)) => 11, + AMQPClass::Queue(queue::AMQPMethod::Bind(_)) => 20, + AMQPClass::Queue(queue::AMQPMethod::BindOk(_)) => 21, + AMQPClass::Queue(queue::AMQPMethod::Purge(_)) => 30, + AMQPClass::Queue(queue::AMQPMethod::PurgeOk(_)) => 31, + AMQPClass::Queue(queue::AMQPMethod::Delete(_)) => 40, + AMQPClass::Queue(queue::AMQPMethod::DeleteOk(_)) => 41, + AMQPClass::Queue(queue::AMQPMethod::Unbind(_)) => 50, + AMQPClass::Queue(queue::AMQPMethod::UnbindOk(_)) => 51, + AMQPClass::Basic(basic::AMQPMethod::Qos(_)) => 10, + AMQPClass::Basic(basic::AMQPMethod::QosOk(_)) => 11, + AMQPClass::Basic(basic::AMQPMethod::Consume(_)) => 20, + AMQPClass::Basic(basic::AMQPMethod::ConsumeOk(_)) => 21, + AMQPClass::Basic(basic::AMQPMethod::Cancel(_)) => 30, + AMQPClass::Basic(basic::AMQPMethod::CancelOk(_)) => 31, + AMQPClass::Basic(basic::AMQPMethod::Publish(_)) => 40, + AMQPClass::Basic(basic::AMQPMethod::Return(_)) => 50, + AMQPClass::Basic(basic::AMQPMethod::Deliver(_)) => 60, + AMQPClass::Basic(basic::AMQPMethod::Get(_)) => 70, + AMQPClass::Basic(basic::AMQPMethod::GetOk(_)) => 71, + AMQPClass::Basic(basic::AMQPMethod::GetEmpty(_)) => 72, + AMQPClass::Basic(basic::AMQPMethod::Ack(_)) => 80, + AMQPClass::Basic(basic::AMQPMethod::Reject(_)) => 90, + AMQPClass::Basic(basic::AMQPMethod::RecoverAsync(_)) => 100, + AMQPClass::Basic(basic::AMQPMethod::Recover(_)) => 110, + AMQPClass::Basic(basic::AMQPMethod::RecoverOk(_)) => 111, + AMQPClass::Basic(basic::AMQPMethod::Nack(_)) => 120, + AMQPClass::Tx(tx::AMQPMethod::Select(_)) => 10, + AMQPClass::Tx(tx::AMQPMethod::SelectOk(_)) => 11, + AMQPClass::Tx(tx::AMQPMethod::Commit(_)) => 20, + AMQPClass::Tx(tx::AMQPMethod::CommitOk(_)) => 21, + AMQPClass::Tx(tx::AMQPMethod::Rollback(_)) => 30, + AMQPClass::Tx(tx::AMQPMethod::RollbackOk(_)) => 31, + AMQPClass::Confirm(confirm::AMQPMethod::Select(_)) => 10, + AMQPClass::Confirm(confirm::AMQPMethod::SelectOk(_)) => 11, + } + } +} + +/// connection (generated) +pub mod connection { + use super::*; + + /// Parse connection (Generated) + pub fn parse_connection<I: ParsableInput>(i: I) -> ParserResult<I, connection::AMQPMethod> { + context( + "parse_connection", + map_opt( + flat_map(parse_id, |id| { + move |i| match id { + 10 => context( + "parse_start", + map(map(parse_start, AMQPMethod::Start), Some), + )(i), + 11 => context( + "parse_start_ok", + map(map(parse_start_ok, AMQPMethod::StartOk), Some), + )(i), + 20 => context( + "parse_secure", + map(map(parse_secure, AMQPMethod::Secure), Some), + )(i), + 21 => context( + "parse_secure_ok", + map(map(parse_secure_ok, AMQPMethod::SecureOk), Some), + )(i), + 30 => { + context("parse_tune", map(map(parse_tune, AMQPMethod::Tune), Some))(i) + } + 31 => context( + "parse_tune_ok", + map(map(parse_tune_ok, AMQPMethod::TuneOk), Some), + )(i), + 40 => { + context("parse_open", map(map(parse_open, AMQPMethod::Open), Some))(i) + } + 41 => context( + "parse_open_ok", + map(map(parse_open_ok, AMQPMethod::OpenOk), Some), + )(i), + 50 => context( + "parse_close", + map(map(parse_close, AMQPMethod::Close), Some), + )(i), + 51 => context( + "parse_close_ok", + map(map(parse_close_ok, AMQPMethod::CloseOk), Some), + )(i), + 60 => context( + "parse_blocked", + map(map(parse_blocked, AMQPMethod::Blocked), Some), + )(i), + 61 => context( + "parse_unblocked", + map(map(parse_unblocked, AMQPMethod::Unblocked), Some), + )(i), + 70 => context( + "parse_update_secret", + map(map(parse_update_secret, AMQPMethod::UpdateSecret), Some), + )(i), + 71 => context( + "parse_update_secret_ok", + map( + map(parse_update_secret_ok, AMQPMethod::UpdateSecretOk), + Some, + ), + )(i), + _ => Ok((i, None)), + } + }), + std::convert::identity, + ), + )(i) + } + + /// Serialize connection (Generated) + pub fn gen_connection<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a AMQPMethod, + ) -> impl SerializeFn<W> + 'a { + cookie_factory::sequence::pair(gen_id(10), move |input| match *method { + AMQPMethod::Start(ref start) => gen_start(start)(input), + AMQPMethod::StartOk(ref start_ok) => gen_start_ok(start_ok)(input), + AMQPMethod::Secure(ref secure) => gen_secure(secure)(input), + AMQPMethod::SecureOk(ref secure_ok) => gen_secure_ok(secure_ok)(input), + AMQPMethod::Tune(ref tune) => gen_tune(tune)(input), + AMQPMethod::TuneOk(ref tune_ok) => gen_tune_ok(tune_ok)(input), + AMQPMethod::Open(ref open) => gen_open(open)(input), + AMQPMethod::OpenOk(ref open_ok) => gen_open_ok(open_ok)(input), + AMQPMethod::Close(ref close) => gen_close(close)(input), + AMQPMethod::CloseOk(ref close_ok) => gen_close_ok(close_ok)(input), + AMQPMethod::Blocked(ref blocked) => gen_blocked(blocked)(input), + AMQPMethod::Unblocked(ref unblocked) => gen_unblocked(unblocked)(input), + AMQPMethod::UpdateSecret(ref update_secret) => gen_update_secret(update_secret)(input), + AMQPMethod::UpdateSecretOk(ref update_secret_ok) => { + gen_update_secret_ok(update_secret_ok)(input) + } + }) + } + + /// The available methods in connection + #[derive(Clone, Debug, PartialEq)] + pub enum AMQPMethod { + /// start (Generated) + Start(Start), + /// start-ok (Generated) + StartOk(StartOk), + /// secure (Generated) + Secure(Secure), + /// secure-ok (Generated) + SecureOk(SecureOk), + /// tune (Generated) + Tune(Tune), + /// tune-ok (Generated) + TuneOk(TuneOk), + /// open (Generated) + Open(Open), + /// open-ok (Generated) + OpenOk(OpenOk), + /// close (Generated) + Close(Close), + /// close-ok (Generated) + CloseOk(CloseOk), + /// blocked (Generated) + Blocked(Blocked), + /// unblocked (Generated) + Unblocked(Unblocked), + /// update-secret (Generated) + UpdateSecret(UpdateSecret), + /// update-secret-ok (Generated) + UpdateSecretOk(UpdateSecretOk), + } + + /// start (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Start { + /// version-major (Generated) + pub version_major: ShortShortUInt, + /// version-minor (Generated) + pub version_minor: ShortShortUInt, + /// server-properties (Generated) + pub server_properties: FieldTable, + /// mechanisms (Generated) + pub mechanisms: LongString, + /// locales (Generated) + pub locales: LongString, + } + + impl Start { + /// Get the AMQP class id for start (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 10 + } + + /// Get the AMQP method id for start (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 10 + } + } + + /// Parse start (Generated) + pub fn parse_start<I: ParsableInput>(i: I) -> ParserResult<I, Start> { + let (i, version_major) = parse_short_short_uint(i)?; + let (i, version_minor) = parse_short_short_uint(i)?; + let (i, server_properties) = parse_field_table(i)?; + let (i, mechanisms) = parse_long_string(i)?; + let (i, locales) = parse_long_string(i)?; + Ok(( + i, + Start { + version_major, + version_minor, + server_properties, + mechanisms, + locales, + }, + )) + } + + /// Serialize start (Generated) + pub fn gen_start<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Start, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(10)(input)?; + input = gen_short_short_uint(method.version_major)(input)?; + input = gen_short_short_uint(method.version_minor)(input)?; + input = gen_field_table(&method.server_properties)(input)?; + input = gen_long_string(method.mechanisms.as_str())(input)?; + input = gen_long_string(method.locales.as_str())(input)?; + Ok(input) + } + } + + /// start-ok (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct StartOk { + /// client-properties (Generated) + pub client_properties: FieldTable, + /// mechanism (Generated) + pub mechanism: ShortString, + /// response (Generated) + pub response: LongString, + /// locale (Generated) + pub locale: ShortString, + } + + impl StartOk { + /// Get the AMQP class id for start-ok (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 10 + } + + /// Get the AMQP method id for start-ok (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 11 + } + } + + /// Parse start-ok (Generated) + pub fn parse_start_ok<I: ParsableInput>(i: I) -> ParserResult<I, StartOk> { + let (i, client_properties) = parse_field_table(i)?; + let (i, mechanism) = parse_short_string(i)?; + let (i, response) = parse_long_string(i)?; + let (i, locale) = parse_short_string(i)?; + Ok(( + i, + StartOk { + client_properties, + mechanism, + response, + locale, + }, + )) + } + + /// Serialize start-ok (Generated) + pub fn gen_start_ok<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a StartOk, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(11)(input)?; + input = gen_field_table(&method.client_properties)(input)?; + input = gen_short_string(method.mechanism.as_str())(input)?; + input = gen_long_string(method.response.as_str())(input)?; + input = gen_short_string(method.locale.as_str())(input)?; + Ok(input) + } + } + + /// secure (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Secure { + /// challenge (Generated) + pub challenge: LongString, + } + + impl Secure { + /// Get the AMQP class id for secure (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 10 + } + + /// Get the AMQP method id for secure (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 20 + } + } + + /// Parse secure (Generated) + pub fn parse_secure<I: ParsableInput>(i: I) -> ParserResult<I, Secure> { + let (i, challenge) = parse_long_string(i)?; + Ok((i, Secure { challenge })) + } + + /// Serialize secure (Generated) + pub fn gen_secure<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Secure, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(20)(input)?; + input = gen_long_string(method.challenge.as_str())(input)?; + Ok(input) + } + } + + /// secure-ok (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct SecureOk { + /// response (Generated) + pub response: LongString, + } + + impl SecureOk { + /// Get the AMQP class id for secure-ok (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 10 + } + + /// Get the AMQP method id for secure-ok (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 21 + } + } + + /// Parse secure-ok (Generated) + pub fn parse_secure_ok<I: ParsableInput>(i: I) -> ParserResult<I, SecureOk> { + let (i, response) = parse_long_string(i)?; + Ok((i, SecureOk { response })) + } + + /// Serialize secure-ok (Generated) + pub fn gen_secure_ok<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a SecureOk, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(21)(input)?; + input = gen_long_string(method.response.as_str())(input)?; + Ok(input) + } + } + + /// tune (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Tune { + /// channel-max (Generated) + pub channel_max: ShortUInt, + /// frame-max (Generated) + pub frame_max: LongUInt, + /// heartbeat (Generated) + pub heartbeat: ShortUInt, + } + + impl Tune { + /// Get the AMQP class id for tune (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 10 + } + + /// Get the AMQP method id for tune (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 30 + } + } + + /// Parse tune (Generated) + pub fn parse_tune<I: ParsableInput>(i: I) -> ParserResult<I, Tune> { + let (i, channel_max) = parse_short_uint(i)?; + let (i, frame_max) = parse_long_uint(i)?; + let (i, heartbeat) = parse_short_uint(i)?; + Ok(( + i, + Tune { + channel_max, + frame_max, + heartbeat, + }, + )) + } + + /// Serialize tune (Generated) + pub fn gen_tune<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Tune, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(30)(input)?; + input = gen_short_uint(method.channel_max)(input)?; + input = gen_long_uint(method.frame_max)(input)?; + input = gen_short_uint(method.heartbeat)(input)?; + Ok(input) + } + } + + /// tune-ok (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct TuneOk { + /// channel-max (Generated) + pub channel_max: ShortUInt, + /// frame-max (Generated) + pub frame_max: LongUInt, + /// heartbeat (Generated) + pub heartbeat: ShortUInt, + } + + impl TuneOk { + /// Get the AMQP class id for tune-ok (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 10 + } + + /// Get the AMQP method id for tune-ok (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 31 + } + } + + /// Parse tune-ok (Generated) + pub fn parse_tune_ok<I: ParsableInput>(i: I) -> ParserResult<I, TuneOk> { + let (i, channel_max) = parse_short_uint(i)?; + let (i, frame_max) = parse_long_uint(i)?; + let (i, heartbeat) = parse_short_uint(i)?; + Ok(( + i, + TuneOk { + channel_max, + frame_max, + heartbeat, + }, + )) + } + + /// Serialize tune-ok (Generated) + pub fn gen_tune_ok<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a TuneOk, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(31)(input)?; + input = gen_short_uint(method.channel_max)(input)?; + input = gen_long_uint(method.frame_max)(input)?; + input = gen_short_uint(method.heartbeat)(input)?; + Ok(input) + } + } + + /// open (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Open { + /// virtual-host (Generated) + pub virtual_host: ShortString, + } + + impl Open { + /// Get the AMQP class id for open (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 10 + } + + /// Get the AMQP method id for open (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 40 + } + } + + /// Parse open (Generated) + pub fn parse_open<I: ParsableInput>(i: I) -> ParserResult<I, Open> { + let (i, virtual_host) = parse_short_string(i)?; + let (i, _) = parse_short_string(i)?; + + let (i, _) = parse_flags(i, &["insist"])?; + Ok((i, Open { virtual_host })) + } + + /// Serialize open (Generated) + pub fn gen_open<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Open, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + let mut flags = AMQPFlags::default(); + flags.add_flag("insist".to_string(), false); + input = gen_id(40)(input)?; + input = gen_short_string(method.virtual_host.as_str())(input)?; + input = gen_short_string("")(input)?; + + input = gen_flags(&flags)(input)?; + Ok(input) + } + } + + /// open-ok (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct OpenOk {} + + impl OpenOk { + /// Get the AMQP class id for open-ok (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 10 + } + + /// Get the AMQP method id for open-ok (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 41 + } + } + + /// Parse open-ok (Generated) + pub fn parse_open_ok<I: ParsableInput>(i: I) -> ParserResult<I, OpenOk> { + let (i, _) = parse_short_string(i)?; + Ok((i, OpenOk {})) + } + + /// Serialize open-ok (Generated) + pub fn gen_open_ok<'a, W: Write + BackToTheBuffer + 'a>( + _method: &'a OpenOk, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(41)(input)?; + input = gen_short_string("")(input)?; + Ok(input) + } + } + + /// close (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Close { + /// reply-code (Generated) + pub reply_code: ShortUInt, + /// reply-text (Generated) + pub reply_text: ShortString, + /// class-id (Generated) + pub class_id: ShortUInt, + /// method-id (Generated) + pub method_id: ShortUInt, + } + + impl Close { + /// Get the AMQP class id for close (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 10 + } + + /// Get the AMQP method id for close (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 50 + } + } + + /// Parse close (Generated) + pub fn parse_close<I: ParsableInput>(i: I) -> ParserResult<I, Close> { + let (i, reply_code) = parse_short_uint(i)?; + let (i, reply_text) = parse_short_string(i)?; + let (i, class_id) = parse_short_uint(i)?; + let (i, method_id) = parse_short_uint(i)?; + Ok(( + i, + Close { + reply_code, + reply_text, + class_id, + method_id, + }, + )) + } + + /// Serialize close (Generated) + pub fn gen_close<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Close, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(50)(input)?; + input = gen_short_uint(method.reply_code)(input)?; + input = gen_short_string(method.reply_text.as_str())(input)?; + input = gen_short_uint(method.class_id)(input)?; + input = gen_short_uint(method.method_id)(input)?; + Ok(input) + } + } + + /// close-ok (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct CloseOk {} + + impl CloseOk { + /// Get the AMQP class id for close-ok (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 10 + } + + /// Get the AMQP method id for close-ok (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 51 + } + } + + /// Parse close-ok (Generated) + pub fn parse_close_ok<I: ParsableInput>(i: I) -> ParserResult<I, CloseOk> { + Ok((i, CloseOk {})) + } + + /// Serialize close-ok (Generated) + pub fn gen_close_ok<'a, W: Write + BackToTheBuffer + 'a>( + _: &'a CloseOk, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(51)(input)?; + Ok(input) + } + } + + /// blocked (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Blocked { + /// reason (Generated) + pub reason: ShortString, + } + + impl Blocked { + /// Get the AMQP class id for blocked (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 10 + } + + /// Get the AMQP method id for blocked (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 60 + } + } + + /// Parse blocked (Generated) + pub fn parse_blocked<I: ParsableInput>(i: I) -> ParserResult<I, Blocked> { + let (i, reason) = parse_short_string(i)?; + Ok((i, Blocked { reason })) + } + + /// Serialize blocked (Generated) + pub fn gen_blocked<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Blocked, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(60)(input)?; + input = gen_short_string(method.reason.as_str())(input)?; + Ok(input) + } + } + + /// unblocked (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Unblocked {} + + impl Unblocked { + /// Get the AMQP class id for unblocked (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 10 + } + + /// Get the AMQP method id for unblocked (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 61 + } + } + + /// Parse unblocked (Generated) + pub fn parse_unblocked<I: ParsableInput>(i: I) -> ParserResult<I, Unblocked> { + Ok((i, Unblocked {})) + } + + /// Serialize unblocked (Generated) + pub fn gen_unblocked<'a, W: Write + BackToTheBuffer + 'a>( + _: &'a Unblocked, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(61)(input)?; + Ok(input) + } + } + + /// update-secret (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct UpdateSecret { + /// new-secret (Generated) + pub new_secret: LongString, + /// reason (Generated) + pub reason: ShortString, + } + + impl UpdateSecret { + /// Get the AMQP class id for update-secret (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 10 + } + + /// Get the AMQP method id for update-secret (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 70 + } + } + + /// Parse update-secret (Generated) + pub fn parse_update_secret<I: ParsableInput>(i: I) -> ParserResult<I, UpdateSecret> { + let (i, new_secret) = parse_long_string(i)?; + let (i, reason) = parse_short_string(i)?; + Ok((i, UpdateSecret { new_secret, reason })) + } + + /// Serialize update-secret (Generated) + pub fn gen_update_secret<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a UpdateSecret, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(70)(input)?; + input = gen_long_string(method.new_secret.as_str())(input)?; + input = gen_short_string(method.reason.as_str())(input)?; + Ok(input) + } + } + + /// update-secret-ok (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct UpdateSecretOk {} + + impl UpdateSecretOk { + /// Get the AMQP class id for update-secret-ok (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 10 + } + + /// Get the AMQP method id for update-secret-ok (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 71 + } + } + + /// Parse update-secret-ok (Generated) + pub fn parse_update_secret_ok<I: ParsableInput>(i: I) -> ParserResult<I, UpdateSecretOk> { + Ok((i, UpdateSecretOk {})) + } + + /// Serialize update-secret-ok (Generated) + pub fn gen_update_secret_ok<'a, W: Write + BackToTheBuffer + 'a>( + _: &'a UpdateSecretOk, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(71)(input)?; + Ok(input) + } + } +} + +/// channel (generated) +pub mod channel { + use super::*; + + /// Parse channel (Generated) + pub fn parse_channel<I: ParsableInput>(i: I) -> ParserResult<I, channel::AMQPMethod> { + context( + "parse_channel", + map_opt( + flat_map(parse_id, |id| { + move |i| match id { + 10 => { + context("parse_open", map(map(parse_open, AMQPMethod::Open), Some))(i) + } + 11 => context( + "parse_open_ok", + map(map(parse_open_ok, AMQPMethod::OpenOk), Some), + )(i), + 20 => { + context("parse_flow", map(map(parse_flow, AMQPMethod::Flow), Some))(i) + } + 21 => context( + "parse_flow_ok", + map(map(parse_flow_ok, AMQPMethod::FlowOk), Some), + )(i), + 40 => context( + "parse_close", + map(map(parse_close, AMQPMethod::Close), Some), + )(i), + 41 => context( + "parse_close_ok", + map(map(parse_close_ok, AMQPMethod::CloseOk), Some), + )(i), + _ => Ok((i, None)), + } + }), + std::convert::identity, + ), + )(i) + } + + /// Serialize channel (Generated) + pub fn gen_channel<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a AMQPMethod, + ) -> impl SerializeFn<W> + 'a { + cookie_factory::sequence::pair(gen_id(20), move |input| match *method { + AMQPMethod::Open(ref open) => gen_open(open)(input), + AMQPMethod::OpenOk(ref open_ok) => gen_open_ok(open_ok)(input), + AMQPMethod::Flow(ref flow) => gen_flow(flow)(input), + AMQPMethod::FlowOk(ref flow_ok) => gen_flow_ok(flow_ok)(input), + AMQPMethod::Close(ref close) => gen_close(close)(input), + AMQPMethod::CloseOk(ref close_ok) => gen_close_ok(close_ok)(input), + }) + } + + /// The available methods in channel + #[derive(Clone, Debug, PartialEq)] + pub enum AMQPMethod { + /// open (Generated) + Open(Open), + /// open-ok (Generated) + OpenOk(OpenOk), + /// flow (Generated) + Flow(Flow), + /// flow-ok (Generated) + FlowOk(FlowOk), + /// close (Generated) + Close(Close), + /// close-ok (Generated) + CloseOk(CloseOk), + } + + /// open (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Open {} + + impl Open { + /// Get the AMQP class id for open (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 20 + } + + /// Get the AMQP method id for open (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 10 + } + } + + /// Parse open (Generated) + pub fn parse_open<I: ParsableInput>(i: I) -> ParserResult<I, Open> { + let (i, _) = parse_short_string(i)?; + Ok((i, Open {})) + } + + /// Serialize open (Generated) + pub fn gen_open<'a, W: Write + BackToTheBuffer + 'a>( + _method: &'a Open, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(10)(input)?; + input = gen_short_string("")(input)?; + Ok(input) + } + } + + /// open-ok (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct OpenOk {} + + impl OpenOk { + /// Get the AMQP class id for open-ok (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 20 + } + + /// Get the AMQP method id for open-ok (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 11 + } + } + + /// Parse open-ok (Generated) + pub fn parse_open_ok<I: ParsableInput>(i: I) -> ParserResult<I, OpenOk> { + let (i, _) = parse_long_string(i)?; + Ok((i, OpenOk {})) + } + + /// Serialize open-ok (Generated) + pub fn gen_open_ok<'a, W: Write + BackToTheBuffer + 'a>( + _method: &'a OpenOk, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(11)(input)?; + input = gen_long_string("")(input)?; + Ok(input) + } + } + + /// flow (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Flow { + /// active (Generated) + pub active: Boolean, + } + + impl Flow { + /// Get the AMQP class id for flow (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 20 + } + + /// Get the AMQP method id for flow (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 20 + } + } + + /// Parse flow (Generated) + pub fn parse_flow<I: ParsableInput>(i: I) -> ParserResult<I, Flow> { + let (i, flags) = parse_flags(i, &["active"])?; + Ok(( + i, + Flow { + active: flags.get_flag("active").unwrap_or(false), + }, + )) + } + + /// Serialize flow (Generated) + pub fn gen_flow<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Flow, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + let mut flags = AMQPFlags::default(); + flags.add_flag("active".to_string(), method.active); + input = gen_id(20)(input)?; + + input = gen_flags(&flags)(input)?; + Ok(input) + } + } + + /// flow-ok (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct FlowOk { + /// active (Generated) + pub active: Boolean, + } + + impl FlowOk { + /// Get the AMQP class id for flow-ok (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 20 + } + + /// Get the AMQP method id for flow-ok (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 21 + } + } + + /// Parse flow-ok (Generated) + pub fn parse_flow_ok<I: ParsableInput>(i: I) -> ParserResult<I, FlowOk> { + let (i, flags) = parse_flags(i, &["active"])?; + Ok(( + i, + FlowOk { + active: flags.get_flag("active").unwrap_or(false), + }, + )) + } + + /// Serialize flow-ok (Generated) + pub fn gen_flow_ok<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a FlowOk, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + let mut flags = AMQPFlags::default(); + flags.add_flag("active".to_string(), method.active); + input = gen_id(21)(input)?; + + input = gen_flags(&flags)(input)?; + Ok(input) + } + } + + /// close (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Close { + /// reply-code (Generated) + pub reply_code: ShortUInt, + /// reply-text (Generated) + pub reply_text: ShortString, + /// class-id (Generated) + pub class_id: ShortUInt, + /// method-id (Generated) + pub method_id: ShortUInt, + } + + impl Close { + /// Get the AMQP class id for close (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 20 + } + + /// Get the AMQP method id for close (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 40 + } + } + + /// Parse close (Generated) + pub fn parse_close<I: ParsableInput>(i: I) -> ParserResult<I, Close> { + let (i, reply_code) = parse_short_uint(i)?; + let (i, reply_text) = parse_short_string(i)?; + let (i, class_id) = parse_short_uint(i)?; + let (i, method_id) = parse_short_uint(i)?; + Ok(( + i, + Close { + reply_code, + reply_text, + class_id, + method_id, + }, + )) + } + + /// Serialize close (Generated) + pub fn gen_close<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Close, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(40)(input)?; + input = gen_short_uint(method.reply_code)(input)?; + input = gen_short_string(method.reply_text.as_str())(input)?; + input = gen_short_uint(method.class_id)(input)?; + input = gen_short_uint(method.method_id)(input)?; + Ok(input) + } + } + + /// close-ok (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct CloseOk {} + + impl CloseOk { + /// Get the AMQP class id for close-ok (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 20 + } + + /// Get the AMQP method id for close-ok (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 41 + } + } + + /// Parse close-ok (Generated) + pub fn parse_close_ok<I: ParsableInput>(i: I) -> ParserResult<I, CloseOk> { + Ok((i, CloseOk {})) + } + + /// Serialize close-ok (Generated) + pub fn gen_close_ok<'a, W: Write + BackToTheBuffer + 'a>( + _: &'a CloseOk, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(41)(input)?; + Ok(input) + } + } +} + +/// access (generated) +pub mod access { + use super::*; + + /// Parse access (Generated) + pub fn parse_access<I: ParsableInput>(i: I) -> ParserResult<I, access::AMQPMethod> { + context( + "parse_access", + map_opt( + flat_map(parse_id, |id| { + move |i| match id { + 10 => context( + "parse_request", + map(map(parse_request, AMQPMethod::Request), Some), + )(i), + 11 => context( + "parse_request_ok", + map(map(parse_request_ok, AMQPMethod::RequestOk), Some), + )(i), + _ => Ok((i, None)), + } + }), + std::convert::identity, + ), + )(i) + } + + /// Serialize access (Generated) + pub fn gen_access<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a AMQPMethod, + ) -> impl SerializeFn<W> + 'a { + cookie_factory::sequence::pair(gen_id(30), move |input| match *method { + AMQPMethod::Request(ref request) => gen_request(request)(input), + AMQPMethod::RequestOk(ref request_ok) => gen_request_ok(request_ok)(input), + }) + } + + /// The available methods in access + #[derive(Clone, Debug, PartialEq)] + pub enum AMQPMethod { + /// request (Generated) + Request(Request), + /// request-ok (Generated) + RequestOk(RequestOk), + } + + /// request (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Request { + /// realm (Generated) + pub realm: ShortString, + + /// exclusive (Generated) + pub exclusive: Boolean, + /// passive (Generated) + pub passive: Boolean, + /// active (Generated) + pub active: Boolean, + /// write (Generated) + pub write: Boolean, + /// read (Generated) + pub read: Boolean, + } + + impl Request { + /// Get the AMQP class id for request (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 30 + } + + /// Get the AMQP method id for request (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 10 + } + } + + /// Parse request (Generated) + pub fn parse_request<I: ParsableInput>(i: I) -> ParserResult<I, Request> { + let (i, realm) = parse_short_string(i)?; + + let (i, flags) = parse_flags(i, &["exclusive", "passive", "active", "write", "read"])?; + Ok(( + i, + Request { + realm, + + exclusive: flags.get_flag("exclusive").unwrap_or(false), + passive: flags.get_flag("passive").unwrap_or(false), + active: flags.get_flag("active").unwrap_or(false), + write: flags.get_flag("write").unwrap_or(false), + read: flags.get_flag("read").unwrap_or(false), + }, + )) + } + + /// Serialize request (Generated) + pub fn gen_request<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Request, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + let mut flags = AMQPFlags::default(); + flags.add_flag("exclusive".to_string(), method.exclusive); + flags.add_flag("passive".to_string(), method.passive); + flags.add_flag("active".to_string(), method.active); + flags.add_flag("write".to_string(), method.write); + flags.add_flag("read".to_string(), method.read); + input = gen_id(10)(input)?; + input = gen_short_string(method.realm.as_str())(input)?; + + input = gen_flags(&flags)(input)?; + Ok(input) + } + } + + /// request-ok (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct RequestOk {} + + impl RequestOk { + /// Get the AMQP class id for request-ok (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 30 + } + + /// Get the AMQP method id for request-ok (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 11 + } + } + + /// Parse request-ok (Generated) + pub fn parse_request_ok<I: ParsableInput>(i: I) -> ParserResult<I, RequestOk> { + let (i, _) = parse_short_uint(i)?; + Ok((i, RequestOk {})) + } + + /// Serialize request-ok (Generated) + pub fn gen_request_ok<'a, W: Write + BackToTheBuffer + 'a>( + _method: &'a RequestOk, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(11)(input)?; + input = gen_short_uint(1)(input)?; + Ok(input) + } + } +} + +/// exchange (generated) +pub mod exchange { + use super::*; + + /// Parse exchange (Generated) + pub fn parse_exchange<I: ParsableInput>(i: I) -> ParserResult<I, exchange::AMQPMethod> { + context( + "parse_exchange", + map_opt( + flat_map(parse_id, |id| { + move |i| match id { + 10 => context( + "parse_declare", + map(map(parse_declare, AMQPMethod::Declare), Some), + )(i), + 11 => context( + "parse_declare_ok", + map(map(parse_declare_ok, AMQPMethod::DeclareOk), Some), + )(i), + 20 => context( + "parse_delete", + map(map(parse_delete, AMQPMethod::Delete), Some), + )(i), + 21 => context( + "parse_delete_ok", + map(map(parse_delete_ok, AMQPMethod::DeleteOk), Some), + )(i), + 30 => { + context("parse_bind", map(map(parse_bind, AMQPMethod::Bind), Some))(i) + } + 31 => context( + "parse_bind_ok", + map(map(parse_bind_ok, AMQPMethod::BindOk), Some), + )(i), + 40 => context( + "parse_unbind", + map(map(parse_unbind, AMQPMethod::Unbind), Some), + )(i), + 51 => context( + "parse_unbind_ok", + map(map(parse_unbind_ok, AMQPMethod::UnbindOk), Some), + )(i), + _ => Ok((i, None)), + } + }), + std::convert::identity, + ), + )(i) + } + + /// Serialize exchange (Generated) + pub fn gen_exchange<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a AMQPMethod, + ) -> impl SerializeFn<W> + 'a { + cookie_factory::sequence::pair(gen_id(40), move |input| match *method { + AMQPMethod::Declare(ref declare) => gen_declare(declare)(input), + AMQPMethod::DeclareOk(ref declare_ok) => gen_declare_ok(declare_ok)(input), + AMQPMethod::Delete(ref delete) => gen_delete(delete)(input), + AMQPMethod::DeleteOk(ref delete_ok) => gen_delete_ok(delete_ok)(input), + AMQPMethod::Bind(ref bind) => gen_bind(bind)(input), + AMQPMethod::BindOk(ref bind_ok) => gen_bind_ok(bind_ok)(input), + AMQPMethod::Unbind(ref unbind) => gen_unbind(unbind)(input), + AMQPMethod::UnbindOk(ref unbind_ok) => gen_unbind_ok(unbind_ok)(input), + }) + } + + /// The available methods in exchange + #[derive(Clone, Debug, PartialEq)] + pub enum AMQPMethod { + /// declare (Generated) + Declare(Declare), + /// declare-ok (Generated) + DeclareOk(DeclareOk), + /// delete (Generated) + Delete(Delete), + /// delete-ok (Generated) + DeleteOk(DeleteOk), + /// bind (Generated) + Bind(Bind), + /// bind-ok (Generated) + BindOk(BindOk), + /// unbind (Generated) + Unbind(Unbind), + /// unbind-ok (Generated) + UnbindOk(UnbindOk), + } + + /// declare (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Declare { + /// exchange (Generated) + pub exchange: ShortString, + /// type (Generated) + pub kind: ShortString, + + /// passive (Generated) + pub passive: Boolean, + /// durable (Generated) + pub durable: Boolean, + /// auto-delete (Generated) + pub auto_delete: Boolean, + /// internal (Generated) + pub internal: Boolean, + /// nowait (Generated) + pub nowait: Boolean, + /// arguments (Generated) + pub arguments: FieldTable, + } + + impl Declare { + /// Get the AMQP class id for declare (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 40 + } + + /// Get the AMQP method id for declare (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 10 + } + } + + /// Parse declare (Generated) + pub fn parse_declare<I: ParsableInput>(i: I) -> ParserResult<I, Declare> { + let (i, _) = parse_short_uint(i)?; + let (i, exchange) = parse_short_string(i)?; + let (i, kind) = parse_short_string(i)?; + + let (i, flags) = parse_flags( + i, + &["passive", "durable", "auto-delete", "internal", "nowait"], + )?; + let (i, arguments) = parse_field_table(i)?; + Ok(( + i, + Declare { + exchange, + kind, + + passive: flags.get_flag("passive").unwrap_or(false), + durable: flags.get_flag("durable").unwrap_or(false), + auto_delete: flags.get_flag("auto_delete").unwrap_or(false), + internal: flags.get_flag("internal").unwrap_or(false), + nowait: flags.get_flag("nowait").unwrap_or(false), + arguments, + }, + )) + } + + /// Serialize declare (Generated) + pub fn gen_declare<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Declare, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + let mut flags = AMQPFlags::default(); + flags.add_flag("passive".to_string(), method.passive); + flags.add_flag("durable".to_string(), method.durable); + flags.add_flag("auto_delete".to_string(), method.auto_delete); + flags.add_flag("internal".to_string(), method.internal); + flags.add_flag("nowait".to_string(), method.nowait); + input = gen_id(10)(input)?; + input = gen_short_uint(0)(input)?; + input = gen_short_string(method.exchange.as_str())(input)?; + input = gen_short_string(method.kind.as_str())(input)?; + + input = gen_flags(&flags)(input)?; + input = gen_field_table(&method.arguments)(input)?; + Ok(input) + } + } + + /// declare-ok (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct DeclareOk {} + + impl DeclareOk { + /// Get the AMQP class id for declare-ok (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 40 + } + + /// Get the AMQP method id for declare-ok (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 11 + } + } + + /// Parse declare-ok (Generated) + pub fn parse_declare_ok<I: ParsableInput>(i: I) -> ParserResult<I, DeclareOk> { + Ok((i, DeclareOk {})) + } + + /// Serialize declare-ok (Generated) + pub fn gen_declare_ok<'a, W: Write + BackToTheBuffer + 'a>( + _: &'a DeclareOk, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(11)(input)?; + Ok(input) + } + } + + /// delete (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Delete { + /// exchange (Generated) + pub exchange: ShortString, + + /// if-unused (Generated) + pub if_unused: Boolean, + /// nowait (Generated) + pub nowait: Boolean, + } + + impl Delete { + /// Get the AMQP class id for delete (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 40 + } + + /// Get the AMQP method id for delete (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 20 + } + } + + /// Parse delete (Generated) + pub fn parse_delete<I: ParsableInput>(i: I) -> ParserResult<I, Delete> { + let (i, _) = parse_short_uint(i)?; + let (i, exchange) = parse_short_string(i)?; + + let (i, flags) = parse_flags(i, &["if-unused", "nowait"])?; + Ok(( + i, + Delete { + exchange, + + if_unused: flags.get_flag("if_unused").unwrap_or(false), + nowait: flags.get_flag("nowait").unwrap_or(false), + }, + )) + } + + /// Serialize delete (Generated) + pub fn gen_delete<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Delete, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + let mut flags = AMQPFlags::default(); + flags.add_flag("if_unused".to_string(), method.if_unused); + flags.add_flag("nowait".to_string(), method.nowait); + input = gen_id(20)(input)?; + input = gen_short_uint(0)(input)?; + input = gen_short_string(method.exchange.as_str())(input)?; + + input = gen_flags(&flags)(input)?; + Ok(input) + } + } + + /// delete-ok (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct DeleteOk {} + + impl DeleteOk { + /// Get the AMQP class id for delete-ok (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 40 + } + + /// Get the AMQP method id for delete-ok (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 21 + } + } + + /// Parse delete-ok (Generated) + pub fn parse_delete_ok<I: ParsableInput>(i: I) -> ParserResult<I, DeleteOk> { + Ok((i, DeleteOk {})) + } + + /// Serialize delete-ok (Generated) + pub fn gen_delete_ok<'a, W: Write + BackToTheBuffer + 'a>( + _: &'a DeleteOk, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(21)(input)?; + Ok(input) + } + } + + /// bind (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Bind { + /// destination (Generated) + pub destination: ShortString, + /// source (Generated) + pub source: ShortString, + /// routing-key (Generated) + pub routing_key: ShortString, + + /// nowait (Generated) + pub nowait: Boolean, + /// arguments (Generated) + pub arguments: FieldTable, + } + + impl Bind { + /// Get the AMQP class id for bind (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 40 + } + + /// Get the AMQP method id for bind (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 30 + } + } + + /// Parse bind (Generated) + pub fn parse_bind<I: ParsableInput>(i: I) -> ParserResult<I, Bind> { + let (i, _) = parse_short_uint(i)?; + let (i, destination) = parse_short_string(i)?; + let (i, source) = parse_short_string(i)?; + let (i, routing_key) = parse_short_string(i)?; + + let (i, flags) = parse_flags(i, &["nowait"])?; + let (i, arguments) = parse_field_table(i)?; + Ok(( + i, + Bind { + destination, + source, + routing_key, + + nowait: flags.get_flag("nowait").unwrap_or(false), + arguments, + }, + )) + } + + /// Serialize bind (Generated) + pub fn gen_bind<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Bind, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + let mut flags = AMQPFlags::default(); + flags.add_flag("nowait".to_string(), method.nowait); + input = gen_id(30)(input)?; + input = gen_short_uint(0)(input)?; + input = gen_short_string(method.destination.as_str())(input)?; + input = gen_short_string(method.source.as_str())(input)?; + input = gen_short_string(method.routing_key.as_str())(input)?; + + input = gen_flags(&flags)(input)?; + input = gen_field_table(&method.arguments)(input)?; + Ok(input) + } + } + + /// bind-ok (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct BindOk {} + + impl BindOk { + /// Get the AMQP class id for bind-ok (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 40 + } + + /// Get the AMQP method id for bind-ok (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 31 + } + } + + /// Parse bind-ok (Generated) + pub fn parse_bind_ok<I: ParsableInput>(i: I) -> ParserResult<I, BindOk> { + Ok((i, BindOk {})) + } + + /// Serialize bind-ok (Generated) + pub fn gen_bind_ok<'a, W: Write + BackToTheBuffer + 'a>( + _: &'a BindOk, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(31)(input)?; + Ok(input) + } + } + + /// unbind (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Unbind { + /// destination (Generated) + pub destination: ShortString, + /// source (Generated) + pub source: ShortString, + /// routing-key (Generated) + pub routing_key: ShortString, + + /// nowait (Generated) + pub nowait: Boolean, + /// arguments (Generated) + pub arguments: FieldTable, + } + + impl Unbind { + /// Get the AMQP class id for unbind (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 40 + } + + /// Get the AMQP method id for unbind (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 40 + } + } + + /// Parse unbind (Generated) + pub fn parse_unbind<I: ParsableInput>(i: I) -> ParserResult<I, Unbind> { + let (i, _) = parse_short_uint(i)?; + let (i, destination) = parse_short_string(i)?; + let (i, source) = parse_short_string(i)?; + let (i, routing_key) = parse_short_string(i)?; + + let (i, flags) = parse_flags(i, &["nowait"])?; + let (i, arguments) = parse_field_table(i)?; + Ok(( + i, + Unbind { + destination, + source, + routing_key, + + nowait: flags.get_flag("nowait").unwrap_or(false), + arguments, + }, + )) + } + + /// Serialize unbind (Generated) + pub fn gen_unbind<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Unbind, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + let mut flags = AMQPFlags::default(); + flags.add_flag("nowait".to_string(), method.nowait); + input = gen_id(40)(input)?; + input = gen_short_uint(0)(input)?; + input = gen_short_string(method.destination.as_str())(input)?; + input = gen_short_string(method.source.as_str())(input)?; + input = gen_short_string(method.routing_key.as_str())(input)?; + + input = gen_flags(&flags)(input)?; + input = gen_field_table(&method.arguments)(input)?; + Ok(input) + } + } + + /// unbind-ok (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct UnbindOk {} + + impl UnbindOk { + /// Get the AMQP class id for unbind-ok (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 40 + } + + /// Get the AMQP method id for unbind-ok (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 51 + } + } + + /// Parse unbind-ok (Generated) + pub fn parse_unbind_ok<I: ParsableInput>(i: I) -> ParserResult<I, UnbindOk> { + Ok((i, UnbindOk {})) + } + + /// Serialize unbind-ok (Generated) + pub fn gen_unbind_ok<'a, W: Write + BackToTheBuffer + 'a>( + _: &'a UnbindOk, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(51)(input)?; + Ok(input) + } + } +} + +/// queue (generated) +pub mod queue { + use super::*; + + /// Parse queue (Generated) + pub fn parse_queue<I: ParsableInput>(i: I) -> ParserResult<I, queue::AMQPMethod> { + context( + "parse_queue", + map_opt( + flat_map(parse_id, |id| { + move |i| match id { + 10 => context( + "parse_declare", + map(map(parse_declare, AMQPMethod::Declare), Some), + )(i), + 11 => context( + "parse_declare_ok", + map(map(parse_declare_ok, AMQPMethod::DeclareOk), Some), + )(i), + 20 => { + context("parse_bind", map(map(parse_bind, AMQPMethod::Bind), Some))(i) + } + 21 => context( + "parse_bind_ok", + map(map(parse_bind_ok, AMQPMethod::BindOk), Some), + )(i), + 30 => context( + "parse_purge", + map(map(parse_purge, AMQPMethod::Purge), Some), + )(i), + 31 => context( + "parse_purge_ok", + map(map(parse_purge_ok, AMQPMethod::PurgeOk), Some), + )(i), + 40 => context( + "parse_delete", + map(map(parse_delete, AMQPMethod::Delete), Some), + )(i), + 41 => context( + "parse_delete_ok", + map(map(parse_delete_ok, AMQPMethod::DeleteOk), Some), + )(i), + 50 => context( + "parse_unbind", + map(map(parse_unbind, AMQPMethod::Unbind), Some), + )(i), + 51 => context( + "parse_unbind_ok", + map(map(parse_unbind_ok, AMQPMethod::UnbindOk), Some), + )(i), + _ => Ok((i, None)), + } + }), + std::convert::identity, + ), + )(i) + } + + /// Serialize queue (Generated) + pub fn gen_queue<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a AMQPMethod, + ) -> impl SerializeFn<W> + 'a { + cookie_factory::sequence::pair(gen_id(50), move |input| match *method { + AMQPMethod::Declare(ref declare) => gen_declare(declare)(input), + AMQPMethod::DeclareOk(ref declare_ok) => gen_declare_ok(declare_ok)(input), + AMQPMethod::Bind(ref bind) => gen_bind(bind)(input), + AMQPMethod::BindOk(ref bind_ok) => gen_bind_ok(bind_ok)(input), + AMQPMethod::Purge(ref purge) => gen_purge(purge)(input), + AMQPMethod::PurgeOk(ref purge_ok) => gen_purge_ok(purge_ok)(input), + AMQPMethod::Delete(ref delete) => gen_delete(delete)(input), + AMQPMethod::DeleteOk(ref delete_ok) => gen_delete_ok(delete_ok)(input), + AMQPMethod::Unbind(ref unbind) => gen_unbind(unbind)(input), + AMQPMethod::UnbindOk(ref unbind_ok) => gen_unbind_ok(unbind_ok)(input), + }) + } + + /// The available methods in queue + #[derive(Clone, Debug, PartialEq)] + pub enum AMQPMethod { + /// declare (Generated) + Declare(Declare), + /// declare-ok (Generated) + DeclareOk(DeclareOk), + /// bind (Generated) + Bind(Bind), + /// bind-ok (Generated) + BindOk(BindOk), + /// purge (Generated) + Purge(Purge), + /// purge-ok (Generated) + PurgeOk(PurgeOk), + /// delete (Generated) + Delete(Delete), + /// delete-ok (Generated) + DeleteOk(DeleteOk), + /// unbind (Generated) + Unbind(Unbind), + /// unbind-ok (Generated) + UnbindOk(UnbindOk), + } + + /// declare (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Declare { + /// queue (Generated) + pub queue: ShortString, + + /// passive (Generated) + pub passive: Boolean, + /// durable (Generated) + pub durable: Boolean, + /// exclusive (Generated) + pub exclusive: Boolean, + /// auto-delete (Generated) + pub auto_delete: Boolean, + /// nowait (Generated) + pub nowait: Boolean, + /// arguments (Generated) + pub arguments: FieldTable, + } + + impl Declare { + /// Get the AMQP class id for declare (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 50 + } + + /// Get the AMQP method id for declare (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 10 + } + } + + /// Parse declare (Generated) + pub fn parse_declare<I: ParsableInput>(i: I) -> ParserResult<I, Declare> { + let (i, _) = parse_short_uint(i)?; + let (i, queue) = parse_short_string(i)?; + + let (i, flags) = parse_flags( + i, + &["passive", "durable", "exclusive", "auto-delete", "nowait"], + )?; + let (i, arguments) = parse_field_table(i)?; + Ok(( + i, + Declare { + queue, + + passive: flags.get_flag("passive").unwrap_or(false), + durable: flags.get_flag("durable").unwrap_or(false), + exclusive: flags.get_flag("exclusive").unwrap_or(false), + auto_delete: flags.get_flag("auto_delete").unwrap_or(false), + nowait: flags.get_flag("nowait").unwrap_or(false), + arguments, + }, + )) + } + + /// Serialize declare (Generated) + pub fn gen_declare<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Declare, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + let mut flags = AMQPFlags::default(); + flags.add_flag("passive".to_string(), method.passive); + flags.add_flag("durable".to_string(), method.durable); + flags.add_flag("exclusive".to_string(), method.exclusive); + flags.add_flag("auto_delete".to_string(), method.auto_delete); + flags.add_flag("nowait".to_string(), method.nowait); + input = gen_id(10)(input)?; + input = gen_short_uint(0)(input)?; + input = gen_short_string(method.queue.as_str())(input)?; + + input = gen_flags(&flags)(input)?; + input = gen_field_table(&method.arguments)(input)?; + Ok(input) + } + } + + /// declare-ok (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct DeclareOk { + /// queue (Generated) + pub queue: ShortString, + /// message-count (Generated) + pub message_count: LongUInt, + /// consumer-count (Generated) + pub consumer_count: LongUInt, + } + + impl DeclareOk { + /// Get the AMQP class id for declare-ok (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 50 + } + + /// Get the AMQP method id for declare-ok (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 11 + } + } + + /// Parse declare-ok (Generated) + pub fn parse_declare_ok<I: ParsableInput>(i: I) -> ParserResult<I, DeclareOk> { + let (i, queue) = parse_short_string(i)?; + let (i, message_count) = parse_long_uint(i)?; + let (i, consumer_count) = parse_long_uint(i)?; + Ok(( + i, + DeclareOk { + queue, + message_count, + consumer_count, + }, + )) + } + + /// Serialize declare-ok (Generated) + pub fn gen_declare_ok<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a DeclareOk, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(11)(input)?; + input = gen_short_string(method.queue.as_str())(input)?; + input = gen_long_uint(method.message_count)(input)?; + input = gen_long_uint(method.consumer_count)(input)?; + Ok(input) + } + } + + /// bind (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Bind { + /// queue (Generated) + pub queue: ShortString, + /// exchange (Generated) + pub exchange: ShortString, + /// routing-key (Generated) + pub routing_key: ShortString, + + /// nowait (Generated) + pub nowait: Boolean, + /// arguments (Generated) + pub arguments: FieldTable, + } + + impl Bind { + /// Get the AMQP class id for bind (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 50 + } + + /// Get the AMQP method id for bind (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 20 + } + } + + /// Parse bind (Generated) + pub fn parse_bind<I: ParsableInput>(i: I) -> ParserResult<I, Bind> { + let (i, _) = parse_short_uint(i)?; + let (i, queue) = parse_short_string(i)?; + let (i, exchange) = parse_short_string(i)?; + let (i, routing_key) = parse_short_string(i)?; + + let (i, flags) = parse_flags(i, &["nowait"])?; + let (i, arguments) = parse_field_table(i)?; + Ok(( + i, + Bind { + queue, + exchange, + routing_key, + + nowait: flags.get_flag("nowait").unwrap_or(false), + arguments, + }, + )) + } + + /// Serialize bind (Generated) + pub fn gen_bind<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Bind, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + let mut flags = AMQPFlags::default(); + flags.add_flag("nowait".to_string(), method.nowait); + input = gen_id(20)(input)?; + input = gen_short_uint(0)(input)?; + input = gen_short_string(method.queue.as_str())(input)?; + input = gen_short_string(method.exchange.as_str())(input)?; + input = gen_short_string(method.routing_key.as_str())(input)?; + + input = gen_flags(&flags)(input)?; + input = gen_field_table(&method.arguments)(input)?; + Ok(input) + } + } + + /// bind-ok (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct BindOk {} + + impl BindOk { + /// Get the AMQP class id for bind-ok (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 50 + } + + /// Get the AMQP method id for bind-ok (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 21 + } + } + + /// Parse bind-ok (Generated) + pub fn parse_bind_ok<I: ParsableInput>(i: I) -> ParserResult<I, BindOk> { + Ok((i, BindOk {})) + } + + /// Serialize bind-ok (Generated) + pub fn gen_bind_ok<'a, W: Write + BackToTheBuffer + 'a>( + _: &'a BindOk, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(21)(input)?; + Ok(input) + } + } + + /// purge (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Purge { + /// queue (Generated) + pub queue: ShortString, + + /// nowait (Generated) + pub nowait: Boolean, + } + + impl Purge { + /// Get the AMQP class id for purge (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 50 + } + + /// Get the AMQP method id for purge (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 30 + } + } + + /// Parse purge (Generated) + pub fn parse_purge<I: ParsableInput>(i: I) -> ParserResult<I, Purge> { + let (i, _) = parse_short_uint(i)?; + let (i, queue) = parse_short_string(i)?; + + let (i, flags) = parse_flags(i, &["nowait"])?; + Ok(( + i, + Purge { + queue, + + nowait: flags.get_flag("nowait").unwrap_or(false), + }, + )) + } + + /// Serialize purge (Generated) + pub fn gen_purge<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Purge, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + let mut flags = AMQPFlags::default(); + flags.add_flag("nowait".to_string(), method.nowait); + input = gen_id(30)(input)?; + input = gen_short_uint(0)(input)?; + input = gen_short_string(method.queue.as_str())(input)?; + + input = gen_flags(&flags)(input)?; + Ok(input) + } + } + + /// purge-ok (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct PurgeOk { + /// message-count (Generated) + pub message_count: LongUInt, + } + + impl PurgeOk { + /// Get the AMQP class id for purge-ok (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 50 + } + + /// Get the AMQP method id for purge-ok (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 31 + } + } + + /// Parse purge-ok (Generated) + pub fn parse_purge_ok<I: ParsableInput>(i: I) -> ParserResult<I, PurgeOk> { + let (i, message_count) = parse_long_uint(i)?; + Ok((i, PurgeOk { message_count })) + } + + /// Serialize purge-ok (Generated) + pub fn gen_purge_ok<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a PurgeOk, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(31)(input)?; + input = gen_long_uint(method.message_count)(input)?; + Ok(input) + } + } + + /// delete (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Delete { + /// queue (Generated) + pub queue: ShortString, + + /// if-unused (Generated) + pub if_unused: Boolean, + /// if-empty (Generated) + pub if_empty: Boolean, + /// nowait (Generated) + pub nowait: Boolean, + } + + impl Delete { + /// Get the AMQP class id for delete (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 50 + } + + /// Get the AMQP method id for delete (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 40 + } + } + + /// Parse delete (Generated) + pub fn parse_delete<I: ParsableInput>(i: I) -> ParserResult<I, Delete> { + let (i, _) = parse_short_uint(i)?; + let (i, queue) = parse_short_string(i)?; + + let (i, flags) = parse_flags(i, &["if-unused", "if-empty", "nowait"])?; + Ok(( + i, + Delete { + queue, + + if_unused: flags.get_flag("if_unused").unwrap_or(false), + if_empty: flags.get_flag("if_empty").unwrap_or(false), + nowait: flags.get_flag("nowait").unwrap_or(false), + }, + )) + } + + /// Serialize delete (Generated) + pub fn gen_delete<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Delete, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + let mut flags = AMQPFlags::default(); + flags.add_flag("if_unused".to_string(), method.if_unused); + flags.add_flag("if_empty".to_string(), method.if_empty); + flags.add_flag("nowait".to_string(), method.nowait); + input = gen_id(40)(input)?; + input = gen_short_uint(0)(input)?; + input = gen_short_string(method.queue.as_str())(input)?; + + input = gen_flags(&flags)(input)?; + Ok(input) + } + } + + /// delete-ok (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct DeleteOk { + /// message-count (Generated) + pub message_count: LongUInt, + } + + impl DeleteOk { + /// Get the AMQP class id for delete-ok (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 50 + } + + /// Get the AMQP method id for delete-ok (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 41 + } + } + + /// Parse delete-ok (Generated) + pub fn parse_delete_ok<I: ParsableInput>(i: I) -> ParserResult<I, DeleteOk> { + let (i, message_count) = parse_long_uint(i)?; + Ok((i, DeleteOk { message_count })) + } + + /// Serialize delete-ok (Generated) + pub fn gen_delete_ok<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a DeleteOk, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(41)(input)?; + input = gen_long_uint(method.message_count)(input)?; + Ok(input) + } + } + + /// unbind (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Unbind { + /// queue (Generated) + pub queue: ShortString, + /// exchange (Generated) + pub exchange: ShortString, + /// routing-key (Generated) + pub routing_key: ShortString, + /// arguments (Generated) + pub arguments: FieldTable, + } + + impl Unbind { + /// Get the AMQP class id for unbind (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 50 + } + + /// Get the AMQP method id for unbind (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 50 + } + } + + /// Parse unbind (Generated) + pub fn parse_unbind<I: ParsableInput>(i: I) -> ParserResult<I, Unbind> { + let (i, _) = parse_short_uint(i)?; + let (i, queue) = parse_short_string(i)?; + let (i, exchange) = parse_short_string(i)?; + let (i, routing_key) = parse_short_string(i)?; + let (i, arguments) = parse_field_table(i)?; + Ok(( + i, + Unbind { + queue, + exchange, + routing_key, + arguments, + }, + )) + } + + /// Serialize unbind (Generated) + pub fn gen_unbind<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Unbind, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(50)(input)?; + input = gen_short_uint(0)(input)?; + input = gen_short_string(method.queue.as_str())(input)?; + input = gen_short_string(method.exchange.as_str())(input)?; + input = gen_short_string(method.routing_key.as_str())(input)?; + input = gen_field_table(&method.arguments)(input)?; + Ok(input) + } + } + + /// unbind-ok (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct UnbindOk {} + + impl UnbindOk { + /// Get the AMQP class id for unbind-ok (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 50 + } + + /// Get the AMQP method id for unbind-ok (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 51 + } + } + + /// Parse unbind-ok (Generated) + pub fn parse_unbind_ok<I: ParsableInput>(i: I) -> ParserResult<I, UnbindOk> { + Ok((i, UnbindOk {})) + } + + /// Serialize unbind-ok (Generated) + pub fn gen_unbind_ok<'a, W: Write + BackToTheBuffer + 'a>( + _: &'a UnbindOk, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(51)(input)?; + Ok(input) + } + } +} + +/// basic (generated) +pub mod basic { + use super::*; + + /// Parse basic (Generated) + pub fn parse_basic<I: ParsableInput>(i: I) -> ParserResult<I, basic::AMQPMethod> { + context( + "parse_basic", + map_opt( + flat_map(parse_id, |id| { + move |i| match id { + 10 => context("parse_qos", map(map(parse_qos, AMQPMethod::Qos), Some))(i), + 11 => context( + "parse_qos_ok", + map(map(parse_qos_ok, AMQPMethod::QosOk), Some), + )(i), + 20 => context( + "parse_consume", + map(map(parse_consume, AMQPMethod::Consume), Some), + )(i), + 21 => context( + "parse_consume_ok", + map(map(parse_consume_ok, AMQPMethod::ConsumeOk), Some), + )(i), + 30 => context( + "parse_cancel", + map(map(parse_cancel, AMQPMethod::Cancel), Some), + )(i), + 31 => context( + "parse_cancel_ok", + map(map(parse_cancel_ok, AMQPMethod::CancelOk), Some), + )(i), + 40 => context( + "parse_publish", + map(map(parse_publish, AMQPMethod::Publish), Some), + )(i), + 50 => context( + "parse_return", + map(map(parse_return, AMQPMethod::Return), Some), + )(i), + 60 => context( + "parse_deliver", + map(map(parse_deliver, AMQPMethod::Deliver), Some), + )(i), + 70 => context("parse_get", map(map(parse_get, AMQPMethod::Get), Some))(i), + 71 => context( + "parse_get_ok", + map(map(parse_get_ok, AMQPMethod::GetOk), Some), + )(i), + 72 => context( + "parse_get_empty", + map(map(parse_get_empty, AMQPMethod::GetEmpty), Some), + )(i), + 80 => context("parse_ack", map(map(parse_ack, AMQPMethod::Ack), Some))(i), + 90 => context( + "parse_reject", + map(map(parse_reject, AMQPMethod::Reject), Some), + )(i), + 100 => context( + "parse_recover_async", + map(map(parse_recover_async, AMQPMethod::RecoverAsync), Some), + )(i), + 110 => context( + "parse_recover", + map(map(parse_recover, AMQPMethod::Recover), Some), + )(i), + 111 => context( + "parse_recover_ok", + map(map(parse_recover_ok, AMQPMethod::RecoverOk), Some), + )(i), + 120 => { + context("parse_nack", map(map(parse_nack, AMQPMethod::Nack), Some))(i) + } + _ => Ok((i, None)), + } + }), + std::convert::identity, + ), + )(i) + } + + /// Serialize basic (Generated) + pub fn gen_basic<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a AMQPMethod, + ) -> impl SerializeFn<W> + 'a { + cookie_factory::sequence::pair(gen_id(60), move |input| match *method { + AMQPMethod::Qos(ref qos) => gen_qos(qos)(input), + AMQPMethod::QosOk(ref qos_ok) => gen_qos_ok(qos_ok)(input), + AMQPMethod::Consume(ref consume) => gen_consume(consume)(input), + AMQPMethod::ConsumeOk(ref consume_ok) => gen_consume_ok(consume_ok)(input), + AMQPMethod::Cancel(ref cancel) => gen_cancel(cancel)(input), + AMQPMethod::CancelOk(ref cancel_ok) => gen_cancel_ok(cancel_ok)(input), + AMQPMethod::Publish(ref publish) => gen_publish(publish)(input), + AMQPMethod::Return(ref r#return) => gen_return(r#return)(input), + AMQPMethod::Deliver(ref deliver) => gen_deliver(deliver)(input), + AMQPMethod::Get(ref get) => gen_get(get)(input), + AMQPMethod::GetOk(ref get_ok) => gen_get_ok(get_ok)(input), + AMQPMethod::GetEmpty(ref get_empty) => gen_get_empty(get_empty)(input), + AMQPMethod::Ack(ref ack) => gen_ack(ack)(input), + AMQPMethod::Reject(ref reject) => gen_reject(reject)(input), + AMQPMethod::RecoverAsync(ref recover_async) => gen_recover_async(recover_async)(input), + AMQPMethod::Recover(ref recover) => gen_recover(recover)(input), + AMQPMethod::RecoverOk(ref recover_ok) => gen_recover_ok(recover_ok)(input), + AMQPMethod::Nack(ref nack) => gen_nack(nack)(input), + }) + } + + /// The available methods in basic + #[derive(Clone, Debug, PartialEq)] + pub enum AMQPMethod { + /// qos (Generated) + Qos(Qos), + /// qos-ok (Generated) + QosOk(QosOk), + /// consume (Generated) + Consume(Consume), + /// consume-ok (Generated) + ConsumeOk(ConsumeOk), + /// cancel (Generated) + Cancel(Cancel), + /// cancel-ok (Generated) + CancelOk(CancelOk), + /// publish (Generated) + Publish(Publish), + /// return (Generated) + Return(Return), + /// deliver (Generated) + Deliver(Deliver), + /// get (Generated) + Get(Get), + /// get-ok (Generated) + GetOk(GetOk), + /// get-empty (Generated) + GetEmpty(GetEmpty), + /// ack (Generated) + Ack(Ack), + /// reject (Generated) + Reject(Reject), + /// recover-async (Generated) + RecoverAsync(RecoverAsync), + /// recover (Generated) + Recover(Recover), + /// recover-ok (Generated) + RecoverOk(RecoverOk), + /// nack (Generated) + Nack(Nack), + } + + /// qos (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Qos { + /// prefetch-count (Generated) + pub prefetch_count: ShortUInt, + + /// global (Generated) + pub global: Boolean, + } + + impl Qos { + /// Get the AMQP class id for qos (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 60 + } + + /// Get the AMQP method id for qos (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 10 + } + } + + /// Parse qos (Generated) + pub fn parse_qos<I: ParsableInput>(i: I) -> ParserResult<I, Qos> { + let (i, _) = parse_long_uint(i)?; + let (i, prefetch_count) = parse_short_uint(i)?; + + let (i, flags) = parse_flags(i, &["global"])?; + Ok(( + i, + Qos { + prefetch_count, + + global: flags.get_flag("global").unwrap_or(false), + }, + )) + } + + /// Serialize qos (Generated) + pub fn gen_qos<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Qos, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + let mut flags = AMQPFlags::default(); + flags.add_flag("global".to_string(), method.global); + input = gen_id(10)(input)?; + input = gen_long_uint(0)(input)?; + input = gen_short_uint(method.prefetch_count)(input)?; + + input = gen_flags(&flags)(input)?; + Ok(input) + } + } + + /// qos-ok (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct QosOk {} + + impl QosOk { + /// Get the AMQP class id for qos-ok (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 60 + } + + /// Get the AMQP method id for qos-ok (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 11 + } + } + + /// Parse qos-ok (Generated) + pub fn parse_qos_ok<I: ParsableInput>(i: I) -> ParserResult<I, QosOk> { + Ok((i, QosOk {})) + } + + /// Serialize qos-ok (Generated) + pub fn gen_qos_ok<'a, W: Write + BackToTheBuffer + 'a>( + _: &'a QosOk, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(11)(input)?; + Ok(input) + } + } + + /// consume (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Consume { + /// queue (Generated) + pub queue: ShortString, + /// consumer-tag (Generated) + pub consumer_tag: ShortString, + + /// no-local (Generated) + pub no_local: Boolean, + /// no-ack (Generated) + pub no_ack: Boolean, + /// exclusive (Generated) + pub exclusive: Boolean, + /// nowait (Generated) + pub nowait: Boolean, + /// arguments (Generated) + pub arguments: FieldTable, + } + + impl Consume { + /// Get the AMQP class id for consume (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 60 + } + + /// Get the AMQP method id for consume (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 20 + } + } + + /// Parse consume (Generated) + pub fn parse_consume<I: ParsableInput>(i: I) -> ParserResult<I, Consume> { + let (i, _) = parse_short_uint(i)?; + let (i, queue) = parse_short_string(i)?; + let (i, consumer_tag) = parse_short_string(i)?; + + let (i, flags) = parse_flags(i, &["no-local", "no-ack", "exclusive", "nowait"])?; + let (i, arguments) = parse_field_table(i)?; + Ok(( + i, + Consume { + queue, + consumer_tag, + + no_local: flags.get_flag("no_local").unwrap_or(false), + no_ack: flags.get_flag("no_ack").unwrap_or(false), + exclusive: flags.get_flag("exclusive").unwrap_or(false), + nowait: flags.get_flag("nowait").unwrap_or(false), + arguments, + }, + )) + } + + /// Serialize consume (Generated) + pub fn gen_consume<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Consume, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + let mut flags = AMQPFlags::default(); + flags.add_flag("no_local".to_string(), method.no_local); + flags.add_flag("no_ack".to_string(), method.no_ack); + flags.add_flag("exclusive".to_string(), method.exclusive); + flags.add_flag("nowait".to_string(), method.nowait); + input = gen_id(20)(input)?; + input = gen_short_uint(0)(input)?; + input = gen_short_string(method.queue.as_str())(input)?; + input = gen_short_string(method.consumer_tag.as_str())(input)?; + + input = gen_flags(&flags)(input)?; + input = gen_field_table(&method.arguments)(input)?; + Ok(input) + } + } + + /// consume-ok (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct ConsumeOk { + /// consumer-tag (Generated) + pub consumer_tag: ShortString, + } + + impl ConsumeOk { + /// Get the AMQP class id for consume-ok (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 60 + } + + /// Get the AMQP method id for consume-ok (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 21 + } + } + + /// Parse consume-ok (Generated) + pub fn parse_consume_ok<I: ParsableInput>(i: I) -> ParserResult<I, ConsumeOk> { + let (i, consumer_tag) = parse_short_string(i)?; + Ok((i, ConsumeOk { consumer_tag })) + } + + /// Serialize consume-ok (Generated) + pub fn gen_consume_ok<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a ConsumeOk, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(21)(input)?; + input = gen_short_string(method.consumer_tag.as_str())(input)?; + Ok(input) + } + } + + /// cancel (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Cancel { + /// consumer-tag (Generated) + pub consumer_tag: ShortString, + + /// nowait (Generated) + pub nowait: Boolean, + } + + impl Cancel { + /// Get the AMQP class id for cancel (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 60 + } + + /// Get the AMQP method id for cancel (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 30 + } + } + + /// Parse cancel (Generated) + pub fn parse_cancel<I: ParsableInput>(i: I) -> ParserResult<I, Cancel> { + let (i, consumer_tag) = parse_short_string(i)?; + + let (i, flags) = parse_flags(i, &["nowait"])?; + Ok(( + i, + Cancel { + consumer_tag, + + nowait: flags.get_flag("nowait").unwrap_or(false), + }, + )) + } + + /// Serialize cancel (Generated) + pub fn gen_cancel<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Cancel, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + let mut flags = AMQPFlags::default(); + flags.add_flag("nowait".to_string(), method.nowait); + input = gen_id(30)(input)?; + input = gen_short_string(method.consumer_tag.as_str())(input)?; + + input = gen_flags(&flags)(input)?; + Ok(input) + } + } + + /// cancel-ok (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct CancelOk { + /// consumer-tag (Generated) + pub consumer_tag: ShortString, + } + + impl CancelOk { + /// Get the AMQP class id for cancel-ok (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 60 + } + + /// Get the AMQP method id for cancel-ok (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 31 + } + } + + /// Parse cancel-ok (Generated) + pub fn parse_cancel_ok<I: ParsableInput>(i: I) -> ParserResult<I, CancelOk> { + let (i, consumer_tag) = parse_short_string(i)?; + Ok((i, CancelOk { consumer_tag })) + } + + /// Serialize cancel-ok (Generated) + pub fn gen_cancel_ok<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a CancelOk, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(31)(input)?; + input = gen_short_string(method.consumer_tag.as_str())(input)?; + Ok(input) + } + } + + /// publish (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Publish { + /// exchange (Generated) + pub exchange: ShortString, + /// routing-key (Generated) + pub routing_key: ShortString, + + /// mandatory (Generated) + pub mandatory: Boolean, + /// immediate (Generated) + pub immediate: Boolean, + } + + impl Publish { + /// Get the AMQP class id for publish (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 60 + } + + /// Get the AMQP method id for publish (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 40 + } + } + + /// Parse publish (Generated) + pub fn parse_publish<I: ParsableInput>(i: I) -> ParserResult<I, Publish> { + let (i, _) = parse_short_uint(i)?; + let (i, exchange) = parse_short_string(i)?; + let (i, routing_key) = parse_short_string(i)?; + + let (i, flags) = parse_flags(i, &["mandatory", "immediate"])?; + Ok(( + i, + Publish { + exchange, + routing_key, + + mandatory: flags.get_flag("mandatory").unwrap_or(false), + immediate: flags.get_flag("immediate").unwrap_or(false), + }, + )) + } + + /// Serialize publish (Generated) + pub fn gen_publish<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Publish, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + let mut flags = AMQPFlags::default(); + flags.add_flag("mandatory".to_string(), method.mandatory); + flags.add_flag("immediate".to_string(), method.immediate); + input = gen_id(40)(input)?; + input = gen_short_uint(0)(input)?; + input = gen_short_string(method.exchange.as_str())(input)?; + input = gen_short_string(method.routing_key.as_str())(input)?; + + input = gen_flags(&flags)(input)?; + Ok(input) + } + } + + /// return (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Return { + /// reply-code (Generated) + pub reply_code: ShortUInt, + /// reply-text (Generated) + pub reply_text: ShortString, + /// exchange (Generated) + pub exchange: ShortString, + /// routing-key (Generated) + pub routing_key: ShortString, + } + + impl Return { + /// Get the AMQP class id for return (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 60 + } + + /// Get the AMQP method id for return (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 50 + } + } + + /// Parse return (Generated) + pub fn parse_return<I: ParsableInput>(i: I) -> ParserResult<I, Return> { + let (i, reply_code) = parse_short_uint(i)?; + let (i, reply_text) = parse_short_string(i)?; + let (i, exchange) = parse_short_string(i)?; + let (i, routing_key) = parse_short_string(i)?; + Ok(( + i, + Return { + reply_code, + reply_text, + exchange, + routing_key, + }, + )) + } + + /// Serialize return (Generated) + pub fn gen_return<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Return, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(50)(input)?; + input = gen_short_uint(method.reply_code)(input)?; + input = gen_short_string(method.reply_text.as_str())(input)?; + input = gen_short_string(method.exchange.as_str())(input)?; + input = gen_short_string(method.routing_key.as_str())(input)?; + Ok(input) + } + } + + /// deliver (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Deliver { + /// consumer-tag (Generated) + pub consumer_tag: ShortString, + /// delivery-tag (Generated) + pub delivery_tag: LongLongUInt, + + /// redelivered (Generated) + pub redelivered: Boolean, + /// exchange (Generated) + pub exchange: ShortString, + /// routing-key (Generated) + pub routing_key: ShortString, + } + + impl Deliver { + /// Get the AMQP class id for deliver (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 60 + } + + /// Get the AMQP method id for deliver (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 60 + } + } + + /// Parse deliver (Generated) + pub fn parse_deliver<I: ParsableInput>(i: I) -> ParserResult<I, Deliver> { + let (i, consumer_tag) = parse_short_string(i)?; + let (i, delivery_tag) = parse_long_long_uint(i)?; + + let (i, flags) = parse_flags(i, &["redelivered"])?; + let (i, exchange) = parse_short_string(i)?; + let (i, routing_key) = parse_short_string(i)?; + Ok(( + i, + Deliver { + consumer_tag, + delivery_tag, + + redelivered: flags.get_flag("redelivered").unwrap_or(false), + exchange, + routing_key, + }, + )) + } + + /// Serialize deliver (Generated) + pub fn gen_deliver<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Deliver, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + let mut flags = AMQPFlags::default(); + flags.add_flag("redelivered".to_string(), method.redelivered); + input = gen_id(60)(input)?; + input = gen_short_string(method.consumer_tag.as_str())(input)?; + input = gen_long_long_uint(method.delivery_tag)(input)?; + + input = gen_flags(&flags)(input)?; + input = gen_short_string(method.exchange.as_str())(input)?; + input = gen_short_string(method.routing_key.as_str())(input)?; + Ok(input) + } + } + + /// get (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Get { + /// queue (Generated) + pub queue: ShortString, + + /// no-ack (Generated) + pub no_ack: Boolean, + } + + impl Get { + /// Get the AMQP class id for get (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 60 + } + + /// Get the AMQP method id for get (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 70 + } + } + + /// Parse get (Generated) + pub fn parse_get<I: ParsableInput>(i: I) -> ParserResult<I, Get> { + let (i, _) = parse_short_uint(i)?; + let (i, queue) = parse_short_string(i)?; + + let (i, flags) = parse_flags(i, &["no-ack"])?; + Ok(( + i, + Get { + queue, + + no_ack: flags.get_flag("no_ack").unwrap_or(false), + }, + )) + } + + /// Serialize get (Generated) + pub fn gen_get<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Get, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + let mut flags = AMQPFlags::default(); + flags.add_flag("no_ack".to_string(), method.no_ack); + input = gen_id(70)(input)?; + input = gen_short_uint(0)(input)?; + input = gen_short_string(method.queue.as_str())(input)?; + + input = gen_flags(&flags)(input)?; + Ok(input) + } + } + + /// get-ok (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct GetOk { + /// delivery-tag (Generated) + pub delivery_tag: LongLongUInt, + + /// redelivered (Generated) + pub redelivered: Boolean, + /// exchange (Generated) + pub exchange: ShortString, + /// routing-key (Generated) + pub routing_key: ShortString, + /// message-count (Generated) + pub message_count: LongUInt, + } + + impl GetOk { + /// Get the AMQP class id for get-ok (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 60 + } + + /// Get the AMQP method id for get-ok (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 71 + } + } + + /// Parse get-ok (Generated) + pub fn parse_get_ok<I: ParsableInput>(i: I) -> ParserResult<I, GetOk> { + let (i, delivery_tag) = parse_long_long_uint(i)?; + + let (i, flags) = parse_flags(i, &["redelivered"])?; + let (i, exchange) = parse_short_string(i)?; + let (i, routing_key) = parse_short_string(i)?; + let (i, message_count) = parse_long_uint(i)?; + Ok(( + i, + GetOk { + delivery_tag, + + redelivered: flags.get_flag("redelivered").unwrap_or(false), + exchange, + routing_key, + message_count, + }, + )) + } + + /// Serialize get-ok (Generated) + pub fn gen_get_ok<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a GetOk, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + let mut flags = AMQPFlags::default(); + flags.add_flag("redelivered".to_string(), method.redelivered); + input = gen_id(71)(input)?; + input = gen_long_long_uint(method.delivery_tag)(input)?; + + input = gen_flags(&flags)(input)?; + input = gen_short_string(method.exchange.as_str())(input)?; + input = gen_short_string(method.routing_key.as_str())(input)?; + input = gen_long_uint(method.message_count)(input)?; + Ok(input) + } + } + + /// get-empty (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct GetEmpty {} + + impl GetEmpty { + /// Get the AMQP class id for get-empty (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 60 + } + + /// Get the AMQP method id for get-empty (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 72 + } + } + + /// Parse get-empty (Generated) + pub fn parse_get_empty<I: ParsableInput>(i: I) -> ParserResult<I, GetEmpty> { + let (i, _) = parse_short_string(i)?; + Ok((i, GetEmpty {})) + } + + /// Serialize get-empty (Generated) + pub fn gen_get_empty<'a, W: Write + BackToTheBuffer + 'a>( + _method: &'a GetEmpty, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(72)(input)?; + input = gen_short_string("")(input)?; + Ok(input) + } + } + + /// ack (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Ack { + /// delivery-tag (Generated) + pub delivery_tag: LongLongUInt, + + /// multiple (Generated) + pub multiple: Boolean, + } + + impl Ack { + /// Get the AMQP class id for ack (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 60 + } + + /// Get the AMQP method id for ack (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 80 + } + } + + /// Parse ack (Generated) + pub fn parse_ack<I: ParsableInput>(i: I) -> ParserResult<I, Ack> { + let (i, delivery_tag) = parse_long_long_uint(i)?; + + let (i, flags) = parse_flags(i, &["multiple"])?; + Ok(( + i, + Ack { + delivery_tag, + + multiple: flags.get_flag("multiple").unwrap_or(false), + }, + )) + } + + /// Serialize ack (Generated) + pub fn gen_ack<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Ack, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + let mut flags = AMQPFlags::default(); + flags.add_flag("multiple".to_string(), method.multiple); + input = gen_id(80)(input)?; + input = gen_long_long_uint(method.delivery_tag)(input)?; + + input = gen_flags(&flags)(input)?; + Ok(input) + } + } + + /// reject (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Reject { + /// delivery-tag (Generated) + pub delivery_tag: LongLongUInt, + + /// requeue (Generated) + pub requeue: Boolean, + } + + impl Reject { + /// Get the AMQP class id for reject (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 60 + } + + /// Get the AMQP method id for reject (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 90 + } + } + + /// Parse reject (Generated) + pub fn parse_reject<I: ParsableInput>(i: I) -> ParserResult<I, Reject> { + let (i, delivery_tag) = parse_long_long_uint(i)?; + + let (i, flags) = parse_flags(i, &["requeue"])?; + Ok(( + i, + Reject { + delivery_tag, + + requeue: flags.get_flag("requeue").unwrap_or(false), + }, + )) + } + + /// Serialize reject (Generated) + pub fn gen_reject<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Reject, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + let mut flags = AMQPFlags::default(); + flags.add_flag("requeue".to_string(), method.requeue); + input = gen_id(90)(input)?; + input = gen_long_long_uint(method.delivery_tag)(input)?; + + input = gen_flags(&flags)(input)?; + Ok(input) + } + } + + /// recover-async (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct RecoverAsync { + /// requeue (Generated) + pub requeue: Boolean, + } + + impl RecoverAsync { + /// Get the AMQP class id for recover-async (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 60 + } + + /// Get the AMQP method id for recover-async (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 100 + } + } + + /// Parse recover-async (Generated) + pub fn parse_recover_async<I: ParsableInput>(i: I) -> ParserResult<I, RecoverAsync> { + let (i, flags) = parse_flags(i, &["requeue"])?; + Ok(( + i, + RecoverAsync { + requeue: flags.get_flag("requeue").unwrap_or(false), + }, + )) + } + + /// Serialize recover-async (Generated) + pub fn gen_recover_async<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a RecoverAsync, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + let mut flags = AMQPFlags::default(); + flags.add_flag("requeue".to_string(), method.requeue); + input = gen_id(100)(input)?; + + input = gen_flags(&flags)(input)?; + Ok(input) + } + } + + /// recover (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Recover { + /// requeue (Generated) + pub requeue: Boolean, + } + + impl Recover { + /// Get the AMQP class id for recover (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 60 + } + + /// Get the AMQP method id for recover (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 110 + } + } + + /// Parse recover (Generated) + pub fn parse_recover<I: ParsableInput>(i: I) -> ParserResult<I, Recover> { + let (i, flags) = parse_flags(i, &["requeue"])?; + Ok(( + i, + Recover { + requeue: flags.get_flag("requeue").unwrap_or(false), + }, + )) + } + + /// Serialize recover (Generated) + pub fn gen_recover<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Recover, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + let mut flags = AMQPFlags::default(); + flags.add_flag("requeue".to_string(), method.requeue); + input = gen_id(110)(input)?; + + input = gen_flags(&flags)(input)?; + Ok(input) + } + } + + /// recover-ok (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct RecoverOk {} + + impl RecoverOk { + /// Get the AMQP class id for recover-ok (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 60 + } + + /// Get the AMQP method id for recover-ok (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 111 + } + } + + /// Parse recover-ok (Generated) + pub fn parse_recover_ok<I: ParsableInput>(i: I) -> ParserResult<I, RecoverOk> { + Ok((i, RecoverOk {})) + } + + /// Serialize recover-ok (Generated) + pub fn gen_recover_ok<'a, W: Write + BackToTheBuffer + 'a>( + _: &'a RecoverOk, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(111)(input)?; + Ok(input) + } + } + + /// nack (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Nack { + /// delivery-tag (Generated) + pub delivery_tag: LongLongUInt, + + /// multiple (Generated) + pub multiple: Boolean, + /// requeue (Generated) + pub requeue: Boolean, + } + + impl Nack { + /// Get the AMQP class id for nack (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 60 + } + + /// Get the AMQP method id for nack (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 120 + } + } + + /// Parse nack (Generated) + pub fn parse_nack<I: ParsableInput>(i: I) -> ParserResult<I, Nack> { + let (i, delivery_tag) = parse_long_long_uint(i)?; + + let (i, flags) = parse_flags(i, &["multiple", "requeue"])?; + Ok(( + i, + Nack { + delivery_tag, + + multiple: flags.get_flag("multiple").unwrap_or(false), + requeue: flags.get_flag("requeue").unwrap_or(false), + }, + )) + } + + /// Serialize nack (Generated) + pub fn gen_nack<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Nack, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + let mut flags = AMQPFlags::default(); + flags.add_flag("multiple".to_string(), method.multiple); + flags.add_flag("requeue".to_string(), method.requeue); + input = gen_id(120)(input)?; + input = gen_long_long_uint(method.delivery_tag)(input)?; + + input = gen_flags(&flags)(input)?; + Ok(input) + } + } + /// basic properties (Generated) + #[derive(Clone, Debug, PartialEq)] + pub struct AMQPProperties { + content_type: Option<ShortString>, + content_encoding: Option<ShortString>, + headers: Option<FieldTable>, + delivery_mode: Option<ShortShortUInt>, + priority: Option<ShortShortUInt>, + correlation_id: Option<ShortString>, + reply_to: Option<ShortString>, + expiration: Option<ShortString>, + message_id: Option<ShortString>, + timestamp: Option<Timestamp>, + kind: Option<ShortString>, + user_id: Option<ShortString>, + app_id: Option<ShortString>, + cluster_id: Option<ShortString>, + } + + impl Default for AMQPProperties { + fn default() -> AMQPProperties { + AMQPProperties { + content_type: None, + content_encoding: None, + headers: None, + delivery_mode: None, + priority: None, + correlation_id: None, + reply_to: None, + expiration: None, + message_id: None, + timestamp: None, + kind: None, + user_id: None, + app_id: None, + cluster_id: None, + } + } + } + + impl AMQPProperties { + /// Set content-type (Generated) + pub fn with_content_type(mut self, value: ShortString) -> AMQPProperties { + self.content_type = Some(value); + self + } + /// Set content-encoding (Generated) + pub fn with_content_encoding(mut self, value: ShortString) -> AMQPProperties { + self.content_encoding = Some(value); + self + } + /// Set headers (Generated) + pub fn with_headers(mut self, value: FieldTable) -> AMQPProperties { + self.headers = Some(value); + self + } + /// Set delivery-mode (Generated) + pub fn with_delivery_mode(mut self, value: ShortShortUInt) -> AMQPProperties { + self.delivery_mode = Some(value); + self + } + /// Set priority (Generated) + pub fn with_priority(mut self, value: ShortShortUInt) -> AMQPProperties { + self.priority = Some(value); + self + } + /// Set correlation-id (Generated) + pub fn with_correlation_id(mut self, value: ShortString) -> AMQPProperties { + self.correlation_id = Some(value); + self + } + /// Set reply-to (Generated) + pub fn with_reply_to(mut self, value: ShortString) -> AMQPProperties { + self.reply_to = Some(value); + self + } + /// Set expiration (Generated) + pub fn with_expiration(mut self, value: ShortString) -> AMQPProperties { + self.expiration = Some(value); + self + } + /// Set message-id (Generated) + pub fn with_message_id(mut self, value: ShortString) -> AMQPProperties { + self.message_id = Some(value); + self + } + /// Set timestamp (Generated) + pub fn with_timestamp(mut self, value: Timestamp) -> AMQPProperties { + self.timestamp = Some(value); + self + } + /// Set type (Generated) + pub fn with_kind(mut self, value: ShortString) -> AMQPProperties { + self.kind = Some(value); + self + } + /// Set user-id (Generated) + pub fn with_user_id(mut self, value: ShortString) -> AMQPProperties { + self.user_id = Some(value); + self + } + /// Set app-id (Generated) + pub fn with_app_id(mut self, value: ShortString) -> AMQPProperties { + self.app_id = Some(value); + self + } + /// Set cluster-id (Generated) + pub fn with_cluster_id(mut self, value: ShortString) -> AMQPProperties { + self.cluster_id = Some(value); + self + } + /// Get content-type (Generated) + pub fn content_type(&self) -> &Option<ShortString> { + &self.content_type + } + /// Get content-encoding (Generated) + pub fn content_encoding(&self) -> &Option<ShortString> { + &self.content_encoding + } + /// Get headers (Generated) + pub fn headers(&self) -> &Option<FieldTable> { + &self.headers + } + /// Get delivery-mode (Generated) + pub fn delivery_mode(&self) -> &Option<ShortShortUInt> { + &self.delivery_mode + } + /// Get priority (Generated) + pub fn priority(&self) -> &Option<ShortShortUInt> { + &self.priority + } + /// Get correlation-id (Generated) + pub fn correlation_id(&self) -> &Option<ShortString> { + &self.correlation_id + } + /// Get reply-to (Generated) + pub fn reply_to(&self) -> &Option<ShortString> { + &self.reply_to + } + /// Get expiration (Generated) + pub fn expiration(&self) -> &Option<ShortString> { + &self.expiration + } + /// Get message-id (Generated) + pub fn message_id(&self) -> &Option<ShortString> { + &self.message_id + } + /// Get timestamp (Generated) + pub fn timestamp(&self) -> &Option<Timestamp> { + &self.timestamp + } + /// Get type (Generated) + pub fn kind(&self) -> &Option<ShortString> { + &self.kind + } + /// Get user-id (Generated) + pub fn user_id(&self) -> &Option<ShortString> { + &self.user_id + } + /// Get app-id (Generated) + pub fn app_id(&self) -> &Option<ShortString> { + &self.app_id + } + /// Get cluster-id (Generated) + pub fn cluster_id(&self) -> &Option<ShortString> { + &self.cluster_id + } + /// Get the bitmask for serialization (Generated) + #[allow(clippy::identity_op)] + pub fn bitmask(&self) -> ShortUInt { + (if self.content_type.is_some() { + 1 << (15 - 0) + } else { + 0 + }) + (if self.content_encoding.is_some() { + 1 << (15 - 1) + } else { + 0 + }) + (if self.headers.is_some() { + 1 << (15 - 2) + } else { + 0 + }) + (if self.delivery_mode.is_some() { + 1 << (15 - 3) + } else { + 0 + }) + (if self.priority.is_some() { + 1 << (15 - 4) + } else { + 0 + }) + (if self.correlation_id.is_some() { + 1 << (15 - 5) + } else { + 0 + }) + (if self.reply_to.is_some() { + 1 << (15 - 6) + } else { + 0 + }) + (if self.expiration.is_some() { + 1 << (15 - 7) + } else { + 0 + }) + (if self.message_id.is_some() { + 1 << (15 - 8) + } else { + 0 + }) + (if self.timestamp.is_some() { + 1 << (15 - 9) + } else { + 0 + }) + (if self.kind.is_some() { + 1 << (15 - 10) + } else { + 0 + }) + (if self.user_id.is_some() { + 1 << (15 - 11) + } else { + 0 + }) + (if self.app_id.is_some() { + 1 << (15 - 12) + } else { + 0 + }) + (if self.cluster_id.is_some() { + 1 << (15 - 13) + } else { + 0 + }) + } + } + + /// Parse basic properties (Generated) + #[allow(clippy::identity_op)] + pub fn parse_properties<I: ParsableInput>(i: I) -> ParserResult<I, AMQPProperties> { + let (i, flags) = parse_short_uint(i)?; + let (i, content_type) = if flags & (1 << (15 - 0)) != 0 { + map(parse_short_string, Some)(i)? + } else { + (i, None) + }; + let (i, content_encoding) = if flags & (1 << (15 - 1)) != 0 { + map(parse_short_string, Some)(i)? + } else { + (i, None) + }; + let (i, headers) = if flags & (1 << (15 - 2)) != 0 { + map(parse_field_table, Some)(i)? + } else { + (i, None) + }; + let (i, delivery_mode) = if flags & (1 << (15 - 3)) != 0 { + map(parse_short_short_uint, Some)(i)? + } else { + (i, None) + }; + let (i, priority) = if flags & (1 << (15 - 4)) != 0 { + map(parse_short_short_uint, Some)(i)? + } else { + (i, None) + }; + let (i, correlation_id) = if flags & (1 << (15 - 5)) != 0 { + map(parse_short_string, Some)(i)? + } else { + (i, None) + }; + let (i, reply_to) = if flags & (1 << (15 - 6)) != 0 { + map(parse_short_string, Some)(i)? + } else { + (i, None) + }; + let (i, expiration) = if flags & (1 << (15 - 7)) != 0 { + map(parse_short_string, Some)(i)? + } else { + (i, None) + }; + let (i, message_id) = if flags & (1 << (15 - 8)) != 0 { + map(parse_short_string, Some)(i)? + } else { + (i, None) + }; + let (i, timestamp) = if flags & (1 << (15 - 9)) != 0 { + map(parse_timestamp, Some)(i)? + } else { + (i, None) + }; + let (i, kind) = if flags & (1 << (15 - 10)) != 0 { + map(parse_short_string, Some)(i)? + } else { + (i, None) + }; + let (i, user_id) = if flags & (1 << (15 - 11)) != 0 { + map(parse_short_string, Some)(i)? + } else { + (i, None) + }; + let (i, app_id) = if flags & (1 << (15 - 12)) != 0 { + map(parse_short_string, Some)(i)? + } else { + (i, None) + }; + let (i, cluster_id) = if flags & (1 << (15 - 13)) != 0 { + map(parse_short_string, Some)(i)? + } else { + (i, None) + }; + Ok(( + i, + AMQPProperties { + content_type, + content_encoding, + headers, + delivery_mode, + priority, + correlation_id, + reply_to, + expiration, + message_id, + timestamp, + kind, + user_id, + app_id, + cluster_id, + }, + )) + } + + /// Serialize basic properties (Generated) + pub fn gen_properties<'a, W: Write + BackToTheBuffer + 'a>( + props: &'a AMQPProperties, + ) -> impl SerializeFn<W> + 'a { + cookie_factory::sequence::pair(gen_short_uint(props.bitmask()), move |mut input| { + if let Some(prop) = props.content_type.as_ref() { + input = gen_short_string(prop.as_str())(input)?; + } + if let Some(prop) = props.content_encoding.as_ref() { + input = gen_short_string(prop.as_str())(input)?; + } + if let Some(prop) = props.headers.as_ref() { + input = gen_field_table(prop)(input)?; + } + if let Some(prop) = props.delivery_mode { + input = gen_short_short_uint(prop)(input)?; + } + if let Some(prop) = props.priority { + input = gen_short_short_uint(prop)(input)?; + } + if let Some(prop) = props.correlation_id.as_ref() { + input = gen_short_string(prop.as_str())(input)?; + } + if let Some(prop) = props.reply_to.as_ref() { + input = gen_short_string(prop.as_str())(input)?; + } + if let Some(prop) = props.expiration.as_ref() { + input = gen_short_string(prop.as_str())(input)?; + } + if let Some(prop) = props.message_id.as_ref() { + input = gen_short_string(prop.as_str())(input)?; + } + if let Some(prop) = props.timestamp { + input = gen_timestamp(prop)(input)?; + } + if let Some(prop) = props.kind.as_ref() { + input = gen_short_string(prop.as_str())(input)?; + } + if let Some(prop) = props.user_id.as_ref() { + input = gen_short_string(prop.as_str())(input)?; + } + if let Some(prop) = props.app_id.as_ref() { + input = gen_short_string(prop.as_str())(input)?; + } + if let Some(prop) = props.cluster_id.as_ref() { + input = gen_short_string(prop.as_str())(input)?; + } + Ok(input) + }) + } +} + +/// tx (generated) +pub mod tx { + use super::*; + + /// Parse tx (Generated) + pub fn parse_tx<I: ParsableInput>(i: I) -> ParserResult<I, tx::AMQPMethod> { + context( + "parse_tx", + map_opt( + flat_map(parse_id, |id| { + move |i| match id { + 10 => context( + "parse_select", + map(map(parse_select, AMQPMethod::Select), Some), + )(i), + 11 => context( + "parse_select_ok", + map(map(parse_select_ok, AMQPMethod::SelectOk), Some), + )(i), + 20 => context( + "parse_commit", + map(map(parse_commit, AMQPMethod::Commit), Some), + )(i), + 21 => context( + "parse_commit_ok", + map(map(parse_commit_ok, AMQPMethod::CommitOk), Some), + )(i), + 30 => context( + "parse_rollback", + map(map(parse_rollback, AMQPMethod::Rollback), Some), + )(i), + 31 => context( + "parse_rollback_ok", + map(map(parse_rollback_ok, AMQPMethod::RollbackOk), Some), + )(i), + _ => Ok((i, None)), + } + }), + std::convert::identity, + ), + )(i) + } + + /// Serialize tx (Generated) + pub fn gen_tx<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a AMQPMethod, + ) -> impl SerializeFn<W> + 'a { + cookie_factory::sequence::pair(gen_id(90), move |input| match *method { + AMQPMethod::Select(ref select) => gen_select(select)(input), + AMQPMethod::SelectOk(ref select_ok) => gen_select_ok(select_ok)(input), + AMQPMethod::Commit(ref commit) => gen_commit(commit)(input), + AMQPMethod::CommitOk(ref commit_ok) => gen_commit_ok(commit_ok)(input), + AMQPMethod::Rollback(ref rollback) => gen_rollback(rollback)(input), + AMQPMethod::RollbackOk(ref rollback_ok) => gen_rollback_ok(rollback_ok)(input), + }) + } + + /// The available methods in tx + #[derive(Clone, Debug, PartialEq)] + pub enum AMQPMethod { + /// select (Generated) + Select(Select), + /// select-ok (Generated) + SelectOk(SelectOk), + /// commit (Generated) + Commit(Commit), + /// commit-ok (Generated) + CommitOk(CommitOk), + /// rollback (Generated) + Rollback(Rollback), + /// rollback-ok (Generated) + RollbackOk(RollbackOk), + } + + /// select (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Select {} + + impl Select { + /// Get the AMQP class id for select (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 90 + } + + /// Get the AMQP method id for select (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 10 + } + } + + /// Parse select (Generated) + pub fn parse_select<I: ParsableInput>(i: I) -> ParserResult<I, Select> { + Ok((i, Select {})) + } + + /// Serialize select (Generated) + pub fn gen_select<'a, W: Write + BackToTheBuffer + 'a>( + _: &'a Select, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(10)(input)?; + Ok(input) + } + } + + /// select-ok (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct SelectOk {} + + impl SelectOk { + /// Get the AMQP class id for select-ok (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 90 + } + + /// Get the AMQP method id for select-ok (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 11 + } + } + + /// Parse select-ok (Generated) + pub fn parse_select_ok<I: ParsableInput>(i: I) -> ParserResult<I, SelectOk> { + Ok((i, SelectOk {})) + } + + /// Serialize select-ok (Generated) + pub fn gen_select_ok<'a, W: Write + BackToTheBuffer + 'a>( + _: &'a SelectOk, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(11)(input)?; + Ok(input) + } + } + + /// commit (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Commit {} + + impl Commit { + /// Get the AMQP class id for commit (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 90 + } + + /// Get the AMQP method id for commit (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 20 + } + } + + /// Parse commit (Generated) + pub fn parse_commit<I: ParsableInput>(i: I) -> ParserResult<I, Commit> { + Ok((i, Commit {})) + } + + /// Serialize commit (Generated) + pub fn gen_commit<'a, W: Write + BackToTheBuffer + 'a>( + _: &'a Commit, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(20)(input)?; + Ok(input) + } + } + + /// commit-ok (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct CommitOk {} + + impl CommitOk { + /// Get the AMQP class id for commit-ok (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 90 + } + + /// Get the AMQP method id for commit-ok (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 21 + } + } + + /// Parse commit-ok (Generated) + pub fn parse_commit_ok<I: ParsableInput>(i: I) -> ParserResult<I, CommitOk> { + Ok((i, CommitOk {})) + } + + /// Serialize commit-ok (Generated) + pub fn gen_commit_ok<'a, W: Write + BackToTheBuffer + 'a>( + _: &'a CommitOk, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(21)(input)?; + Ok(input) + } + } + + /// rollback (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Rollback {} + + impl Rollback { + /// Get the AMQP class id for rollback (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 90 + } + + /// Get the AMQP method id for rollback (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 30 + } + } + + /// Parse rollback (Generated) + pub fn parse_rollback<I: ParsableInput>(i: I) -> ParserResult<I, Rollback> { + Ok((i, Rollback {})) + } + + /// Serialize rollback (Generated) + pub fn gen_rollback<'a, W: Write + BackToTheBuffer + 'a>( + _: &'a Rollback, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(30)(input)?; + Ok(input) + } + } + + /// rollback-ok (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct RollbackOk {} + + impl RollbackOk { + /// Get the AMQP class id for rollback-ok (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 90 + } + + /// Get the AMQP method id for rollback-ok (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 31 + } + } + + /// Parse rollback-ok (Generated) + pub fn parse_rollback_ok<I: ParsableInput>(i: I) -> ParserResult<I, RollbackOk> { + Ok((i, RollbackOk {})) + } + + /// Serialize rollback-ok (Generated) + pub fn gen_rollback_ok<'a, W: Write + BackToTheBuffer + 'a>( + _: &'a RollbackOk, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(31)(input)?; + Ok(input) + } + } +} + +/// confirm (generated) +pub mod confirm { + use super::*; + + /// Parse confirm (Generated) + pub fn parse_confirm<I: ParsableInput>(i: I) -> ParserResult<I, confirm::AMQPMethod> { + context( + "parse_confirm", + map_opt( + flat_map(parse_id, |id| { + move |i| match id { + 10 => context( + "parse_select", + map(map(parse_select, AMQPMethod::Select), Some), + )(i), + 11 => context( + "parse_select_ok", + map(map(parse_select_ok, AMQPMethod::SelectOk), Some), + )(i), + _ => Ok((i, None)), + } + }), + std::convert::identity, + ), + )(i) + } + + /// Serialize confirm (Generated) + pub fn gen_confirm<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a AMQPMethod, + ) -> impl SerializeFn<W> + 'a { + cookie_factory::sequence::pair(gen_id(85), move |input| match *method { + AMQPMethod::Select(ref select) => gen_select(select)(input), + AMQPMethod::SelectOk(ref select_ok) => gen_select_ok(select_ok)(input), + }) + } + + /// The available methods in confirm + #[derive(Clone, Debug, PartialEq)] + pub enum AMQPMethod { + /// select (Generated) + Select(Select), + /// select-ok (Generated) + SelectOk(SelectOk), + } + + /// select (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Select { + /// nowait (Generated) + pub nowait: Boolean, + } + + impl Select { + /// Get the AMQP class id for select (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 85 + } + + /// Get the AMQP method id for select (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 10 + } + } + + /// Parse select (Generated) + pub fn parse_select<I: ParsableInput>(i: I) -> ParserResult<I, Select> { + let (i, flags) = parse_flags(i, &["nowait"])?; + Ok(( + i, + Select { + nowait: flags.get_flag("nowait").unwrap_or(false), + }, + )) + } + + /// Serialize select (Generated) + pub fn gen_select<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Select, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + let mut flags = AMQPFlags::default(); + flags.add_flag("nowait".to_string(), method.nowait); + input = gen_id(10)(input)?; + + input = gen_flags(&flags)(input)?; + Ok(input) + } + } + + /// select-ok (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct SelectOk {} + + impl SelectOk { + /// Get the AMQP class id for select-ok (Generated) + pub fn get_amqp_class_id(&self) -> u16 { + 85 + } + + /// Get the AMQP method id for select-ok (Generated) + pub fn get_amqp_method_id(&self) -> u16 { + 11 + } + } + + /// Parse select-ok (Generated) + pub fn parse_select_ok<I: ParsableInput>(i: I) -> ParserResult<I, SelectOk> { + Ok((i, SelectOk {})) + } + + /// Serialize select-ok (Generated) + pub fn gen_select_ok<'a, W: Write + BackToTheBuffer + 'a>( + _: &'a SelectOk, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(11)(input)?; + Ok(input) + } + } +} diff --git a/protocol/src/protocol.rs b/protocol/src/protocol.rs index b926ba77..01eba6ef 100644 --- a/protocol/src/protocol.rs +++ b/protocol/src/protocol.rs @@ -10,7 +10,10 @@ use nom::{ }; use std::{convert::TryFrom, error, fmt, io::Write}; +#[cfg(feature = "codegen")] include!(concat!(env!("OUT_DIR"), "/protocol.rs")); +#[cfg(not(feature = "codegen"))] +include!("generated.rs"); /// Type alias for AMQP BasicProperties pub type BasicProperties = basic::AMQPProperties; diff --git a/regen-code.sh b/regen-code.sh new file mode 100755 index 00000000..bdce42f3 --- /dev/null +++ b/regen-code.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +main() { + export AMQ_PROTOCOL_CODEGEN_DIR="$(dirname "${0}" | xargs realpath)/protocol/src/" + export AMQ_PROTOCOL_CODEGEN_FILE="generated" + + cargo build --manifest-path protocol/Cargo.toml --features=codegen-internal + rustfmt "${AMQ_PROTOCOL_CODEGEN_DIR}/${AMQ_PROTOCOL_CODEGEN_FILE}.rs" +} + +main "${@}" From 0a93aa0e8dd9adaa6296de8d8e952f54f9c96e08 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Tue, 9 Jun 2020 21:31:02 +0200 Subject: [PATCH 019/133] update minimum rust version Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f8306905..a72fc0da 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ cache: cargo matrix: include: - - rust: 1.37.0 + - rust: 1.40.0 - rust: stable - rust: beta - rust: nightly From 24e88bfc972f0de18c9f911a58f4951c8c33caf2 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Tue, 9 Jun 2020 21:31:20 +0200 Subject: [PATCH 020/133] reenable minimum version check Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- .travis.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index a72fc0da..f1be5280 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,10 +17,9 @@ matrix: - rust: nightly - rust: nightly os: osx -# Pest dependency on quote is broken, doesn't build with min version -# - rust: nightly -# script: -# - cargo -Z minimal-versions test --verbose --all --all-features + - rust: nightly + script: + - cargo -Z minimal-versions test --verbose --all --all-features script: - cargo build --verbose --all --all-features From 00a2a2995029fd2ec9c36108900f8a5f43a52211 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Tue, 9 Jun 2020 21:40:12 +0200 Subject: [PATCH 021/133] Revert "reenable minimum version check" This reverts commit 24e88bfc972f0de18c9f911a58f4951c8c33caf2. --- .travis.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index f1be5280..a72fc0da 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,9 +17,10 @@ matrix: - rust: nightly - rust: nightly os: osx - - rust: nightly - script: - - cargo -Z minimal-versions test --verbose --all --all-features +# Pest dependency on quote is broken, doesn't build with min version +# - rust: nightly +# script: +# - cargo -Z minimal-versions test --verbose --all --all-features script: - cargo build --verbose --all --all-features From 8b0ca9e6747260ac5be9804cab4356b6b0b1dd60 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Tue, 9 Jun 2020 21:50:45 +0200 Subject: [PATCH 022/133] v6.0.0-rc11 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/Cargo.toml | 4 ++-- codegen/src/lib.rs | 2 +- protocol/Cargo.toml | 10 +++++----- protocol/src/lib.rs | 2 +- tcp/Cargo.toml | 4 ++-- tcp/src/lib.rs | 2 +- types/Cargo.toml | 2 +- types/src/lib.rs | 2 +- uri/Cargo.toml | 2 +- uri/src/lib.rs | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 59dec5d3..2385316e 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "6.0.0-rc10" # remember to update html_root_url +version = "6.0.0-rc11" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" @@ -18,7 +18,7 @@ handlebars = "^3.0" serde_json = "^1.0" [dependencies.amq-protocol-types] -version = "=6.0.0-rc10" +version = "=6.0.0-rc11" path = "../types" [dependencies.serde] diff --git a/codegen/src/lib.rs b/codegen/src/lib.rs index fa0c05aa..09fde870 100644 --- a/codegen/src/lib.rs +++ b/codegen/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/6.0.0-rc10/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/6.0.0-rc11/")] //! # AMQP code generation utilities //! diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index 688eb4e4..cf8b57e2 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "6.0.0-rc10" # remember to update html_root_url +version = "6.0.0-rc11" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" @@ -27,21 +27,21 @@ vendored-openssl = ["amq-protocol-tcp/vendored-openssl"] verbose-errors = ["amq-protocol-types/verbose-errors"] [build-dependencies.amq-protocol-codegen] -version = "=6.0.0-rc10" +version = "=6.0.0-rc11" path = "../codegen" optional = true [dependencies.amq-protocol-tcp] -version = "=6.0.0-rc10" +version = "=6.0.0-rc11" default-features = false path = "../tcp" [dependencies.amq-protocol-types] -version = "=6.0.0-rc10" +version = "=6.0.0-rc11" path = "../types" [dependencies.amq-protocol-uri] -version = "=6.0.0-rc10" +version = "=6.0.0-rc11" path = "../uri" [dependencies.cookie-factory] diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs index 27c247f3..02f74397 100644 --- a/protocol/src/lib.rs +++ b/protocol/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol/6.0.0-rc10/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol/6.0.0-rc11/")] //! # AMQP manipulation library //! diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index 97571fa5..a529583b 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "6.0.0-rc10" # remember to update html_root_url +version = "6.0.0-rc11" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" @@ -27,7 +27,7 @@ vendored-openssl = ["tcp-stream/vendored-openssl"] log = "^0.4" [dependencies.amq-protocol-uri] -version = "=6.0.0-rc10" +version = "=6.0.0-rc11" path = "../uri" [dependencies.tcp-stream] diff --git a/tcp/src/lib.rs b/tcp/src/lib.rs index 497bf08d..4d534ea9 100644 --- a/tcp/src/lib.rs +++ b/tcp/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/6.0.0-rc10/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/6.0.0-rc11/")] //! # AMQP URI TCP connection handling //! diff --git a/types/Cargo.toml b/types/Cargo.toml index ac4375c0..8f8eb7c1 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "6.0.0-rc10" # remember to update html_root_url +version = "6.0.0-rc11" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/types/src/lib.rs b/types/src/lib.rs index d385c1b7..8bb51284 100644 --- a/types/src/lib.rs +++ b/types/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-types/6.0.0-rc10/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-types/6.0.0-rc11/")] //! # AMQP types manipulation library //! diff --git a/uri/Cargo.toml b/uri/Cargo.toml index 8fb16346..d6be10f7 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "6.0.0-rc10" # remember to update html_root_url +version = "6.0.0-rc11" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" diff --git a/uri/src/lib.rs b/uri/src/lib.rs index 57d32bb8..09654a5d 100644 --- a/uri/src/lib.rs +++ b/uri/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/6.0.0-rc10/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/6.0.0-rc11/")] //! # AMQP URI manipulation library //! From d462dd2fdda8412d8d7779c67b74d960428a6a1d Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Thu, 25 Jun 2020 22:02:57 +0200 Subject: [PATCH 023/133] update tcp-stream Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- tcp/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index a529583b..a5cbd346 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -31,7 +31,7 @@ version = "=6.0.0-rc11" path = "../uri" [dependencies.tcp-stream] -version = "^0.19.3" +version = "^0.20" default-features = false [badges] From 4b564b3d80b6f26a361abeb06131f0dafc97f0cd Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Thu, 25 Jun 2020 22:05:15 +0200 Subject: [PATCH 024/133] switch to github actions Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- .github/FUNDING.yml | 1 + .github/workflows/build-and-test.yaml | 51 +++++++++++++++++++++++++++ .github/workflows/lint.yaml | 44 +++++++++++++++++++++++ .github/workflows/security.yaml | 20 +++++++++++ .travis.yml | 33 ----------------- README.md | 6 ++-- appveyor.yml | 44 ----------------------- 7 files changed, 119 insertions(+), 80 deletions(-) create mode 100644 .github/FUNDING.yml create mode 100644 .github/workflows/build-and-test.yaml create mode 100644 .github/workflows/lint.yaml create mode 100644 .github/workflows/security.yaml delete mode 100644 .travis.yml delete mode 100644 appveyor.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..0f5af72e --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: Keruspe diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml new file mode 100644 index 00000000..831c974c --- /dev/null +++ b/.github/workflows/build-and-test.yaml @@ -0,0 +1,51 @@ +name: Build and test + +on: + push: + branches: + - master + pull_request: + +jobs: + build_and_test: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + rust: [nightly, beta, stable, 1.40.0] + steps: + - uses: actions/checkout@v2 + + - name: Set current week of the year in environnement + if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macOS') + run: echo "::set-env name=CURRENT_WEEK::$(date +%V)" + + - name: Set current week of the year in environnement + if: startsWith(matrix.os, 'windows') + run: echo "::set-env name=CURRENT_WEEK::$(Get-Date -UFormat %V)" + + - name: Install latest ${{ matrix.rust }} + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + profile: minimal + override: true + + - name: Run cargo check + uses: actions-rs/cargo@v1 + with: + command: check + args: --all --bins --examples --tests --all-features + + - name: Run cargo check (without dev-dependencies to catch missing feature flags) + if: startsWith(matrix.rust, 'nightly') + uses: actions-rs/cargo@v1 + with: + command: check + args: -Z features=dev_dep + + - name: Run cargo test + uses: actions-rs/cargo@v1 + with: + command: test diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 00000000..d13341e3 --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,44 @@ +name: Lint + +on: + push: + branches: + - master + pull_request: + +jobs: + clippy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Set current week of the year in environnement + run: echo "::set-env name=CURRENT_WEEK::$(date +%V)" + + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + components: clippy + - uses: actions-rs/clippy-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --all-features -- -W clippy::all + + rustfmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Set current week of the year in environnement + run: echo "::set-env name=CURRENT_WEEK::$(date +%V)" + + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + components: rustfmt + - uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check diff --git a/.github/workflows/security.yaml b/.github/workflows/security.yaml new file mode 100644 index 00000000..8fb32963 --- /dev/null +++ b/.github/workflows/security.yaml @@ -0,0 +1,20 @@ +name: Security audit + +on: + push: + branches: + - master + pull_request: + +jobs: + security_audit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Set current week of the year in environnement + run: echo "::set-env name=CURRENT_WEEK::$(date +%V)" + + - uses: actions-rs/audit-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a72fc0da..00000000 --- a/.travis.yml +++ /dev/null @@ -1,33 +0,0 @@ -language: rust - -sudo: required - -addons: - apt: - packages: - - libssl-dev - -cache: cargo - -matrix: - include: - - rust: 1.40.0 - - rust: stable - - rust: beta - - rust: nightly - - rust: nightly - os: osx -# Pest dependency on quote is broken, doesn't build with min version -# - rust: nightly -# script: -# - cargo -Z minimal-versions test --verbose --all --all-features - -script: - - cargo build --verbose --all --all-features - - cargo test --verbose --all --all-features - -after_success: | - if [[ "$TRAVIS_RUST_VERSION" == stable ]]; then - RUSTFLAGS="--cfg procmacro2_semver_exempt" cargo install cargo-tarpaulin - cargo tarpaulin --ciserver travis-ci --coveralls $TRAVIS_JOB_ID - fi diff --git a/README.md b/README.md index d25166cd..be36c63f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # amq-protocol -[](https://travis-ci.org/sozu-proxy/amq-protocol) -[](https://ci.appveyor.com/project/Keruspe/amq-protocol/branch/master) -[](https://coveralls.io/github/sozu-proxy/amq-protocol?branch=master) +[](https://docs.rs/amq-protocol) +[](https://github.com/Keruspe/amq-protocol/actions) +[](https://crates.io/crates/amq-protocol) diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 79c13838..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,44 +0,0 @@ -os: Visual Studio 2015 - -environment: - matrix: - # MSVC - - channel: stable - target: x86_64-pc-windows-msvc - - channel: stable - target: i686-pc-windows-msvc - - channel: beta - target: x86_64-pc-windows-msvc - - channel: beta - target: i686-pc-windows-msvc - - channel: nightly - target: x86_64-pc-windows-msvc - - channel: nightly - target: i686-pc-windows-msvc - # GNU - - channel: stable - target: x86_64-pc-windows-gnu - - channel: stable - target: i686-pc-windows-gnu - - channel: beta - target: x86_64-pc-windows-gnu - - channel: beta - target: i686-pc-windows-gnu - - channel: nightly - target: x86_64-pc-windows-gnu - - channel: nightly - target: i686-pc-windows-gnu - -install: - - appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe - - rustup-init -yv --default-toolchain %channel% --default-host %target% - - set PATH=%PATH%;%USERPROFILE%\.cargo\bin - - rustc -vV - - cargo -vV - -# 'cargo test' takes care of building for us, so disable Appveyor's build stage. This prevents -# the "directory does not contain a project or solution file" error. -build: false - -test_script: - - cargo test --all --verbose %cargoflags% From 3c5fa710147f6f30b04b0ac47375d2a6474bea74 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Thu, 25 Jun 2020 22:19:12 +0200 Subject: [PATCH 025/133] v6.0.0-rc12 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/Cargo.toml | 4 ++-- codegen/src/lib.rs | 2 +- protocol/Cargo.toml | 10 +++++----- protocol/src/lib.rs | 2 +- tcp/Cargo.toml | 4 ++-- tcp/src/lib.rs | 2 +- types/Cargo.toml | 2 +- types/src/lib.rs | 2 +- uri/Cargo.toml | 2 +- uri/src/lib.rs | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 2385316e..c1352eef 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "6.0.0-rc11" # remember to update html_root_url +version = "6.0.0-rc12" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" @@ -18,7 +18,7 @@ handlebars = "^3.0" serde_json = "^1.0" [dependencies.amq-protocol-types] -version = "=6.0.0-rc11" +version = "=6.0.0-rc12" path = "../types" [dependencies.serde] diff --git a/codegen/src/lib.rs b/codegen/src/lib.rs index 09fde870..5a734b0f 100644 --- a/codegen/src/lib.rs +++ b/codegen/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/6.0.0-rc11/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/6.0.0-rc12/")] //! # AMQP code generation utilities //! diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index cf8b57e2..0cf25c2a 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "6.0.0-rc11" # remember to update html_root_url +version = "6.0.0-rc12" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" @@ -27,21 +27,21 @@ vendored-openssl = ["amq-protocol-tcp/vendored-openssl"] verbose-errors = ["amq-protocol-types/verbose-errors"] [build-dependencies.amq-protocol-codegen] -version = "=6.0.0-rc11" +version = "=6.0.0-rc12" path = "../codegen" optional = true [dependencies.amq-protocol-tcp] -version = "=6.0.0-rc11" +version = "=6.0.0-rc12" default-features = false path = "../tcp" [dependencies.amq-protocol-types] -version = "=6.0.0-rc11" +version = "=6.0.0-rc12" path = "../types" [dependencies.amq-protocol-uri] -version = "=6.0.0-rc11" +version = "=6.0.0-rc12" path = "../uri" [dependencies.cookie-factory] diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs index 02f74397..482ae331 100644 --- a/protocol/src/lib.rs +++ b/protocol/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol/6.0.0-rc11/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol/6.0.0-rc12/")] //! # AMQP manipulation library //! diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index a5cbd346..8d3577a0 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "6.0.0-rc11" # remember to update html_root_url +version = "6.0.0-rc12" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" @@ -27,7 +27,7 @@ vendored-openssl = ["tcp-stream/vendored-openssl"] log = "^0.4" [dependencies.amq-protocol-uri] -version = "=6.0.0-rc11" +version = "=6.0.0-rc12" path = "../uri" [dependencies.tcp-stream] diff --git a/tcp/src/lib.rs b/tcp/src/lib.rs index 4d534ea9..032156a9 100644 --- a/tcp/src/lib.rs +++ b/tcp/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/6.0.0-rc11/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/6.0.0-rc12/")] //! # AMQP URI TCP connection handling //! diff --git a/types/Cargo.toml b/types/Cargo.toml index 8f8eb7c1..9b82facc 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "6.0.0-rc11" # remember to update html_root_url +version = "6.0.0-rc12" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/types/src/lib.rs b/types/src/lib.rs index 8bb51284..c72d0cf2 100644 --- a/types/src/lib.rs +++ b/types/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-types/6.0.0-rc11/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-types/6.0.0-rc12/")] //! # AMQP types manipulation library //! diff --git a/uri/Cargo.toml b/uri/Cargo.toml index d6be10f7..c0b27912 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "6.0.0-rc11" # remember to update html_root_url +version = "6.0.0-rc12" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" diff --git a/uri/src/lib.rs b/uri/src/lib.rs index 09654a5d..39c68207 100644 --- a/uri/src/lib.rs +++ b/uri/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/6.0.0-rc11/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/6.0.0-rc12/")] //! # AMQP URI manipulation library //! From 011ed7a80d4448b03ca2db48b50e73c03104b98d Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Thu, 25 Jun 2020 22:45:23 +0200 Subject: [PATCH 026/133] fix README Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index be36c63f..3aaa9d9c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # amq-protocol [](https://docs.rs/amq-protocol) -[](https://github.com/Keruspe/amq-protocol/actions) +[](https://github.com/CleverCloud/amq-protocol/actions) [](https://crates.io/crates/amq-protocol) From 8c45358e0a04c8240b4e40fda684b896a50d4f32 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Mon, 6 Jul 2020 09:08:22 +0200 Subject: [PATCH 027/133] codegen: better error reporting Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/src/templating.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codegen/src/templating.rs b/codegen/src/templating.rs index 03936cfb..29323fc2 100644 --- a/codegen/src/templating.rs +++ b/codegen/src/templating.rs @@ -302,9 +302,9 @@ impl HelperDef for EachArgumentHelper { } rc.push_block(block_context); let arguments: Vec<AMQPArgument> = serde_json::from_value(value.value().clone()) - .map_err(|_| { + .map_err(|err| { RenderError::new( - "Param is not a Vec<AMQPArgument> for helper \"each_argument\"", + format!("Param is not a Vec<AMQPArgument> for helper \"each_argument\": {}", err) ) })?; let len = arguments.len(); From 2bc3c5c5680a975cf67bf730b4b8d09bd467b2c9 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Mon, 6 Jul 2020 09:13:19 +0200 Subject: [PATCH 028/133] rustfmt Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/src/templating.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/codegen/src/templating.rs b/codegen/src/templating.rs index 29323fc2..510e7216 100644 --- a/codegen/src/templating.rs +++ b/codegen/src/templating.rs @@ -303,9 +303,10 @@ impl HelperDef for EachArgumentHelper { rc.push_block(block_context); let arguments: Vec<AMQPArgument> = serde_json::from_value(value.value().clone()) .map_err(|err| { - RenderError::new( - format!("Param is not a Vec<AMQPArgument> for helper \"each_argument\": {}", err) - ) + RenderError::new(format!( + "Param is not a Vec<AMQPArgument> for helper \"each_argument\": {}", + err + )) })?; let len = arguments.len(); let array_path = value.context_path(); From 963559bf88979004cfb32d65fee16c34eb98231f Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Tue, 28 Jul 2020 16:43:03 +0200 Subject: [PATCH 029/133] tcp: switch to tracing Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- tcp/Cargo.toml | 7 ++++--- tcp/src/lib.rs | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index 8d3577a0..d08790cf 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -23,9 +23,6 @@ rustls-webpki-roots-certs = ["tcp-stream/rustls-webpki-roots-certs", "rustls-con rustls-connector = ["tcp-stream/rustls-connector"] vendored-openssl = ["tcp-stream/vendored-openssl"] -[dependencies] -log = "^0.4" - [dependencies.amq-protocol-uri] version = "=6.0.0-rc12" path = "../uri" @@ -34,6 +31,10 @@ path = "../uri" version = "^0.20" default-features = false +[dependencies.tracing] +version = "^0.1" +default-features = false + [badges] travis-ci = { repository = "sozu-proxy/amq-protocol" } appveyor = { repository = "Keruspe/amq-protocol" } diff --git a/tcp/src/lib.rs b/tcp/src/lib.rs index 032156a9..1ed986f1 100644 --- a/tcp/src/lib.rs +++ b/tcp/src/lib.rs @@ -8,12 +8,12 @@ //! connecting to an AMQP URI use amq_protocol_uri::{AMQPScheme, AMQPUri}; -use log::trace; use std::{ mem::ManuallyDrop, ops::{Deref, DerefMut}, time::Duration, }; +use tracing::trace; /// Re-export TcpStream pub use tcp_stream::{ @@ -47,7 +47,7 @@ pub trait AMQPUriTcpExt { impl AMQPUriTcpExt for AMQPUri { fn connect_with_config(&self, config: TLSConfig<'_, '_, '_>) -> HandshakeResult { let uri = format!("{}:{}", self.authority.host, self.authority.port); - trace!("Connecting to {}", uri); + trace!(uri = %uri, "Connecting"); let stream = if let Some(timeout) = self.query.connection_timeout { TcpStream::connect_timeout(uri, Duration::from_millis(timeout)) } else { From 7360178ee907f4f54c037a58bb8f60d9799dd1d9 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Tue, 28 Jul 2020 16:58:44 +0200 Subject: [PATCH 030/133] tcp: tweak log Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- tcp/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcp/src/lib.rs b/tcp/src/lib.rs index 1ed986f1..9d7d6c06 100644 --- a/tcp/src/lib.rs +++ b/tcp/src/lib.rs @@ -47,7 +47,7 @@ pub trait AMQPUriTcpExt { impl AMQPUriTcpExt for AMQPUri { fn connect_with_config(&self, config: TLSConfig<'_, '_, '_>) -> HandshakeResult { let uri = format!("{}:{}", self.authority.host, self.authority.port); - trace!(uri = %uri, "Connecting"); + trace!(uri = %uri, "Connecting."); let stream = if let Some(timeout) = self.query.connection_timeout { TcpStream::connect_timeout(uri, Duration::from_millis(timeout)) } else { From 00a145993e36c09e8b68e78fd42c7d98f091a967 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Mon, 28 Sep 2020 12:43:47 +0200 Subject: [PATCH 031/133] update to nom 6.0.0-alpha2 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- protocol/Cargo.toml | 2 +- types/Cargo.toml | 2 +- types/src/parsing.rs | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index 0cf25c2a..103cf163 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -49,7 +49,7 @@ version = "^0.3" features = ["std"] [dependencies.nom] -version = "=6.0.0-alpha1" +version = "=6.0.0-alpha2" features = ["std"] [badges] diff --git a/types/Cargo.toml b/types/Cargo.toml index 9b82facc..5751ea8e 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -24,7 +24,7 @@ version = "^0.3" features = ["std"] [dependencies.nom] -version = "=6.0.0-alpha1" +version = "=6.0.0-alpha2" features = ["std"] [dependencies.serde] diff --git a/types/src/parsing.rs b/types/src/parsing.rs index 04f12c21..b1d2d268 100644 --- a/types/src/parsing.rs +++ b/types/src/parsing.rs @@ -63,6 +63,12 @@ impl<I> ContextError<I> for ParserErrors { } } +impl<I, E> nom::error::FromExternalError<I, E> for ParserErrors { + fn from_external_error(input: I, kind: ErrorKind, _e: E) -> Self { + Self::from_error_kind(input, kind) + } +} + impl fmt::Display for ParserErrors { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "Parser error: {:?}", self.error)?; From b0e517e75da7910d8fe6d6c20a02b5423e3ddc2b Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Sun, 4 Oct 2020 18:48:56 +0200 Subject: [PATCH 032/133] update to nom 6.0.0-alpha3 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- protocol/Cargo.toml | 2 +- types/Cargo.toml | 2 +- types/src/parsing.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index 103cf163..6e45f09d 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -49,7 +49,7 @@ version = "^0.3" features = ["std"] [dependencies.nom] -version = "=6.0.0-alpha2" +version = "=6.0.0-alpha3" features = ["std"] [badges] diff --git a/types/Cargo.toml b/types/Cargo.toml index 5751ea8e..10ba01ad 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -24,7 +24,7 @@ version = "^0.3" features = ["std"] [dependencies.nom] -version = "=6.0.0-alpha2" +version = "=6.0.0-alpha3" features = ["std"] [dependencies.serde] diff --git a/types/src/parsing.rs b/types/src/parsing.rs index b1d2d268..221804b0 100644 --- a/types/src/parsing.rs +++ b/types/src/parsing.rs @@ -6,7 +6,7 @@ use nom::{ error::{context, ContextError, ErrorKind, ParseError, VerboseErrorKind}, multi::fold_many0, number::streaming::{ - be_f32, be_f64, be_i16, be_i32, be_i64, be_i8, be_u16, be_u32, be_u64, be_u8, + be_f32, be_f64, be_i16, be_i32, be_i64, be_u16, be_u32, be_u64, i8 as be_i8, u8 as be_u8, }, sequence::pair, }; From 2b29c4b229f67469adecd91019467a64771f4bff Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Sun, 4 Oct 2020 20:51:35 +0200 Subject: [PATCH 033/133] update MSRV for bitvec Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- .github/workflows/build-and-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index 831c974c..6cdfaf59 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -13,7 +13,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - rust: [nightly, beta, stable, 1.40.0] + rust: [nightly, beta, stable, 1.42.0] steps: - uses: actions/checkout@v2 From a87725d5bb24f1138aaefec75969dcc608b74b1f Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Mon, 5 Oct 2020 09:15:20 +0200 Subject: [PATCH 034/133] update MSRV for bitvec Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- .github/workflows/build-and-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index 6cdfaf59..aebfb268 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -13,7 +13,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - rust: [nightly, beta, stable, 1.42.0] + rust: [nightly, beta, stable, 1.43.0] steps: - uses: actions/checkout@v2 From 19ccc560b9c934aa4317c0288b2a9218a9709df8 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Sun, 18 Oct 2020 09:01:36 +0200 Subject: [PATCH 035/133] update to nom 6.0.0-beta1 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- protocol/Cargo.toml | 2 +- types/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index 6e45f09d..b9533585 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -49,7 +49,7 @@ version = "^0.3" features = ["std"] [dependencies.nom] -version = "=6.0.0-alpha3" +version = "=6.0.0-beta1" features = ["std"] [badges] diff --git a/types/Cargo.toml b/types/Cargo.toml index 10ba01ad..a630a306 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -24,7 +24,7 @@ version = "^0.3" features = ["std"] [dependencies.nom] -version = "=6.0.0-alpha3" +version = "=6.0.0-beta1" features = ["std"] [dependencies.serde] From 4c20445b7aab2b71882d6187af7151135592e585 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Thu, 29 Oct 2020 14:00:37 +0100 Subject: [PATCH 036/133] update to nom 6.0 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- protocol/Cargo.toml | 2 +- types/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index b9533585..836ea09b 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -49,7 +49,7 @@ version = "^0.3" features = ["std"] [dependencies.nom] -version = "=6.0.0-beta1" +version = "^6.0" features = ["std"] [badges] diff --git a/types/Cargo.toml b/types/Cargo.toml index a630a306..c7d1b03d 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -24,7 +24,7 @@ version = "^0.3" features = ["std"] [dependencies.nom] -version = "=6.0.0-beta1" +version = "^6.0" features = ["std"] [dependencies.serde] From c8960fc5534c8b98a3befc64caef4a330ec9992e Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Thu, 29 Oct 2020 14:02:15 +0100 Subject: [PATCH 037/133] v6.0.0 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/Cargo.toml | 4 ++-- codegen/src/lib.rs | 2 +- protocol/Cargo.toml | 10 +++++----- protocol/src/lib.rs | 2 +- tcp/Cargo.toml | 4 ++-- tcp/src/lib.rs | 2 +- types/Cargo.toml | 2 +- types/src/lib.rs | 2 +- uri/Cargo.toml | 2 +- uri/src/lib.rs | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index c1352eef..58d8cf64 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "6.0.0-rc12" # remember to update html_root_url +version = "6.0.0" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" @@ -18,7 +18,7 @@ handlebars = "^3.0" serde_json = "^1.0" [dependencies.amq-protocol-types] -version = "=6.0.0-rc12" +version = "^6.0" path = "../types" [dependencies.serde] diff --git a/codegen/src/lib.rs b/codegen/src/lib.rs index 5a734b0f..4ecaddbf 100644 --- a/codegen/src/lib.rs +++ b/codegen/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/6.0.0-rc12/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/6.0.0/")] //! # AMQP code generation utilities //! diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index 836ea09b..e7d11580 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "6.0.0-rc12" # remember to update html_root_url +version = "6.0.0" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" @@ -27,21 +27,21 @@ vendored-openssl = ["amq-protocol-tcp/vendored-openssl"] verbose-errors = ["amq-protocol-types/verbose-errors"] [build-dependencies.amq-protocol-codegen] -version = "=6.0.0-rc12" +version = "^6.0" path = "../codegen" optional = true [dependencies.amq-protocol-tcp] -version = "=6.0.0-rc12" +version = "^6.0" default-features = false path = "../tcp" [dependencies.amq-protocol-types] -version = "=6.0.0-rc12" +version = "^6.0" path = "../types" [dependencies.amq-protocol-uri] -version = "=6.0.0-rc12" +version = "^6.0" path = "../uri" [dependencies.cookie-factory] diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs index 482ae331..bab87b2c 100644 --- a/protocol/src/lib.rs +++ b/protocol/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol/6.0.0-rc12/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol/6.0.0/")] //! # AMQP manipulation library //! diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index d08790cf..83eb00d5 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "6.0.0-rc12" # remember to update html_root_url +version = "6.0.0" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" @@ -24,7 +24,7 @@ rustls-connector = ["tcp-stream/rustls-connector"] vendored-openssl = ["tcp-stream/vendored-openssl"] [dependencies.amq-protocol-uri] -version = "=6.0.0-rc12" +version = "^6.0" path = "../uri" [dependencies.tcp-stream] diff --git a/tcp/src/lib.rs b/tcp/src/lib.rs index 9d7d6c06..3818898d 100644 --- a/tcp/src/lib.rs +++ b/tcp/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/6.0.0-rc12/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/6.0.0/")] //! # AMQP URI TCP connection handling //! diff --git a/types/Cargo.toml b/types/Cargo.toml index c7d1b03d..cf58771e 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "6.0.0-rc12" # remember to update html_root_url +version = "6.0.0" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/types/src/lib.rs b/types/src/lib.rs index c72d0cf2..3e5e582b 100644 --- a/types/src/lib.rs +++ b/types/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-types/6.0.0-rc12/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-types/6.0.0/")] //! # AMQP types manipulation library //! diff --git a/uri/Cargo.toml b/uri/Cargo.toml index c0b27912..423b5611 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "6.0.0-rc12" # remember to update html_root_url +version = "6.0.0" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" diff --git a/uri/src/lib.rs b/uri/src/lib.rs index 39c68207..40930fd1 100644 --- a/uri/src/lib.rs +++ b/uri/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/6.0.0-rc12/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/6.0.0/")] //! # AMQP URI manipulation library //! From 61d9b0aec82df31dc654ad3e3e9031322fe5f405 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Sat, 31 Oct 2020 22:49:46 +0100 Subject: [PATCH 038/133] types: reexport nom::Needed Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- types/src/parsing.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/src/parsing.rs b/types/src/parsing.rs index 221804b0..2bd7ac67 100644 --- a/types/src/parsing.rs +++ b/types/src/parsing.rs @@ -294,7 +294,7 @@ pub fn parse_flags<I: ParsableInput>(i: I, names: &[&str]) -> ParserResult<I, AM /// Traits required for parsing pub mod traits { /// Reexport nom traits required for parsing - pub use nom::{Compare, InputIter, InputLength, InputTake, Slice, UnspecializedInput}; + pub use nom::{Compare, InputIter, InputLength, InputTake, Needed, Slice, UnspecializedInput}; /// Trait used to ensure we can properly parse input pub trait ParsableInput: From 12e7e0ed5933a331ad160751b806c2158c904d23 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Sat, 31 Oct 2020 22:51:53 +0100 Subject: [PATCH 039/133] v6.0.1 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/Cargo.toml | 4 ++-- codegen/src/lib.rs | 2 +- protocol/Cargo.toml | 10 +++++----- protocol/src/lib.rs | 2 +- tcp/Cargo.toml | 4 ++-- tcp/src/lib.rs | 2 +- types/Cargo.toml | 2 +- types/src/lib.rs | 2 +- uri/Cargo.toml | 2 +- uri/src/lib.rs | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 58d8cf64..c36c7480 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "6.0.0" # remember to update html_root_url +version = "6.0.1" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" @@ -18,7 +18,7 @@ handlebars = "^3.0" serde_json = "^1.0" [dependencies.amq-protocol-types] -version = "^6.0" +version = "^6.0.1" path = "../types" [dependencies.serde] diff --git a/codegen/src/lib.rs b/codegen/src/lib.rs index 4ecaddbf..c51d3884 100644 --- a/codegen/src/lib.rs +++ b/codegen/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/6.0.0/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/6.0.1/")] //! # AMQP code generation utilities //! diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index e7d11580..fc5ae337 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "6.0.0" # remember to update html_root_url +version = "6.0.1" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" @@ -27,21 +27,21 @@ vendored-openssl = ["amq-protocol-tcp/vendored-openssl"] verbose-errors = ["amq-protocol-types/verbose-errors"] [build-dependencies.amq-protocol-codegen] -version = "^6.0" +version = "^6.0.1" path = "../codegen" optional = true [dependencies.amq-protocol-tcp] -version = "^6.0" +version = "^6.0.1" default-features = false path = "../tcp" [dependencies.amq-protocol-types] -version = "^6.0" +version = "^6.0.1" path = "../types" [dependencies.amq-protocol-uri] -version = "^6.0" +version = "^6.0.1" path = "../uri" [dependencies.cookie-factory] diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs index bab87b2c..3c22010f 100644 --- a/protocol/src/lib.rs +++ b/protocol/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol/6.0.0/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol/6.0.1/")] //! # AMQP manipulation library //! diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index 83eb00d5..60fb6116 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "6.0.0" # remember to update html_root_url +version = "6.0.1" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" @@ -24,7 +24,7 @@ rustls-connector = ["tcp-stream/rustls-connector"] vendored-openssl = ["tcp-stream/vendored-openssl"] [dependencies.amq-protocol-uri] -version = "^6.0" +version = "^6.0.1" path = "../uri" [dependencies.tcp-stream] diff --git a/tcp/src/lib.rs b/tcp/src/lib.rs index 3818898d..3c27003d 100644 --- a/tcp/src/lib.rs +++ b/tcp/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/6.0.0/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/6.0.1/")] //! # AMQP URI TCP connection handling //! diff --git a/types/Cargo.toml b/types/Cargo.toml index cf58771e..672d692f 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "6.0.0" # remember to update html_root_url +version = "6.0.1" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/types/src/lib.rs b/types/src/lib.rs index 3e5e582b..87844eb4 100644 --- a/types/src/lib.rs +++ b/types/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-types/6.0.0/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-types/6.0.1/")] //! # AMQP types manipulation library //! diff --git a/uri/Cargo.toml b/uri/Cargo.toml index 423b5611..afb40082 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "6.0.0" # remember to update html_root_url +version = "6.0.1" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" diff --git a/uri/src/lib.rs b/uri/src/lib.rs index 40930fd1..b7c20078 100644 --- a/uri/src/lib.rs +++ b/uri/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/6.0.0/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/6.0.1/")] //! # AMQP URI manipulation library //! From 9e6c289c091bea64a8602cb9039eb8302bd9c3f7 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Mon, 16 Nov 2020 21:03:41 +0100 Subject: [PATCH 040/133] update tcp-stream Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- tcp/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index 60fb6116..d44d4dbe 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -28,7 +28,7 @@ version = "^6.0.1" path = "../uri" [dependencies.tcp-stream] -version = "^0.20" +version = "^0.20.5" default-features = false [dependencies.tracing] From 14d40f42e65b88faf89edf31bad7c364053daff2 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Mon, 16 Nov 2020 21:04:58 +0100 Subject: [PATCH 041/133] v6.0.2 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/Cargo.toml | 4 ++-- codegen/src/lib.rs | 2 +- protocol/Cargo.toml | 10 +++++----- protocol/src/lib.rs | 2 +- tcp/Cargo.toml | 4 ++-- tcp/src/lib.rs | 2 +- types/Cargo.toml | 2 +- types/src/lib.rs | 2 +- uri/Cargo.toml | 2 +- uri/src/lib.rs | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index c36c7480..6f8ff4eb 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "6.0.1" # remember to update html_root_url +version = "6.0.2" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" @@ -18,7 +18,7 @@ handlebars = "^3.0" serde_json = "^1.0" [dependencies.amq-protocol-types] -version = "^6.0.1" +version = "^6.0.2" path = "../types" [dependencies.serde] diff --git a/codegen/src/lib.rs b/codegen/src/lib.rs index c51d3884..b981dd31 100644 --- a/codegen/src/lib.rs +++ b/codegen/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/6.0.1/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/6.0.2/")] //! # AMQP code generation utilities //! diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index fc5ae337..573bc076 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "6.0.1" # remember to update html_root_url +version = "6.0.2" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" @@ -27,21 +27,21 @@ vendored-openssl = ["amq-protocol-tcp/vendored-openssl"] verbose-errors = ["amq-protocol-types/verbose-errors"] [build-dependencies.amq-protocol-codegen] -version = "^6.0.1" +version = "^6.0.2" path = "../codegen" optional = true [dependencies.amq-protocol-tcp] -version = "^6.0.1" +version = "^6.0.2" default-features = false path = "../tcp" [dependencies.amq-protocol-types] -version = "^6.0.1" +version = "^6.0.2" path = "../types" [dependencies.amq-protocol-uri] -version = "^6.0.1" +version = "^6.0.2" path = "../uri" [dependencies.cookie-factory] diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs index 3c22010f..2f904e2b 100644 --- a/protocol/src/lib.rs +++ b/protocol/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol/6.0.1/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol/6.0.2/")] //! # AMQP manipulation library //! diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index d44d4dbe..11262171 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "6.0.1" # remember to update html_root_url +version = "6.0.2" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" @@ -24,7 +24,7 @@ rustls-connector = ["tcp-stream/rustls-connector"] vendored-openssl = ["tcp-stream/vendored-openssl"] [dependencies.amq-protocol-uri] -version = "^6.0.1" +version = "^6.0.2" path = "../uri" [dependencies.tcp-stream] diff --git a/tcp/src/lib.rs b/tcp/src/lib.rs index 3c27003d..679baed8 100644 --- a/tcp/src/lib.rs +++ b/tcp/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/6.0.1/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/6.0.2/")] //! # AMQP URI TCP connection handling //! diff --git a/types/Cargo.toml b/types/Cargo.toml index 672d692f..33067c46 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "6.0.1" # remember to update html_root_url +version = "6.0.2" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/types/src/lib.rs b/types/src/lib.rs index 87844eb4..d2cf19cf 100644 --- a/types/src/lib.rs +++ b/types/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-types/6.0.1/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-types/6.0.2/")] //! # AMQP types manipulation library //! diff --git a/uri/Cargo.toml b/uri/Cargo.toml index afb40082..851d9401 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "6.0.1" # remember to update html_root_url +version = "6.0.2" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" diff --git a/uri/src/lib.rs b/uri/src/lib.rs index b7c20078..3f08fd02 100644 --- a/uri/src/lib.rs +++ b/uri/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/6.0.1/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/6.0.2/")] //! # AMQP URI manipulation library //! From a055e71bf51efd0f417308863bd5817fcdcae268 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Mon, 16 Nov 2020 21:12:09 +0100 Subject: [PATCH 042/133] stop using deprecated github actions Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- .github/workflows/build-and-test.yaml | 8 -------- .github/workflows/lint.yaml | 6 ------ .github/workflows/security.yaml | 3 --- 3 files changed, 17 deletions(-) diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index aebfb268..f6bb5c04 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -17,14 +17,6 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set current week of the year in environnement - if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macOS') - run: echo "::set-env name=CURRENT_WEEK::$(date +%V)" - - - name: Set current week of the year in environnement - if: startsWith(matrix.os, 'windows') - run: echo "::set-env name=CURRENT_WEEK::$(Get-Date -UFormat %V)" - - name: Install latest ${{ matrix.rust }} uses: actions-rs/toolchain@v1 with: diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index d13341e3..440ae87b 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -12,9 +12,6 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set current week of the year in environnement - run: echo "::set-env name=CURRENT_WEEK::$(date +%V)" - - uses: actions-rs/toolchain@v1 with: toolchain: stable @@ -30,9 +27,6 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set current week of the year in environnement - run: echo "::set-env name=CURRENT_WEEK::$(date +%V)" - - uses: actions-rs/toolchain@v1 with: toolchain: stable diff --git a/.github/workflows/security.yaml b/.github/workflows/security.yaml index 8fb32963..c4f7947a 100644 --- a/.github/workflows/security.yaml +++ b/.github/workflows/security.yaml @@ -12,9 +12,6 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set current week of the year in environnement - run: echo "::set-env name=CURRENT_WEEK::$(date +%V)" - - uses: actions-rs/audit-check@v1 with: token: ${{ secrets.GITHUB_TOKEN }} From 9595c06377ccc22edd1434b44bdebf5022b71da0 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Mon, 23 Nov 2020 22:50:58 +0100 Subject: [PATCH 043/133] update tcp-stream Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- tcp/Cargo.toml | 2 +- tcp/src/lib.rs | 75 +------------------------------------------------- 2 files changed, 2 insertions(+), 75 deletions(-) diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index 11262171..811b3c3a 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -28,7 +28,7 @@ version = "^6.0.2" path = "../uri" [dependencies.tcp-stream] -version = "^0.20.5" +version = "^0.21" default-features = false [dependencies.tracing] diff --git a/tcp/src/lib.rs b/tcp/src/lib.rs index 679baed8..fdee3cd6 100644 --- a/tcp/src/lib.rs +++ b/tcp/src/lib.rs @@ -8,11 +8,7 @@ //! connecting to an AMQP URI use amq_protocol_uri::{AMQPScheme, AMQPUri}; -use std::{ - mem::ManuallyDrop, - ops::{Deref, DerefMut}, - time::Duration, -}; +use std::time::Duration; use tracing::trace; /// Re-export TcpStream @@ -60,72 +56,3 @@ impl AMQPUriTcpExt for AMQPUri { } } } - -/// Unsafe wrapper "Cloning" the TcpStream but not closing it on drop. -pub struct TcpStreamWrapper(ManuallyDrop<TcpStream>); - -impl Deref for TcpStreamWrapper { - type Target = TcpStream; - - fn deref(&self) -> &Self::Target { - &*self.0 - } -} - -impl DerefMut for TcpStreamWrapper { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut *self.0 - } -} - -#[cfg(unix)] -mod sys { - use crate::{TcpStream, TcpStreamWrapper}; - use std::{ - mem::ManuallyDrop, - os::unix::io::{AsRawFd, FromRawFd, RawFd}, - }; - - impl TcpStreamWrapper { - /// Clone the TcpStream. Original one needs to last at least for the same lifetime. - /// - /// # Safety - /// - /// The inner TcpStream won't be closed on drop and the original one needs to live longer - pub unsafe fn new(socket: &TcpStream) -> Self { - Self(ManuallyDrop::new(TcpStream::from_raw_fd( - socket.as_raw_fd(), - ))) - } - } - - impl AsRawFd for TcpStreamWrapper { - fn as_raw_fd(&self) -> RawFd { - self.0.as_raw_fd() - } - } -} - -#[cfg(windows)] -mod sys { - use crate::{TcpStream, TcpStreamWrapper}; - use std::{ - mem::ManuallyDrop, - os::windows::io::{AsRawSocket, FromRawSocket, RawSocket}, - }; - - impl TcpStreamWrapper { - /// Clone the TcpStream. Original one needs to last at least for the same lifetime. - pub unsafe fn new(socket: &TcpStream) -> Self { - Self(ManuallyDrop::new(TcpStream::from_raw_socket( - socket.as_raw_socket(), - ))) - } - } - - impl AsRawSocket for TcpStreamWrapper { - fn as_raw_socket(&self) -> RawSocket { - self.0.as_raw_socket() - } - } -} From 2ab470198ac427fb99c17fb9e5f2c5e2d3bb4328 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Mon, 23 Nov 2020 22:52:22 +0100 Subject: [PATCH 044/133] tcp: set socket non blocking after conneciton, before ssl Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- tcp/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tcp/src/lib.rs b/tcp/src/lib.rs index fdee3cd6..91338050 100644 --- a/tcp/src/lib.rs +++ b/tcp/src/lib.rs @@ -49,6 +49,7 @@ impl AMQPUriTcpExt for AMQPUri { } else { TcpStream::connect(uri) }?; + stream.set_nonblocking(true)?; match self.scheme { AMQPScheme::AMQP => Ok(stream), From 3c2e6edbbe7c8a513ad51098bd60a43f8e4067d2 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Mon, 23 Nov 2020 22:54:53 +0100 Subject: [PATCH 045/133] v7.0.0-alpha.1 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/Cargo.toml | 4 ++-- codegen/src/lib.rs | 2 +- protocol/Cargo.toml | 10 +++++----- protocol/src/lib.rs | 2 +- tcp/Cargo.toml | 4 ++-- tcp/src/lib.rs | 2 +- types/Cargo.toml | 2 +- types/src/lib.rs | 2 +- uri/Cargo.toml | 2 +- uri/src/lib.rs | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 6f8ff4eb..186ad00b 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "6.0.2" # remember to update html_root_url +version = "7.0.0-alpha.1" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" @@ -18,7 +18,7 @@ handlebars = "^3.0" serde_json = "^1.0" [dependencies.amq-protocol-types] -version = "^6.0.2" +version = "=7.0.0-alpha.1" path = "../types" [dependencies.serde] diff --git a/codegen/src/lib.rs b/codegen/src/lib.rs index b981dd31..14eab71a 100644 --- a/codegen/src/lib.rs +++ b/codegen/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/6.0.2/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/7.0.0-alpha.1/")] //! # AMQP code generation utilities //! diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index 573bc076..4c7c97dd 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "6.0.2" # remember to update html_root_url +version = "7.0.0-alpha.1" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" @@ -27,21 +27,21 @@ vendored-openssl = ["amq-protocol-tcp/vendored-openssl"] verbose-errors = ["amq-protocol-types/verbose-errors"] [build-dependencies.amq-protocol-codegen] -version = "^6.0.2" +version = "=7.0.0-alpha.1" path = "../codegen" optional = true [dependencies.amq-protocol-tcp] -version = "^6.0.2" +version = "=7.0.0-alpha.1" default-features = false path = "../tcp" [dependencies.amq-protocol-types] -version = "^6.0.2" +version = "=7.0.0-alpha.1" path = "../types" [dependencies.amq-protocol-uri] -version = "^6.0.2" +version = "=7.0.0-alpha.1" path = "../uri" [dependencies.cookie-factory] diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs index 2f904e2b..6da4e8ee 100644 --- a/protocol/src/lib.rs +++ b/protocol/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol/6.0.2/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol/7.0.0-alpha.1/")] //! # AMQP manipulation library //! diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index 811b3c3a..907c4cbf 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "6.0.2" # remember to update html_root_url +version = "7.0.0-alpha.1" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" @@ -24,7 +24,7 @@ rustls-connector = ["tcp-stream/rustls-connector"] vendored-openssl = ["tcp-stream/vendored-openssl"] [dependencies.amq-protocol-uri] -version = "^6.0.2" +version = "=7.0.0-alpha.1" path = "../uri" [dependencies.tcp-stream] diff --git a/tcp/src/lib.rs b/tcp/src/lib.rs index 91338050..54f4abcb 100644 --- a/tcp/src/lib.rs +++ b/tcp/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/6.0.2/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/7.0.0-alpha.1/")] //! # AMQP URI TCP connection handling //! diff --git a/types/Cargo.toml b/types/Cargo.toml index 33067c46..d412aacd 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "6.0.2" # remember to update html_root_url +version = "7.0.0-alpha.1" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/types/src/lib.rs b/types/src/lib.rs index d2cf19cf..14c0a313 100644 --- a/types/src/lib.rs +++ b/types/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-types/6.0.2/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-types/7.0.0-alpha.1/")] //! # AMQP types manipulation library //! diff --git a/uri/Cargo.toml b/uri/Cargo.toml index 851d9401..4cdb55c3 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "6.0.2" # remember to update html_root_url +version = "7.0.0-alpha.1" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" diff --git a/uri/src/lib.rs b/uri/src/lib.rs index 3f08fd02..035fe2a1 100644 --- a/uri/src/lib.rs +++ b/uri/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/6.0.2/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/7.0.0-alpha.1/")] //! # AMQP URI manipulation library //! From 469667d67c8e0cc50df2f232d281c94d95d5ed38 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Sat, 28 Nov 2020 15:49:39 +0100 Subject: [PATCH 046/133] make socket nonblocking later Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- tcp/src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tcp/src/lib.rs b/tcp/src/lib.rs index 54f4abcb..f2a20fdb 100644 --- a/tcp/src/lib.rs +++ b/tcp/src/lib.rs @@ -49,11 +49,11 @@ impl AMQPUriTcpExt for AMQPUri { } else { TcpStream::connect(uri) }?; + let stream = match self.scheme { + AMQPScheme::AMQP => stream, + AMQPScheme::AMQPS => stream.into_tls(&self.authority.host, config)?, + }; stream.set_nonblocking(true)?; - - match self.scheme { - AMQPScheme::AMQP => Ok(stream), - AMQPScheme::AMQPS => stream.into_tls(&self.authority.host, config), - } + Ok(stream) } } From fd08daa13968b4eb129fde05d5f39f8e3325178b Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Sat, 28 Nov 2020 15:50:17 +0100 Subject: [PATCH 047/133] v7.0.0-alpha.2 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/Cargo.toml | 4 ++-- codegen/src/lib.rs | 2 +- protocol/Cargo.toml | 10 +++++----- protocol/src/lib.rs | 2 +- tcp/Cargo.toml | 4 ++-- tcp/src/lib.rs | 2 +- types/Cargo.toml | 2 +- types/src/lib.rs | 2 +- uri/Cargo.toml | 2 +- uri/src/lib.rs | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 186ad00b..a3067087 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "7.0.0-alpha.1" # remember to update html_root_url +version = "7.0.0-alpha.2" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" @@ -18,7 +18,7 @@ handlebars = "^3.0" serde_json = "^1.0" [dependencies.amq-protocol-types] -version = "=7.0.0-alpha.1" +version = "=7.0.0-alpha.2" path = "../types" [dependencies.serde] diff --git a/codegen/src/lib.rs b/codegen/src/lib.rs index 14eab71a..99c72948 100644 --- a/codegen/src/lib.rs +++ b/codegen/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/7.0.0-alpha.1/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/7.0.0-alpha.2/")] //! # AMQP code generation utilities //! diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index 4c7c97dd..93fb3e50 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "7.0.0-alpha.1" # remember to update html_root_url +version = "7.0.0-alpha.2" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" @@ -27,21 +27,21 @@ vendored-openssl = ["amq-protocol-tcp/vendored-openssl"] verbose-errors = ["amq-protocol-types/verbose-errors"] [build-dependencies.amq-protocol-codegen] -version = "=7.0.0-alpha.1" +version = "=7.0.0-alpha.2" path = "../codegen" optional = true [dependencies.amq-protocol-tcp] -version = "=7.0.0-alpha.1" +version = "=7.0.0-alpha.2" default-features = false path = "../tcp" [dependencies.amq-protocol-types] -version = "=7.0.0-alpha.1" +version = "=7.0.0-alpha.2" path = "../types" [dependencies.amq-protocol-uri] -version = "=7.0.0-alpha.1" +version = "=7.0.0-alpha.2" path = "../uri" [dependencies.cookie-factory] diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs index 6da4e8ee..3620ff39 100644 --- a/protocol/src/lib.rs +++ b/protocol/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol/7.0.0-alpha.1/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol/7.0.0-alpha.2/")] //! # AMQP manipulation library //! diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index 907c4cbf..a53629f1 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "7.0.0-alpha.1" # remember to update html_root_url +version = "7.0.0-alpha.2" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" @@ -24,7 +24,7 @@ rustls-connector = ["tcp-stream/rustls-connector"] vendored-openssl = ["tcp-stream/vendored-openssl"] [dependencies.amq-protocol-uri] -version = "=7.0.0-alpha.1" +version = "=7.0.0-alpha.2" path = "../uri" [dependencies.tcp-stream] diff --git a/tcp/src/lib.rs b/tcp/src/lib.rs index f2a20fdb..e44b2e1c 100644 --- a/tcp/src/lib.rs +++ b/tcp/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/7.0.0-alpha.1/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/7.0.0-alpha.2/")] //! # AMQP URI TCP connection handling //! diff --git a/types/Cargo.toml b/types/Cargo.toml index d412aacd..539a0bcf 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "7.0.0-alpha.1" # remember to update html_root_url +version = "7.0.0-alpha.2" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/types/src/lib.rs b/types/src/lib.rs index 14c0a313..35342494 100644 --- a/types/src/lib.rs +++ b/types/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-types/7.0.0-alpha.1/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-types/7.0.0-alpha.2/")] //! # AMQP types manipulation library //! diff --git a/uri/Cargo.toml b/uri/Cargo.toml index 4cdb55c3..1f4cedd8 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "7.0.0-alpha.1" # remember to update html_root_url +version = "7.0.0-alpha.2" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" diff --git a/uri/src/lib.rs b/uri/src/lib.rs index 035fe2a1..2189cb05 100644 --- a/uri/src/lib.rs +++ b/uri/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/7.0.0-alpha.1/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/7.0.0-alpha.2/")] //! # AMQP URI manipulation library //! From f3868f4798bad318139ad26c91a31e019a03af3d Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Sun, 29 Nov 2020 21:40:45 +0100 Subject: [PATCH 048/133] update some constants to fix their type Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/src/internal.rs | 6 ++++-- protocol/build.rs | 4 ++-- protocol/src/generated.rs | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/codegen/src/internal.rs b/codegen/src/internal.rs index d119224d..f202a0b5 100644 --- a/codegen/src/internal.rs +++ b/codegen/src/internal.rs @@ -258,7 +258,9 @@ impl _AMQPConstant { AMQPConstant { name: self.name.clone(), value: self.value, - amqp_type: if self.value > 255 { + amqp_type: if self.name.ends_with("SIZE") { + AMQPType::LongUInt + } else if self.name.starts_with("REPLY") { AMQPType::ShortUInt } else { AMQPType::ShortShortUInt @@ -583,7 +585,7 @@ mod test { hard_errors: vec![AMQPConstant { name: "c3".to_string(), value: 256, - amqp_type: AMQPType::ShortUInt, + amqp_type: AMQPType::ShortShortUInt, }], classes: vec![AMQPClass { id: 42, diff --git a/protocol/build.rs b/protocol/build.rs index 96ec5f15..a063ec7d 100644 --- a/protocol/build.rs +++ b/protocol/build.rs @@ -2,11 +2,11 @@ fn main() { println!("cargo:rerun-if-env-changed=AMQ_PROTOCOL_CODEGEN_DIR"); println!("cargo:rerun-if-env-changed=AMQ_PROTOCOL_CODEGEN_FILE"); - #[cfg(feature = "codegen")] + #[cfg(feature = "codegen-internal")] codegen() } -#[cfg(feature = "codegen")] +#[cfg(feature = "codegen-internal")] fn codegen() { use amq_protocol_codegen::{CodeGenerator, HandlebarsAMQPExtension}; diff --git a/protocol/src/generated.rs b/protocol/src/generated.rs index 21806328..8ae830c1 100644 --- a/protocol/src/generated.rs +++ b/protocol/src/generated.rs @@ -58,11 +58,11 @@ pub mod constants { /// FRAME-HEARTBEAT (Generated) pub const FRAME_HEARTBEAT: ShortShortUInt = 8; /// FRAME-MIN-SIZE (Generated) - pub const FRAME_MIN_SIZE: ShortUInt = 4096; + pub const FRAME_MIN_SIZE: LongUInt = 4096; /// FRAME-END (Generated) pub const FRAME_END: ShortShortUInt = 206; /// REPLY-SUCCESS (Generated) - pub const REPLY_SUCCESS: ShortShortUInt = 200; + pub const REPLY_SUCCESS: ShortUInt = 200; } /// The available soft AMQP errors From 94b885455ee5577c43f1e0e3a464fe8b656888e2 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Sun, 29 Nov 2020 21:43:27 +0100 Subject: [PATCH 049/133] types: add some type aliases Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- types/src/lib.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/types/src/lib.rs b/types/src/lib.rs index 35342494..1dc14d6f 100644 --- a/types/src/lib.rs +++ b/types/src/lib.rs @@ -21,3 +21,22 @@ pub mod flags; pub mod generation; /// Parsing utilities for the various AMQP types. pub mod parsing; + +/// A Channel identifier +pub type ChannelId = Identifier; +/// The number of consumers +pub type ConsumerCount = types::LongUInt; +/// A delivery tag +pub type DeliveryTag = types::LongLongUInt; +/// the size of an AMQP frame +pub type FrameSize = types::LongUInt; +/// The maximum heartbeat interval +pub type Heartbeat = types::ShortUInt; +/// An identifier (class id or method id) +pub type Identifier = types::ShortUInt; +/// The number of messages +pub type MessageCount = types::LongUInt; +/// The size of a delivery's payload +pub type PayloadSize = types::LongLongUInt; +/// A reply code (for closing channels and connections) +pub type ReplyCode = types::ShortUInt; From 0899083d0bd51b340109671b799eb88571b3b659 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Sat, 26 Dec 2020 16:30:18 +0100 Subject: [PATCH 050/133] use the type aliases Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/src/internal.rs | 6 +- codegen/src/specs.rs | 6 +- protocol/src/frame/generation.rs | 14 +- protocol/src/frame/structs.rs | 30 +-- protocol/src/generated.rs | 360 ++++++++++++------------------- protocol/src/protocol.rs | 8 +- protocol/templates/protocol.rs | 34 +-- types/src/lib.rs | 4 + uri/Cargo.toml | 4 + uri/src/lib.rs | 7 +- 10 files changed, 186 insertions(+), 287 deletions(-) diff --git a/codegen/src/internal.rs b/codegen/src/internal.rs index f202a0b5..629972f1 100644 --- a/codegen/src/internal.rs +++ b/codegen/src/internal.rs @@ -248,7 +248,7 @@ enum _AMQPErrorKind { #[derive(Debug, Deserialize)] struct _AMQPConstant { pub name: String, - pub value: ShortUInt, + pub value: LongUInt, #[serde(rename = "class")] pub klass: Option<_AMQPErrorKind>, } @@ -271,7 +271,7 @@ impl _AMQPConstant { #[derive(Debug, Deserialize)] struct _AMQPClass { - id: ShortUInt, + id: Identifier, methods: Vec<_AMQPMethod>, name: String, properties: Option<Vec<_AMQPProperty>>, @@ -328,7 +328,7 @@ impl _AMQPClass { #[derive(Debug, Deserialize)] struct _AMQPMethod { - id: ShortUInt, + id: Identifier, arguments: Vec<_AMQPArgument>, name: String, synchronous: Option<Boolean>, diff --git a/codegen/src/specs.rs b/codegen/src/specs.rs index 31ba5c09..6dd41feb 100644 --- a/codegen/src/specs.rs +++ b/codegen/src/specs.rs @@ -53,7 +53,7 @@ pub struct AMQPConstant { /// The name of the constant pub name: String, /// The value of the constant - pub value: ShortUInt, + pub value: LongUInt, /// The type of the constant #[serde(rename = "type")] pub amqp_type: AMQPType, @@ -63,7 +63,7 @@ pub struct AMQPConstant { #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] pub struct AMQPClass { /// The id of the class - pub id: ShortUInt, + pub id: Identifier, /// The methods of the class pub methods: Vec<AMQPMethod>, /// The name of the class @@ -78,7 +78,7 @@ pub struct AMQPClass { #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] pub struct AMQPMethod { /// The id of the method - pub id: ShortUInt, + pub id: Identifier, /// The arguments of the method pub arguments: Vec<AMQPArgument>, /// The name of the method diff --git a/protocol/src/frame/generation.rs b/protocol/src/frame/generation.rs index b8989052..53fea36d 100644 --- a/protocol/src/frame/generation.rs +++ b/protocol/src/frame/generation.rs @@ -39,7 +39,7 @@ fn gen_protocol_version<W: Write>(version: ProtocolVersion) -> impl SerializeFn< )) } -fn gen_heartbeat_frame<W: Write>(channel_id: ShortUInt) -> impl SerializeFn<W> { +fn gen_heartbeat_frame<W: Write>(channel_id: ChannelId) -> impl SerializeFn<W> { tuple(( gen_short_short_uint(constants::FRAME_HEARTBEAT), gen_id(channel_id), @@ -49,7 +49,7 @@ fn gen_heartbeat_frame<W: Write>(channel_id: ShortUInt) -> impl SerializeFn<W> { } fn gen_method_frame<'a, W: Write + BackToTheBuffer + 'a>( - channel_id: ShortUInt, + channel_id: ChannelId, class: &'a AMQPClass, ) -> impl SerializeFn<W> + 'a { tuple(( @@ -61,9 +61,9 @@ fn gen_method_frame<'a, W: Write + BackToTheBuffer + 'a>( } fn gen_content_header_frame<'a, W: Write + BackToTheBuffer + 'a>( - channel_id: ShortUInt, - class_id: ShortUInt, - length: LongLongUInt, + channel_id: ChannelId, + class_id: Identifier, + length: PayloadSize, properties: &'a basic::AMQPProperties, ) -> impl SerializeFn<W> + 'a { tuple(( @@ -80,13 +80,13 @@ fn gen_content_header_frame<'a, W: Write + BackToTheBuffer + 'a>( } fn gen_content_body_frame<'a, W: Write + 'a>( - channel_id: ShortUInt, + channel_id: ChannelId, content: &'a [u8], ) -> impl SerializeFn<W> + 'a { tuple(( gen_short_short_uint(constants::FRAME_BODY), gen_id(channel_id), - gen_long_uint(content.len() as LongUInt), + gen_long_uint(content.len() as ChunkSize), slice(content), gen_short_short_uint(constants::FRAME_END), )) diff --git a/protocol/src/frame/structs.rs b/protocol/src/frame/structs.rs index 47b48d3a..a46e8552 100644 --- a/protocol/src/frame/structs.rs +++ b/protocol/src/frame/structs.rs @@ -7,12 +7,12 @@ pub enum AMQPChannel { /// The Global (id 0) AMQP channel used for creating other channels and for heartbeat Global, /// A regular AMQP channel - Id(ShortUInt), + Id(ChannelId), } impl AMQPChannel { /// Get the channel id - pub fn get_id(self) -> ShortUInt { + pub fn get_id(self) -> ChannelId { match self { AMQPChannel::Global => 0, AMQPChannel::Id(id) => id, @@ -20,8 +20,8 @@ impl AMQPChannel { } } -impl From<ShortUInt> for AMQPChannel { - fn from(id: ShortUInt) -> AMQPChannel { +impl From<ChannelId> for AMQPChannel { + fn from(id: ChannelId) -> AMQPChannel { match id { 0 => AMQPChannel::Global, id => AMQPChannel::Id(id), @@ -50,13 +50,13 @@ pub enum AMQPFrame { /// Protocol header frame ProtocolHeader(ProtocolVersion), /// Method call - Method(ShortUInt, AMQPClass), + Method(ChannelId, AMQPClass), /// Content header - Header(ShortUInt, ShortUInt, Box<AMQPContentHeader>), + Header(ChannelId, Identifier, Box<AMQPContentHeader>), /// Content body - Body(ShortUInt, Vec<u8>), + Body(ChannelId, Vec<u8>), /// Heartbeat frame - Heartbeat(ShortUInt), + Heartbeat(ChannelId), } impl AMQPFrame { @@ -90,11 +90,11 @@ impl fmt::Display for AMQPFrame { #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct ProtocolVersion { /// Major version of the protocol - pub major: u8, + pub major: ShortShortUInt, /// Minor version of the protocol - pub minor: u8, + pub minor: ShortShortUInt, /// Revision of the protocol - pub revision: u8, + pub revision: ShortShortUInt, } impl ProtocolVersion { @@ -123,7 +123,7 @@ pub struct AMQPRawFrame<I: ParsableInput> { /// The type of frame pub frame_type: AMQPFrameType, /// The id this frame was received on - pub channel_id: ShortUInt, + pub channel_id: ChannelId, /// The payload of the frame pub payload: I, } @@ -132,11 +132,11 @@ pub struct AMQPRawFrame<I: ParsableInput> { #[derive(Clone, Debug, PartialEq)] pub struct AMQPContentHeader { /// The class of content - pub class_id: ShortUInt, + pub class_id: Identifier, /// The weight of the content - pub weight: ShortUInt, + pub weight: Weight, /// The size of the content's body - pub body_size: LongLongUInt, + pub body_size: PayloadSize, /// The AMQP properties associated with the content pub properties: basic::AMQPProperties, } diff --git a/protocol/src/generated.rs b/protocol/src/generated.rs index 8ae830c1..e4ea60bb 100644 --- a/protocol/src/generated.rs +++ b/protocol/src/generated.rs @@ -86,7 +86,7 @@ pub enum AMQPSoftError { impl AMQPSoftError { /// Get the id of the soft error - pub fn get_id(&self) -> ShortUInt { + pub fn get_id(&self) -> Identifier { match *self { AMQPSoftError::CONTENTTOOLARGE => 311, AMQPSoftError::NOROUTE => 312, @@ -99,7 +99,7 @@ impl AMQPSoftError { } /// Get the soft error corresponding to an id - pub fn from_id(id: ShortUInt) -> Option<AMQPSoftError> { + pub fn from_id(id: Identifier) -> Option<AMQPSoftError> { match id { 311 => Some(AMQPSoftError::CONTENTTOOLARGE), 312 => Some(AMQPSoftError::NOROUTE), @@ -156,7 +156,7 @@ pub enum AMQPHardError { impl AMQPHardError { /// Get the id of the hard error - pub fn get_id(&self) -> ShortUInt { + pub fn get_id(&self) -> Identifier { match *self { AMQPHardError::CONNECTIONFORCED => 320, AMQPHardError::INVALIDPATH => 402, @@ -173,7 +173,7 @@ impl AMQPHardError { } /// Get the hard error corresponding to an id - pub fn from_id(id: ShortUInt) -> Option<AMQPHardError> { + pub fn from_id(id: Identifier) -> Option<AMQPHardError> { match id { 320 => Some(AMQPHardError::CONNECTIONFORCED), 402 => Some(AMQPHardError::INVALIDPATH), @@ -277,94 +277,6 @@ pub enum AMQPClass { Confirm(confirm::AMQPMethod), } -impl AMQPClass { - /// Get the AMQP class id (Generated) - pub fn get_amqp_class_id(&self) -> u16 { - match self { - AMQPClass::Connection(_) => 10, - AMQPClass::Channel(_) => 20, - AMQPClass::Access(_) => 30, - AMQPClass::Exchange(_) => 40, - AMQPClass::Queue(_) => 50, - AMQPClass::Basic(_) => 60, - AMQPClass::Tx(_) => 90, - AMQPClass::Confirm(_) => 85, - } - } - - /// Get the AMQP method id (Generated) - pub fn get_amqp_method_id(&self) -> u16 { - match self { - AMQPClass::Connection(connection::AMQPMethod::Start(_)) => 10, - AMQPClass::Connection(connection::AMQPMethod::StartOk(_)) => 11, - AMQPClass::Connection(connection::AMQPMethod::Secure(_)) => 20, - AMQPClass::Connection(connection::AMQPMethod::SecureOk(_)) => 21, - AMQPClass::Connection(connection::AMQPMethod::Tune(_)) => 30, - AMQPClass::Connection(connection::AMQPMethod::TuneOk(_)) => 31, - AMQPClass::Connection(connection::AMQPMethod::Open(_)) => 40, - AMQPClass::Connection(connection::AMQPMethod::OpenOk(_)) => 41, - AMQPClass::Connection(connection::AMQPMethod::Close(_)) => 50, - AMQPClass::Connection(connection::AMQPMethod::CloseOk(_)) => 51, - AMQPClass::Connection(connection::AMQPMethod::Blocked(_)) => 60, - AMQPClass::Connection(connection::AMQPMethod::Unblocked(_)) => 61, - AMQPClass::Connection(connection::AMQPMethod::UpdateSecret(_)) => 70, - AMQPClass::Connection(connection::AMQPMethod::UpdateSecretOk(_)) => 71, - AMQPClass::Channel(channel::AMQPMethod::Open(_)) => 10, - AMQPClass::Channel(channel::AMQPMethod::OpenOk(_)) => 11, - AMQPClass::Channel(channel::AMQPMethod::Flow(_)) => 20, - AMQPClass::Channel(channel::AMQPMethod::FlowOk(_)) => 21, - AMQPClass::Channel(channel::AMQPMethod::Close(_)) => 40, - AMQPClass::Channel(channel::AMQPMethod::CloseOk(_)) => 41, - AMQPClass::Access(access::AMQPMethod::Request(_)) => 10, - AMQPClass::Access(access::AMQPMethod::RequestOk(_)) => 11, - AMQPClass::Exchange(exchange::AMQPMethod::Declare(_)) => 10, - AMQPClass::Exchange(exchange::AMQPMethod::DeclareOk(_)) => 11, - AMQPClass::Exchange(exchange::AMQPMethod::Delete(_)) => 20, - AMQPClass::Exchange(exchange::AMQPMethod::DeleteOk(_)) => 21, - AMQPClass::Exchange(exchange::AMQPMethod::Bind(_)) => 30, - AMQPClass::Exchange(exchange::AMQPMethod::BindOk(_)) => 31, - AMQPClass::Exchange(exchange::AMQPMethod::Unbind(_)) => 40, - AMQPClass::Exchange(exchange::AMQPMethod::UnbindOk(_)) => 51, - AMQPClass::Queue(queue::AMQPMethod::Declare(_)) => 10, - AMQPClass::Queue(queue::AMQPMethod::DeclareOk(_)) => 11, - AMQPClass::Queue(queue::AMQPMethod::Bind(_)) => 20, - AMQPClass::Queue(queue::AMQPMethod::BindOk(_)) => 21, - AMQPClass::Queue(queue::AMQPMethod::Purge(_)) => 30, - AMQPClass::Queue(queue::AMQPMethod::PurgeOk(_)) => 31, - AMQPClass::Queue(queue::AMQPMethod::Delete(_)) => 40, - AMQPClass::Queue(queue::AMQPMethod::DeleteOk(_)) => 41, - AMQPClass::Queue(queue::AMQPMethod::Unbind(_)) => 50, - AMQPClass::Queue(queue::AMQPMethod::UnbindOk(_)) => 51, - AMQPClass::Basic(basic::AMQPMethod::Qos(_)) => 10, - AMQPClass::Basic(basic::AMQPMethod::QosOk(_)) => 11, - AMQPClass::Basic(basic::AMQPMethod::Consume(_)) => 20, - AMQPClass::Basic(basic::AMQPMethod::ConsumeOk(_)) => 21, - AMQPClass::Basic(basic::AMQPMethod::Cancel(_)) => 30, - AMQPClass::Basic(basic::AMQPMethod::CancelOk(_)) => 31, - AMQPClass::Basic(basic::AMQPMethod::Publish(_)) => 40, - AMQPClass::Basic(basic::AMQPMethod::Return(_)) => 50, - AMQPClass::Basic(basic::AMQPMethod::Deliver(_)) => 60, - AMQPClass::Basic(basic::AMQPMethod::Get(_)) => 70, - AMQPClass::Basic(basic::AMQPMethod::GetOk(_)) => 71, - AMQPClass::Basic(basic::AMQPMethod::GetEmpty(_)) => 72, - AMQPClass::Basic(basic::AMQPMethod::Ack(_)) => 80, - AMQPClass::Basic(basic::AMQPMethod::Reject(_)) => 90, - AMQPClass::Basic(basic::AMQPMethod::RecoverAsync(_)) => 100, - AMQPClass::Basic(basic::AMQPMethod::Recover(_)) => 110, - AMQPClass::Basic(basic::AMQPMethod::RecoverOk(_)) => 111, - AMQPClass::Basic(basic::AMQPMethod::Nack(_)) => 120, - AMQPClass::Tx(tx::AMQPMethod::Select(_)) => 10, - AMQPClass::Tx(tx::AMQPMethod::SelectOk(_)) => 11, - AMQPClass::Tx(tx::AMQPMethod::Commit(_)) => 20, - AMQPClass::Tx(tx::AMQPMethod::CommitOk(_)) => 21, - AMQPClass::Tx(tx::AMQPMethod::Rollback(_)) => 30, - AMQPClass::Tx(tx::AMQPMethod::RollbackOk(_)) => 31, - AMQPClass::Confirm(confirm::AMQPMethod::Select(_)) => 10, - AMQPClass::Confirm(confirm::AMQPMethod::SelectOk(_)) => 11, - } - } -} - /// connection (generated) pub mod connection { use super::*; @@ -515,12 +427,12 @@ pub mod connection { impl Start { /// Get the AMQP class id for start (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 10 } /// Get the AMQP method id for start (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 10 } } @@ -574,12 +486,12 @@ pub mod connection { impl StartOk { /// Get the AMQP class id for start-ok (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 10 } /// Get the AMQP method id for start-ok (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 11 } } @@ -624,12 +536,12 @@ pub mod connection { impl Secure { /// Get the AMQP class id for secure (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 10 } /// Get the AMQP method id for secure (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 20 } } @@ -660,12 +572,12 @@ pub mod connection { impl SecureOk { /// Get the AMQP class id for secure-ok (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 10 } /// Get the AMQP method id for secure-ok (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 21 } } @@ -700,12 +612,12 @@ pub mod connection { impl Tune { /// Get the AMQP class id for tune (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 10 } /// Get the AMQP method id for tune (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 30 } } @@ -751,12 +663,12 @@ pub mod connection { impl TuneOk { /// Get the AMQP class id for tune-ok (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 10 } /// Get the AMQP method id for tune-ok (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 31 } } @@ -798,12 +710,12 @@ pub mod connection { impl Open { /// Get the AMQP class id for open (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 10 } /// Get the AMQP method id for open (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 40 } } @@ -839,12 +751,12 @@ pub mod connection { impl OpenOk { /// Get the AMQP class id for open-ok (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 10 } /// Get the AMQP method id for open-ok (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 41 } } @@ -881,12 +793,12 @@ pub mod connection { impl Close { /// Get the AMQP class id for close (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 10 } /// Get the AMQP method id for close (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 50 } } @@ -928,12 +840,12 @@ pub mod connection { impl CloseOk { /// Get the AMQP class id for close-ok (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 10 } /// Get the AMQP method id for close-ok (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 51 } } @@ -962,12 +874,12 @@ pub mod connection { impl Blocked { /// Get the AMQP class id for blocked (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 10 } /// Get the AMQP method id for blocked (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 60 } } @@ -995,12 +907,12 @@ pub mod connection { impl Unblocked { /// Get the AMQP class id for unblocked (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 10 } /// Get the AMQP method id for unblocked (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 61 } } @@ -1031,12 +943,12 @@ pub mod connection { impl UpdateSecret { /// Get the AMQP class id for update-secret (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 10 } /// Get the AMQP method id for update-secret (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 70 } } @@ -1066,12 +978,12 @@ pub mod connection { impl UpdateSecretOk { /// Get the AMQP class id for update-secret-ok (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 10 } /// Get the AMQP method id for update-secret-ok (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 71 } } @@ -1170,12 +1082,12 @@ pub mod channel { impl Open { /// Get the AMQP class id for open (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 20 } /// Get the AMQP method id for open (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 10 } } @@ -1203,12 +1115,12 @@ pub mod channel { impl OpenOk { /// Get the AMQP class id for open-ok (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 20 } /// Get the AMQP method id for open-ok (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 11 } } @@ -1239,12 +1151,12 @@ pub mod channel { impl Flow { /// Get the AMQP class id for flow (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 20 } /// Get the AMQP method id for flow (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 20 } } @@ -1283,12 +1195,12 @@ pub mod channel { impl FlowOk { /// Get the AMQP class id for flow-ok (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 20 } /// Get the AMQP method id for flow-ok (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 21 } } @@ -1333,12 +1245,12 @@ pub mod channel { impl Close { /// Get the AMQP class id for close (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 20 } /// Get the AMQP method id for close (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 40 } } @@ -1380,12 +1292,12 @@ pub mod channel { impl CloseOk { /// Get the AMQP class id for close-ok (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 20 } /// Get the AMQP method id for close-ok (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 41 } } @@ -1472,12 +1384,12 @@ pub mod access { impl Request { /// Get the AMQP class id for request (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 30 } /// Get the AMQP method id for request (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 10 } } @@ -1526,12 +1438,12 @@ pub mod access { impl RequestOk { /// Get the AMQP class id for request-ok (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 30 } /// Get the AMQP method id for request-ok (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 11 } } @@ -1665,12 +1577,12 @@ pub mod exchange { impl Declare { /// Get the AMQP class id for declare (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 40 } /// Get the AMQP method id for declare (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 10 } } @@ -1730,12 +1642,12 @@ pub mod exchange { impl DeclareOk { /// Get the AMQP class id for declare-ok (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 40 } /// Get the AMQP method id for declare-ok (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 11 } } @@ -1769,12 +1681,12 @@ pub mod exchange { impl Delete { /// Get the AMQP class id for delete (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 40 } /// Get the AMQP method id for delete (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 20 } } @@ -1819,12 +1731,12 @@ pub mod exchange { impl DeleteOk { /// Get the AMQP class id for delete-ok (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 40 } /// Get the AMQP method id for delete-ok (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 21 } } @@ -1862,12 +1774,12 @@ pub mod exchange { impl Bind { /// Get the AMQP class id for bind (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 40 } /// Get the AMQP method id for bind (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 30 } } @@ -1919,12 +1831,12 @@ pub mod exchange { impl BindOk { /// Get the AMQP class id for bind-ok (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 40 } /// Get the AMQP method id for bind-ok (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 31 } } @@ -1962,12 +1874,12 @@ pub mod exchange { impl Unbind { /// Get the AMQP class id for unbind (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 40 } /// Get the AMQP method id for unbind (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 40 } } @@ -2019,12 +1931,12 @@ pub mod exchange { impl UnbindOk { /// Get the AMQP class id for unbind-ok (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 40 } /// Get the AMQP method id for unbind-ok (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 51 } } @@ -2168,12 +2080,12 @@ pub mod queue { impl Declare { /// Get the AMQP class id for declare (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 50 } /// Get the AMQP method id for declare (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 10 } } @@ -2237,12 +2149,12 @@ pub mod queue { impl DeclareOk { /// Get the AMQP class id for declare-ok (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 50 } /// Get the AMQP method id for declare-ok (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 11 } } @@ -2293,12 +2205,12 @@ pub mod queue { impl Bind { /// Get the AMQP class id for bind (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 50 } /// Get the AMQP method id for bind (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 20 } } @@ -2350,12 +2262,12 @@ pub mod queue { impl BindOk { /// Get the AMQP class id for bind-ok (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 50 } /// Get the AMQP method id for bind-ok (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 21 } } @@ -2387,12 +2299,12 @@ pub mod queue { impl Purge { /// Get the AMQP class id for purge (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 50 } /// Get the AMQP method id for purge (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 30 } } @@ -2438,12 +2350,12 @@ pub mod queue { impl PurgeOk { /// Get the AMQP class id for purge-ok (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 50 } /// Get the AMQP method id for purge-ok (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 31 } } @@ -2481,12 +2393,12 @@ pub mod queue { impl Delete { /// Get the AMQP class id for delete (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 50 } /// Get the AMQP method id for delete (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 40 } } @@ -2536,12 +2448,12 @@ pub mod queue { impl DeleteOk { /// Get the AMQP class id for delete-ok (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 50 } /// Get the AMQP method id for delete-ok (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 41 } } @@ -2578,12 +2490,12 @@ pub mod queue { impl Unbind { /// Get the AMQP class id for unbind (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 50 } /// Get the AMQP method id for unbind (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 50 } } @@ -2627,12 +2539,12 @@ pub mod queue { impl UnbindOk { /// Get the AMQP class id for unbind-ok (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 50 } /// Get the AMQP method id for unbind-ok (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 51 } } @@ -2813,12 +2725,12 @@ pub mod basic { impl Qos { /// Get the AMQP class id for qos (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 60 } /// Get the AMQP method id for qos (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 10 } } @@ -2861,12 +2773,12 @@ pub mod basic { impl QosOk { /// Get the AMQP class id for qos-ok (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 60 } /// Get the AMQP method id for qos-ok (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 11 } } @@ -2908,12 +2820,12 @@ pub mod basic { impl Consume { /// Get the AMQP class id for consume (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 60 } /// Get the AMQP method id for consume (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 20 } } @@ -2971,12 +2883,12 @@ pub mod basic { impl ConsumeOk { /// Get the AMQP class id for consume-ok (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 60 } /// Get the AMQP method id for consume-ok (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 21 } } @@ -3010,12 +2922,12 @@ pub mod basic { impl Cancel { /// Get the AMQP class id for cancel (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 60 } /// Get the AMQP method id for cancel (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 30 } } @@ -3059,12 +2971,12 @@ pub mod basic { impl CancelOk { /// Get the AMQP class id for cancel-ok (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 60 } /// Get the AMQP method id for cancel-ok (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 31 } } @@ -3102,12 +3014,12 @@ pub mod basic { impl Publish { /// Get the AMQP class id for publish (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 60 } /// Get the AMQP method id for publish (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 40 } } @@ -3164,12 +3076,12 @@ pub mod basic { impl Return { /// Get the AMQP class id for return (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 60 } /// Get the AMQP method id for return (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 50 } } @@ -3223,12 +3135,12 @@ pub mod basic { impl Deliver { /// Get the AMQP class id for deliver (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 60 } /// Get the AMQP method id for deliver (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 60 } } @@ -3284,12 +3196,12 @@ pub mod basic { impl Get { /// Get the AMQP class id for get (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 60 } /// Get the AMQP method id for get (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 70 } } @@ -3344,12 +3256,12 @@ pub mod basic { impl GetOk { /// Get the AMQP class id for get-ok (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 60 } /// Get the AMQP method id for get-ok (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 71 } } @@ -3399,12 +3311,12 @@ pub mod basic { impl GetEmpty { /// Get the AMQP class id for get-empty (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 60 } /// Get the AMQP method id for get-empty (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 72 } } @@ -3438,12 +3350,12 @@ pub mod basic { impl Ack { /// Get the AMQP class id for ack (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 60 } /// Get the AMQP method id for ack (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 80 } } @@ -3490,12 +3402,12 @@ pub mod basic { impl Reject { /// Get the AMQP class id for reject (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 60 } /// Get the AMQP method id for reject (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 90 } } @@ -3539,12 +3451,12 @@ pub mod basic { impl RecoverAsync { /// Get the AMQP class id for recover-async (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 60 } /// Get the AMQP method id for recover-async (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 100 } } @@ -3583,12 +3495,12 @@ pub mod basic { impl Recover { /// Get the AMQP class id for recover (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 60 } /// Get the AMQP method id for recover (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 110 } } @@ -3624,12 +3536,12 @@ pub mod basic { impl RecoverOk { /// Get the AMQP class id for recover-ok (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 60 } /// Get the AMQP method id for recover-ok (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 111 } } @@ -3663,12 +3575,12 @@ pub mod basic { impl Nack { /// Get the AMQP class id for nack (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 60 } /// Get the AMQP method id for nack (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 120 } } @@ -4161,12 +4073,12 @@ pub mod tx { impl Select { /// Get the AMQP class id for select (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 90 } /// Get the AMQP method id for select (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 10 } } @@ -4192,12 +4104,12 @@ pub mod tx { impl SelectOk { /// Get the AMQP class id for select-ok (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 90 } /// Get the AMQP method id for select-ok (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 11 } } @@ -4223,12 +4135,12 @@ pub mod tx { impl Commit { /// Get the AMQP class id for commit (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 90 } /// Get the AMQP method id for commit (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 20 } } @@ -4254,12 +4166,12 @@ pub mod tx { impl CommitOk { /// Get the AMQP class id for commit-ok (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 90 } /// Get the AMQP method id for commit-ok (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 21 } } @@ -4285,12 +4197,12 @@ pub mod tx { impl Rollback { /// Get the AMQP class id for rollback (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 90 } /// Get the AMQP method id for rollback (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 30 } } @@ -4316,12 +4228,12 @@ pub mod tx { impl RollbackOk { /// Get the AMQP class id for rollback-ok (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 90 } /// Get the AMQP method id for rollback-ok (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 31 } } @@ -4397,12 +4309,12 @@ pub mod confirm { impl Select { /// Get the AMQP class id for select (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 85 } /// Get the AMQP method id for select (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 10 } } @@ -4438,12 +4350,12 @@ pub mod confirm { impl SelectOk { /// Get the AMQP class id for select-ok (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { 85 } /// Get the AMQP method id for select-ok (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { 11 } } diff --git a/protocol/src/protocol.rs b/protocol/src/protocol.rs index 01eba6ef..d5f60b49 100644 --- a/protocol/src/protocol.rs +++ b/protocol/src/protocol.rs @@ -32,7 +32,7 @@ impl AMQPError { } /// Get the error corresponding to an id - pub fn from_id(id: ShortUInt, message: ShortString) -> Option<Self> { + pub fn from_id(id: Identifier, message: ShortString) -> Option<Self> { AMQPErrorKind::from_id(id).map(|kind| Self { kind, message }) } @@ -42,7 +42,7 @@ impl AMQPError { } /// Get the id of the error - pub fn get_id(&self) -> ShortUInt { + pub fn get_id(&self) -> Identifier { self.kind.get_id() } @@ -89,7 +89,7 @@ pub enum AMQPErrorKind { impl AMQPErrorKind { /// Get the id of the error - pub fn get_id(&self) -> ShortUInt { + pub fn get_id(&self) -> Identifier { match *self { AMQPErrorKind::Soft(ref s) => s.get_id(), AMQPErrorKind::Hard(ref h) => h.get_id(), @@ -97,7 +97,7 @@ impl AMQPErrorKind { } /// Get the error kind corresponding to an id - pub fn from_id(id: ShortUInt) -> Option<Self> { + pub fn from_id(id: Identifier) -> Option<Self> { AMQPSoftError::from_id(id) .map(AMQPErrorKind::Soft) .or_else(|| AMQPHardError::from_id(id).map(AMQPErrorKind::Hard)) diff --git a/protocol/templates/protocol.rs b/protocol/templates/protocol.rs index 5f328d71..74853502 100644 --- a/protocol/templates/protocol.rs +++ b/protocol/templates/protocol.rs @@ -37,7 +37,7 @@ pub enum AMQPSoftError { impl AMQPSoftError { /// Get the id of the soft error - pub fn get_id(&self) -> ShortUInt { + pub fn get_id(&self) -> Identifier { match *self { {{#each protocol.soft_errors as |constant| ~}} AMQPSoftError::{{camel constant.name}} => {{constant.value}}, @@ -46,7 +46,7 @@ impl AMQPSoftError { } /// Get the soft error corresponding to an id - pub fn from_id(id: ShortUInt) -> Option<AMQPSoftError> { + pub fn from_id(id: Identifier) -> Option<AMQPSoftError> { match id { {{#each protocol.soft_errors as |constant| ~}} {{constant.value}} => Some(AMQPSoftError::{{camel constant.name}}), @@ -77,7 +77,7 @@ pub enum AMQPHardError { impl AMQPHardError { /// Get the id of the hard error - pub fn get_id(&self) -> ShortUInt { + pub fn get_id(&self) -> Identifier { match *self { {{#each protocol.hard_errors as |constant| ~}} AMQPHardError::{{camel constant.name}} => {{constant.value}}, @@ -86,7 +86,7 @@ impl AMQPHardError { } /// Get the hard error corresponding to an id - pub fn from_id(id: ShortUInt) -> Option<AMQPHardError> { + pub fn from_id(id: Identifier) -> Option<AMQPHardError> { match id { {{#each protocol.hard_errors as |constant| ~}} {{constant.value}} => Some(AMQPHardError::{{camel constant.name}}), @@ -138,28 +138,6 @@ pub enum AMQPClass { {{/each ~}} } -impl AMQPClass { - /// Get the AMQP class id (Generated) - pub fn get_amqp_class_id(&self) -> u16 { - match self { - {{#each protocol.classes as |class| ~}} - AMQPClass::{{camel class.name}}(_) => {{class.id}}, - {{/each ~}} - } - } - - /// Get the AMQP method id (Generated) - pub fn get_amqp_method_id(&self) -> u16 { - match self { - {{#each protocol.classes as |class| ~}} - {{#each class.methods as |method| ~}} - AMQPClass::{{camel class.name}}({{snake class.name}}::AMQPMethod::{{camel method.name}}(_)) => {{method.id}}, - {{/each ~}} - {{/each ~}} - } - } -} - {{#each protocol.classes as |class|}} /// {{class.name}} (generated) pub mod {{snake class.name}} { @@ -223,12 +201,12 @@ pub mod {{snake class.name}} { impl {{camel method.name}} { /// Get the AMQP class id for {{method.name}} (Generated) - pub fn get_amqp_class_id(&self) -> u16 { + pub fn get_amqp_class_id(&self) -> Identifier { {{class.id}} } /// Get the AMQP method id for {{method.name}} (Generated) - pub fn get_amqp_method_id(&self) -> u16 { + pub fn get_amqp_method_id(&self) -> Identifier { {{method.id}} } } diff --git a/types/src/lib.rs b/types/src/lib.rs index 1dc14d6f..fbda328b 100644 --- a/types/src/lib.rs +++ b/types/src/lib.rs @@ -24,6 +24,8 @@ pub mod parsing; /// A Channel identifier pub type ChannelId = Identifier; +/// The size of a chunk of a delivery's payload +pub type ChunkSize = types::LongUInt; /// The number of consumers pub type ConsumerCount = types::LongUInt; /// A delivery tag @@ -40,3 +42,5 @@ pub type MessageCount = types::LongUInt; pub type PayloadSize = types::LongLongUInt; /// A reply code (for closing channels and connections) pub type ReplyCode = types::ShortUInt; +/// The weight associated to a payload +pub type Weight = types::ShortUInt; diff --git a/uri/Cargo.toml b/uri/Cargo.toml index 1f4cedd8..bae54210 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -13,6 +13,10 @@ license = "BSD-2-Clause" [lib] name = "amq_protocol_uri" +[dependencies.amq-protocol-types] +version = "=7.0.0-alpha.2" +path = "../types" + [dependencies] percent-encoding = "^2.0" url = "^2.0" diff --git a/uri/src/lib.rs b/uri/src/lib.rs index 2189cb05..d32f4672 100644 --- a/uri/src/lib.rs +++ b/uri/src/lib.rs @@ -7,6 +7,7 @@ //! amq-protocol-uri is a library aiming at providing tools to help //! managing AMQP URIs +use amq_protocol_types::{ChannelId, FrameSize, Heartbeat}; use url::Url; use std::{fmt, num::ParseIntError, str::FromStr}; @@ -69,11 +70,11 @@ pub struct AMQPUserInfo { #[derive(Clone, Debug, Default, PartialEq)] pub struct AMQPQueryString { /// The maximum size of an AMQP Frame - pub frame_max: Option<u32>, + pub frame_max: Option<FrameSize>, /// The maximum number of open channels - pub channel_max: Option<u16>, + pub channel_max: Option<ChannelId>, /// The maximum time between two heartbeats - pub heartbeat: Option<u16>, + pub heartbeat: Option<Heartbeat>, /// The maximum time to wait (in milliseconds) for the connection to succeed pub connection_timeout: Option<u64>, /// The SASL mechanism used for authentication From 98bbaf932c730601fe63a9f080559466cf9915fe Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Sat, 26 Dec 2020 17:11:11 +0100 Subject: [PATCH 051/133] drop weight 'The weight field is unused and must be zero' Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- protocol/src/frame/parsing.rs | 4 ++-- protocol/src/frame/structs.rs | 2 -- types/src/lib.rs | 2 -- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/protocol/src/frame/parsing.rs b/protocol/src/frame/parsing.rs index d1852434..ac52e138 100644 --- a/protocol/src/frame/parsing.rs +++ b/protocol/src/frame/parsing.rs @@ -125,9 +125,9 @@ pub fn parse_content_header<I: ParsableInput>(i: I) -> ParserResult<I, AMQPConte parse_long_long_uint, context("parse_properties", parse_properties), )), - |(class_id, weight, body_size, properties)| AMQPContentHeader { + // FIXME: should we validate that weight is 0? + |(class_id, _weight, body_size, properties)| AMQPContentHeader { class_id, - weight, body_size, properties, }, diff --git a/protocol/src/frame/structs.rs b/protocol/src/frame/structs.rs index a46e8552..7d0f3c02 100644 --- a/protocol/src/frame/structs.rs +++ b/protocol/src/frame/structs.rs @@ -133,8 +133,6 @@ pub struct AMQPRawFrame<I: ParsableInput> { pub struct AMQPContentHeader { /// The class of content pub class_id: Identifier, - /// The weight of the content - pub weight: Weight, /// The size of the content's body pub body_size: PayloadSize, /// The AMQP properties associated with the content diff --git a/types/src/lib.rs b/types/src/lib.rs index fbda328b..8169f659 100644 --- a/types/src/lib.rs +++ b/types/src/lib.rs @@ -42,5 +42,3 @@ pub type MessageCount = types::LongUInt; pub type PayloadSize = types::LongLongUInt; /// A reply code (for closing channels and connections) pub type ReplyCode = types::ShortUInt; -/// The weight associated to a payload -pub type Weight = types::ShortUInt; From 323ce83bfba743ad50ae5b185830028d37c503c5 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Sat, 26 Dec 2020 17:11:51 +0100 Subject: [PATCH 052/133] v7.0.0-alpha.3 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/Cargo.toml | 4 ++-- codegen/src/lib.rs | 2 +- protocol/Cargo.toml | 10 +++++----- protocol/src/lib.rs | 2 +- tcp/Cargo.toml | 4 ++-- tcp/src/lib.rs | 2 +- types/Cargo.toml | 2 +- types/src/lib.rs | 2 +- uri/Cargo.toml | 4 ++-- uri/src/lib.rs | 2 +- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index a3067087..b2b36d1e 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "7.0.0-alpha.2" # remember to update html_root_url +version = "7.0.0-alpha.3" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" @@ -18,7 +18,7 @@ handlebars = "^3.0" serde_json = "^1.0" [dependencies.amq-protocol-types] -version = "=7.0.0-alpha.2" +version = "=7.0.0-alpha.3" path = "../types" [dependencies.serde] diff --git a/codegen/src/lib.rs b/codegen/src/lib.rs index 99c72948..87eecb42 100644 --- a/codegen/src/lib.rs +++ b/codegen/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/7.0.0-alpha.2/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/7.0.0-alpha.3/")] //! # AMQP code generation utilities //! diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index 93fb3e50..c424f60b 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "7.0.0-alpha.2" # remember to update html_root_url +version = "7.0.0-alpha.3" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" @@ -27,21 +27,21 @@ vendored-openssl = ["amq-protocol-tcp/vendored-openssl"] verbose-errors = ["amq-protocol-types/verbose-errors"] [build-dependencies.amq-protocol-codegen] -version = "=7.0.0-alpha.2" +version = "=7.0.0-alpha.3" path = "../codegen" optional = true [dependencies.amq-protocol-tcp] -version = "=7.0.0-alpha.2" +version = "=7.0.0-alpha.3" default-features = false path = "../tcp" [dependencies.amq-protocol-types] -version = "=7.0.0-alpha.2" +version = "=7.0.0-alpha.3" path = "../types" [dependencies.amq-protocol-uri] -version = "=7.0.0-alpha.2" +version = "=7.0.0-alpha.3" path = "../uri" [dependencies.cookie-factory] diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs index 3620ff39..4b834c97 100644 --- a/protocol/src/lib.rs +++ b/protocol/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol/7.0.0-alpha.2/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol/7.0.0-alpha.3/")] //! # AMQP manipulation library //! diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index a53629f1..14ec73b2 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "7.0.0-alpha.2" # remember to update html_root_url +version = "7.0.0-alpha.3" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" @@ -24,7 +24,7 @@ rustls-connector = ["tcp-stream/rustls-connector"] vendored-openssl = ["tcp-stream/vendored-openssl"] [dependencies.amq-protocol-uri] -version = "=7.0.0-alpha.2" +version = "=7.0.0-alpha.3" path = "../uri" [dependencies.tcp-stream] diff --git a/tcp/src/lib.rs b/tcp/src/lib.rs index e44b2e1c..4da41a9b 100644 --- a/tcp/src/lib.rs +++ b/tcp/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/7.0.0-alpha.2/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/7.0.0-alpha.3/")] //! # AMQP URI TCP connection handling //! diff --git a/types/Cargo.toml b/types/Cargo.toml index 539a0bcf..c21c3449 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "7.0.0-alpha.2" # remember to update html_root_url +version = "7.0.0-alpha.3" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/types/src/lib.rs b/types/src/lib.rs index 8169f659..743699a7 100644 --- a/types/src/lib.rs +++ b/types/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-types/7.0.0-alpha.2/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-types/7.0.0-alpha.3/")] //! # AMQP types manipulation library //! diff --git a/uri/Cargo.toml b/uri/Cargo.toml index bae54210..7d8c0052 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "7.0.0-alpha.2" # remember to update html_root_url +version = "7.0.0-alpha.3" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" @@ -14,7 +14,7 @@ license = "BSD-2-Clause" name = "amq_protocol_uri" [dependencies.amq-protocol-types] -version = "=7.0.0-alpha.2" +version = "=7.0.0-alpha.3" path = "../types" [dependencies] diff --git a/uri/src/lib.rs b/uri/src/lib.rs index d32f4672..9ffd19bc 100644 --- a/uri/src/lib.rs +++ b/uri/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/7.0.0-alpha.2/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/7.0.0-alpha.3/")] //! # AMQP URI manipulation library //! From c37393302af00c8cd3c8a2afad8d5f8fc437e281 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Sat, 26 Dec 2020 17:19:50 +0100 Subject: [PATCH 053/133] add back mising methods Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- protocol/src/generated.rs | 88 ++++++++++++++++++++++++++++++++++ protocol/templates/protocol.rs | 22 +++++++++ 2 files changed, 110 insertions(+) diff --git a/protocol/src/generated.rs b/protocol/src/generated.rs index e4ea60bb..e942f55a 100644 --- a/protocol/src/generated.rs +++ b/protocol/src/generated.rs @@ -277,6 +277,94 @@ pub enum AMQPClass { Confirm(confirm::AMQPMethod), } +impl AMQPClass { + /// Get the AMQP class id (Generated) + pub fn get_amqp_class_id(&self) -> Identifier { + match self { + AMQPClass::Connection(_) => 10, + AMQPClass::Channel(_) => 20, + AMQPClass::Access(_) => 30, + AMQPClass::Exchange(_) => 40, + AMQPClass::Queue(_) => 50, + AMQPClass::Basic(_) => 60, + AMQPClass::Tx(_) => 90, + AMQPClass::Confirm(_) => 85, + } + } + + /// Get the AMQP method id (Generated) + pub fn get_amqp_method_id(&self) -> Identifier { + match self { + AMQPClass::Connection(connection::AMQPMethod::Start(_)) => 10, + AMQPClass::Connection(connection::AMQPMethod::StartOk(_)) => 11, + AMQPClass::Connection(connection::AMQPMethod::Secure(_)) => 20, + AMQPClass::Connection(connection::AMQPMethod::SecureOk(_)) => 21, + AMQPClass::Connection(connection::AMQPMethod::Tune(_)) => 30, + AMQPClass::Connection(connection::AMQPMethod::TuneOk(_)) => 31, + AMQPClass::Connection(connection::AMQPMethod::Open(_)) => 40, + AMQPClass::Connection(connection::AMQPMethod::OpenOk(_)) => 41, + AMQPClass::Connection(connection::AMQPMethod::Close(_)) => 50, + AMQPClass::Connection(connection::AMQPMethod::CloseOk(_)) => 51, + AMQPClass::Connection(connection::AMQPMethod::Blocked(_)) => 60, + AMQPClass::Connection(connection::AMQPMethod::Unblocked(_)) => 61, + AMQPClass::Connection(connection::AMQPMethod::UpdateSecret(_)) => 70, + AMQPClass::Connection(connection::AMQPMethod::UpdateSecretOk(_)) => 71, + AMQPClass::Channel(channel::AMQPMethod::Open(_)) => 10, + AMQPClass::Channel(channel::AMQPMethod::OpenOk(_)) => 11, + AMQPClass::Channel(channel::AMQPMethod::Flow(_)) => 20, + AMQPClass::Channel(channel::AMQPMethod::FlowOk(_)) => 21, + AMQPClass::Channel(channel::AMQPMethod::Close(_)) => 40, + AMQPClass::Channel(channel::AMQPMethod::CloseOk(_)) => 41, + AMQPClass::Access(access::AMQPMethod::Request(_)) => 10, + AMQPClass::Access(access::AMQPMethod::RequestOk(_)) => 11, + AMQPClass::Exchange(exchange::AMQPMethod::Declare(_)) => 10, + AMQPClass::Exchange(exchange::AMQPMethod::DeclareOk(_)) => 11, + AMQPClass::Exchange(exchange::AMQPMethod::Delete(_)) => 20, + AMQPClass::Exchange(exchange::AMQPMethod::DeleteOk(_)) => 21, + AMQPClass::Exchange(exchange::AMQPMethod::Bind(_)) => 30, + AMQPClass::Exchange(exchange::AMQPMethod::BindOk(_)) => 31, + AMQPClass::Exchange(exchange::AMQPMethod::Unbind(_)) => 40, + AMQPClass::Exchange(exchange::AMQPMethod::UnbindOk(_)) => 51, + AMQPClass::Queue(queue::AMQPMethod::Declare(_)) => 10, + AMQPClass::Queue(queue::AMQPMethod::DeclareOk(_)) => 11, + AMQPClass::Queue(queue::AMQPMethod::Bind(_)) => 20, + AMQPClass::Queue(queue::AMQPMethod::BindOk(_)) => 21, + AMQPClass::Queue(queue::AMQPMethod::Purge(_)) => 30, + AMQPClass::Queue(queue::AMQPMethod::PurgeOk(_)) => 31, + AMQPClass::Queue(queue::AMQPMethod::Delete(_)) => 40, + AMQPClass::Queue(queue::AMQPMethod::DeleteOk(_)) => 41, + AMQPClass::Queue(queue::AMQPMethod::Unbind(_)) => 50, + AMQPClass::Queue(queue::AMQPMethod::UnbindOk(_)) => 51, + AMQPClass::Basic(basic::AMQPMethod::Qos(_)) => 10, + AMQPClass::Basic(basic::AMQPMethod::QosOk(_)) => 11, + AMQPClass::Basic(basic::AMQPMethod::Consume(_)) => 20, + AMQPClass::Basic(basic::AMQPMethod::ConsumeOk(_)) => 21, + AMQPClass::Basic(basic::AMQPMethod::Cancel(_)) => 30, + AMQPClass::Basic(basic::AMQPMethod::CancelOk(_)) => 31, + AMQPClass::Basic(basic::AMQPMethod::Publish(_)) => 40, + AMQPClass::Basic(basic::AMQPMethod::Return(_)) => 50, + AMQPClass::Basic(basic::AMQPMethod::Deliver(_)) => 60, + AMQPClass::Basic(basic::AMQPMethod::Get(_)) => 70, + AMQPClass::Basic(basic::AMQPMethod::GetOk(_)) => 71, + AMQPClass::Basic(basic::AMQPMethod::GetEmpty(_)) => 72, + AMQPClass::Basic(basic::AMQPMethod::Ack(_)) => 80, + AMQPClass::Basic(basic::AMQPMethod::Reject(_)) => 90, + AMQPClass::Basic(basic::AMQPMethod::RecoverAsync(_)) => 100, + AMQPClass::Basic(basic::AMQPMethod::Recover(_)) => 110, + AMQPClass::Basic(basic::AMQPMethod::RecoverOk(_)) => 111, + AMQPClass::Basic(basic::AMQPMethod::Nack(_)) => 120, + AMQPClass::Tx(tx::AMQPMethod::Select(_)) => 10, + AMQPClass::Tx(tx::AMQPMethod::SelectOk(_)) => 11, + AMQPClass::Tx(tx::AMQPMethod::Commit(_)) => 20, + AMQPClass::Tx(tx::AMQPMethod::CommitOk(_)) => 21, + AMQPClass::Tx(tx::AMQPMethod::Rollback(_)) => 30, + AMQPClass::Tx(tx::AMQPMethod::RollbackOk(_)) => 31, + AMQPClass::Confirm(confirm::AMQPMethod::Select(_)) => 10, + AMQPClass::Confirm(confirm::AMQPMethod::SelectOk(_)) => 11, + } + } +} + /// connection (generated) pub mod connection { use super::*; diff --git a/protocol/templates/protocol.rs b/protocol/templates/protocol.rs index 74853502..29213cfa 100644 --- a/protocol/templates/protocol.rs +++ b/protocol/templates/protocol.rs @@ -138,6 +138,28 @@ pub enum AMQPClass { {{/each ~}} } +impl AMQPClass { + /// Get the AMQP class id (Generated) + pub fn get_amqp_class_id(&self) -> Identifier { + match self { + {{#each protocol.classes as |class| ~}} + AMQPClass::{{camel class.name}}(_) => {{class.id}}, + {{/each ~}} + } + } + + /// Get the AMQP method id (Generated) + pub fn get_amqp_method_id(&self) -> Identifier { + match self { + {{#each protocol.classes as |class| ~}} + {{#each class.methods as |method| ~}} + AMQPClass::{{camel class.name}}({{snake class.name}}::AMQPMethod::{{camel method.name}}(_)) => {{method.id}}, + {{/each ~}} + {{/each ~}} + } + } +} + {{#each protocol.classes as |class|}} /// {{class.name}} (generated) pub mod {{snake class.name}} { From 597b55ca4a74dc0eb73c5179729db428be1610c8 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Sat, 26 Dec 2020 17:20:09 +0100 Subject: [PATCH 054/133] v7.0.0-alpha.4 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/Cargo.toml | 4 ++-- codegen/src/lib.rs | 2 +- protocol/Cargo.toml | 10 +++++----- protocol/src/lib.rs | 2 +- tcp/Cargo.toml | 4 ++-- tcp/src/lib.rs | 2 +- types/Cargo.toml | 2 +- types/src/lib.rs | 2 +- uri/Cargo.toml | 4 ++-- uri/src/lib.rs | 2 +- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index b2b36d1e..b64a4f68 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "7.0.0-alpha.3" # remember to update html_root_url +version = "7.0.0-alpha.4" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" @@ -18,7 +18,7 @@ handlebars = "^3.0" serde_json = "^1.0" [dependencies.amq-protocol-types] -version = "=7.0.0-alpha.3" +version = "=7.0.0-alpha.4" path = "../types" [dependencies.serde] diff --git a/codegen/src/lib.rs b/codegen/src/lib.rs index 87eecb42..d3d10395 100644 --- a/codegen/src/lib.rs +++ b/codegen/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/7.0.0-alpha.3/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/7.0.0-alpha.4/")] //! # AMQP code generation utilities //! diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index c424f60b..f0e5fa35 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "7.0.0-alpha.3" # remember to update html_root_url +version = "7.0.0-alpha.4" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" @@ -27,21 +27,21 @@ vendored-openssl = ["amq-protocol-tcp/vendored-openssl"] verbose-errors = ["amq-protocol-types/verbose-errors"] [build-dependencies.amq-protocol-codegen] -version = "=7.0.0-alpha.3" +version = "=7.0.0-alpha.4" path = "../codegen" optional = true [dependencies.amq-protocol-tcp] -version = "=7.0.0-alpha.3" +version = "=7.0.0-alpha.4" default-features = false path = "../tcp" [dependencies.amq-protocol-types] -version = "=7.0.0-alpha.3" +version = "=7.0.0-alpha.4" path = "../types" [dependencies.amq-protocol-uri] -version = "=7.0.0-alpha.3" +version = "=7.0.0-alpha.4" path = "../uri" [dependencies.cookie-factory] diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs index 4b834c97..13ac87a9 100644 --- a/protocol/src/lib.rs +++ b/protocol/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol/7.0.0-alpha.3/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol/7.0.0-alpha.4/")] //! # AMQP manipulation library //! diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index 14ec73b2..da010c1c 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "7.0.0-alpha.3" # remember to update html_root_url +version = "7.0.0-alpha.4" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" @@ -24,7 +24,7 @@ rustls-connector = ["tcp-stream/rustls-connector"] vendored-openssl = ["tcp-stream/vendored-openssl"] [dependencies.amq-protocol-uri] -version = "=7.0.0-alpha.3" +version = "=7.0.0-alpha.4" path = "../uri" [dependencies.tcp-stream] diff --git a/tcp/src/lib.rs b/tcp/src/lib.rs index 4da41a9b..b1dd001f 100644 --- a/tcp/src/lib.rs +++ b/tcp/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/7.0.0-alpha.3/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/7.0.0-alpha.4/")] //! # AMQP URI TCP connection handling //! diff --git a/types/Cargo.toml b/types/Cargo.toml index c21c3449..6d2d8b13 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "7.0.0-alpha.3" # remember to update html_root_url +version = "7.0.0-alpha.4" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/types/src/lib.rs b/types/src/lib.rs index 743699a7..49e435f5 100644 --- a/types/src/lib.rs +++ b/types/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-types/7.0.0-alpha.3/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-types/7.0.0-alpha.4/")] //! # AMQP types manipulation library //! diff --git a/uri/Cargo.toml b/uri/Cargo.toml index 7d8c0052..73c6340e 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "7.0.0-alpha.3" # remember to update html_root_url +version = "7.0.0-alpha.4" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" @@ -14,7 +14,7 @@ license = "BSD-2-Clause" name = "amq_protocol_uri" [dependencies.amq-protocol-types] -version = "=7.0.0-alpha.3" +version = "=7.0.0-alpha.4" path = "../types" [dependencies] diff --git a/uri/src/lib.rs b/uri/src/lib.rs index 9ffd19bc..e7cb7513 100644 --- a/uri/src/lib.rs +++ b/uri/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/7.0.0-alpha.3/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/7.0.0-alpha.4/")] //! # AMQP URI manipulation library //! From fb24e01f619dfed299bc01bcc93e86caf35b4c79 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Sun, 27 Dec 2020 12:35:28 +0100 Subject: [PATCH 055/133] update tcp-stream, default to rustls Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- tcp/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index da010c1c..2d18fe01 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -14,7 +14,7 @@ license = "BSD-2-Clause" name = "amq_protocol_tcp" [features] -default = ["native-tls"] +default = ["rustls"] native-tls = ["tcp-stream/native-tls"] openssl = ["tcp-stream/openssl"] rustls = ["rustls-native-certs"] @@ -28,7 +28,7 @@ version = "=7.0.0-alpha.4" path = "../uri" [dependencies.tcp-stream] -version = "^0.21" +version = "^0.22" default-features = false [dependencies.tracing] From 38a6b29f0fffc4cfca387ec72af87a699186cd88 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Sun, 27 Dec 2020 12:36:00 +0100 Subject: [PATCH 056/133] v7.0.0-alpha.5 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/Cargo.toml | 4 ++-- codegen/src/lib.rs | 2 +- protocol/Cargo.toml | 10 +++++----- protocol/src/lib.rs | 2 +- tcp/Cargo.toml | 4 ++-- tcp/src/lib.rs | 2 +- types/Cargo.toml | 2 +- types/src/lib.rs | 2 +- uri/Cargo.toml | 4 ++-- uri/src/lib.rs | 2 +- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index b64a4f68..32aacd50 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "7.0.0-alpha.4" # remember to update html_root_url +version = "7.0.0-alpha.5" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" @@ -18,7 +18,7 @@ handlebars = "^3.0" serde_json = "^1.0" [dependencies.amq-protocol-types] -version = "=7.0.0-alpha.4" +version = "=7.0.0-alpha.5" path = "../types" [dependencies.serde] diff --git a/codegen/src/lib.rs b/codegen/src/lib.rs index d3d10395..e7a610f7 100644 --- a/codegen/src/lib.rs +++ b/codegen/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/7.0.0-alpha.4/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/7.0.0-alpha.5/")] //! # AMQP code generation utilities //! diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index f0e5fa35..baf6e4bf 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "7.0.0-alpha.4" # remember to update html_root_url +version = "7.0.0-alpha.5" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" @@ -27,21 +27,21 @@ vendored-openssl = ["amq-protocol-tcp/vendored-openssl"] verbose-errors = ["amq-protocol-types/verbose-errors"] [build-dependencies.amq-protocol-codegen] -version = "=7.0.0-alpha.4" +version = "=7.0.0-alpha.5" path = "../codegen" optional = true [dependencies.amq-protocol-tcp] -version = "=7.0.0-alpha.4" +version = "=7.0.0-alpha.5" default-features = false path = "../tcp" [dependencies.amq-protocol-types] -version = "=7.0.0-alpha.4" +version = "=7.0.0-alpha.5" path = "../types" [dependencies.amq-protocol-uri] -version = "=7.0.0-alpha.4" +version = "=7.0.0-alpha.5" path = "../uri" [dependencies.cookie-factory] diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs index 13ac87a9..b701d8da 100644 --- a/protocol/src/lib.rs +++ b/protocol/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol/7.0.0-alpha.4/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol/7.0.0-alpha.5/")] //! # AMQP manipulation library //! diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index 2d18fe01..bb50ec04 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "7.0.0-alpha.4" # remember to update html_root_url +version = "7.0.0-alpha.5" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" @@ -24,7 +24,7 @@ rustls-connector = ["tcp-stream/rustls-connector"] vendored-openssl = ["tcp-stream/vendored-openssl"] [dependencies.amq-protocol-uri] -version = "=7.0.0-alpha.4" +version = "=7.0.0-alpha.5" path = "../uri" [dependencies.tcp-stream] diff --git a/tcp/src/lib.rs b/tcp/src/lib.rs index b1dd001f..8545276e 100644 --- a/tcp/src/lib.rs +++ b/tcp/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/7.0.0-alpha.4/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/7.0.0-alpha.5/")] //! # AMQP URI TCP connection handling //! diff --git a/types/Cargo.toml b/types/Cargo.toml index 6d2d8b13..8a439f0b 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "7.0.0-alpha.4" # remember to update html_root_url +version = "7.0.0-alpha.5" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/types/src/lib.rs b/types/src/lib.rs index 49e435f5..b17e68ae 100644 --- a/types/src/lib.rs +++ b/types/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-types/7.0.0-alpha.4/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-types/7.0.0-alpha.5/")] //! # AMQP types manipulation library //! diff --git a/uri/Cargo.toml b/uri/Cargo.toml index 73c6340e..7f0df4b6 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "7.0.0-alpha.4" # remember to update html_root_url +version = "7.0.0-alpha.5" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" @@ -14,7 +14,7 @@ license = "BSD-2-Clause" name = "amq_protocol_uri" [dependencies.amq-protocol-types] -version = "=7.0.0-alpha.4" +version = "=7.0.0-alpha.5" path = "../types" [dependencies] diff --git a/uri/src/lib.rs b/uri/src/lib.rs index e7cb7513..98869592 100644 --- a/uri/src/lib.rs +++ b/uri/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/7.0.0-alpha.4/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/7.0.0-alpha.5/")] //! # AMQP URI manipulation library //! From f889c230a161c28c188e6738ba3b256d41ed545d Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Tue, 5 Jan 2021 10:04:47 +0100 Subject: [PATCH 057/133] clippy Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/src/templating.rs | 14 ++++---------- protocol/src/frame/parsing.rs | 2 +- protocol/src/frame/structs.rs | 6 +----- types/src/parsing.rs | 2 +- 4 files changed, 7 insertions(+), 17 deletions(-) diff --git a/codegen/src/templating.rs b/codegen/src/templating.rs index 510e7216..7bf0228f 100644 --- a/codegen/src/templating.rs +++ b/codegen/src/templating.rs @@ -246,14 +246,11 @@ impl HelperDef for PassByRefHelper { .ok_or_else(|| RenderError::new("Param not found for helper \"pass_by_ref\""))?; let param: AMQPType = serde_json::from_value(value.value().clone()) .map_err(|_| RenderError::new("Param is not an AMQPType for helper \"pass_by_ref\""))?; - let pass_by_ref = match param { - AMQPType::ShortString + let pass_by_ref = matches!(param, AMQPType::ShortString | AMQPType::LongString | AMQPType::FieldArray | AMQPType::FieldTable - | AMQPType::ByteArray => true, - _ => false, - }; + | AMQPType::ByteArray); Ok(Some(ScopedJson::Derived(JsonValue::from(pass_by_ref)))) } } @@ -272,10 +269,7 @@ impl HelperDef for UseStrRefHelper { .param(0) .ok_or_else(|| RenderError::new("Param not found for helper \"use_str_ref\""))?; let param = serde_json::from_value::<AMQPType>(value.value().clone()).ok(); - let use_str_ref = match param { - Some(AMQPType::ShortString) | Some(AMQPType::LongString) => true, - _ => false, - }; + let use_str_ref = matches!(param, Some(AMQPType::ShortString) | Some(AMQPType::LongString)); Ok(Some(ScopedJson::Derived(JsonValue::from(use_str_ref)))) } } @@ -388,7 +382,7 @@ mod test { use std::collections::BTreeMap; - pub const TEMPLATE: &'static str = r#" + pub const TEMPLATE: &str = r#" {{protocol.name}} - {{protocol.major_version}}.{{protocol.minor_version}}.{{protocol.revision}} {{protocol.copyright}} port {{protocol.port}} diff --git a/protocol/src/frame/parsing.rs b/protocol/src/frame/parsing.rs index ac52e138..4f9a189a 100644 --- a/protocol/src/frame/parsing.rs +++ b/protocol/src/frame/parsing.rs @@ -142,7 +142,7 @@ mod test { #[test] fn test_protocol_header() { assert_eq!( - parse_frame(&['A' as u8, 'M' as u8, 'Q' as u8, 'P' as u8, 0, 0, 9, 1][..]), + parse_frame(&[b'A', b'M', b'Q', b'P', 0, 0, 9, 1][..]), Ok(( &[][..], AMQPFrame::ProtocolHeader(ProtocolVersion::amqp_0_9_1()) diff --git a/protocol/src/frame/structs.rs b/protocol/src/frame/structs.rs index 7d0f3c02..9d0a6727 100644 --- a/protocol/src/frame/structs.rs +++ b/protocol/src/frame/structs.rs @@ -62,11 +62,7 @@ pub enum AMQPFrame { impl AMQPFrame { /// Return whether this frame is an AMQPFrame::Header or not pub fn is_header(&self) -> bool { - if let AMQPFrame::Header(..) = self { - true - } else { - false - } + matches!(self, AMQPFrame::Header(..)) } } diff --git a/types/src/parsing.rs b/types/src/parsing.rs index 2bd7ac67..ef09d9ad 100644 --- a/types/src/parsing.rs +++ b/types/src/parsing.rs @@ -325,7 +325,7 @@ pub mod traits { mod test { use super::*; - const EMPTY: &'static [u8] = b""; + const EMPTY: &[u8] = b""; #[test] fn test_parse_value() { From be606769fba41946470fb5ea2581e8811c2daeca Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Tue, 5 Jan 2021 12:05:54 +0100 Subject: [PATCH 058/133] rustfmt Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/src/templating.rs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/codegen/src/templating.rs b/codegen/src/templating.rs index 7bf0228f..fcc8851c 100644 --- a/codegen/src/templating.rs +++ b/codegen/src/templating.rs @@ -246,11 +246,14 @@ impl HelperDef for PassByRefHelper { .ok_or_else(|| RenderError::new("Param not found for helper \"pass_by_ref\""))?; let param: AMQPType = serde_json::from_value(value.value().clone()) .map_err(|_| RenderError::new("Param is not an AMQPType for helper \"pass_by_ref\""))?; - let pass_by_ref = matches!(param, AMQPType::ShortString - | AMQPType::LongString - | AMQPType::FieldArray - | AMQPType::FieldTable - | AMQPType::ByteArray); + let pass_by_ref = matches!( + param, + AMQPType::ShortString + | AMQPType::LongString + | AMQPType::FieldArray + | AMQPType::FieldTable + | AMQPType::ByteArray + ); Ok(Some(ScopedJson::Derived(JsonValue::from(pass_by_ref)))) } } @@ -269,7 +272,10 @@ impl HelperDef for UseStrRefHelper { .param(0) .ok_or_else(|| RenderError::new("Param not found for helper \"use_str_ref\""))?; let param = serde_json::from_value::<AMQPType>(value.value().clone()).ok(); - let use_str_ref = matches!(param, Some(AMQPType::ShortString) | Some(AMQPType::LongString)); + let use_str_ref = matches!( + param, + Some(AMQPType::ShortString) | Some(AMQPType::LongString) + ); Ok(Some(ScopedJson::Derived(JsonValue::from(use_str_ref)))) } } From 7256ea6163cb9cc5a82c4ad1995d39e5135810a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Teo=20Klestrup=20R=C3=B6ijezon?= <teo@nullable.se> Date: Tue, 16 Feb 2021 21:06:32 +0100 Subject: [PATCH 059/133] Derive Eq for AMQPUri Fixes #26 --- uri/src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/uri/src/lib.rs b/uri/src/lib.rs index 98869592..903f9676 100644 --- a/uri/src/lib.rs +++ b/uri/src/lib.rs @@ -13,7 +13,7 @@ use url::Url; use std::{fmt, num::ParseIntError, str::FromStr}; /// An AMQP Uri -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub struct AMQPUri { /// The scheme used by the AMQP connection pub scheme: AMQPScheme, @@ -26,7 +26,7 @@ pub struct AMQPUri { } /// The scheme used by the AMQP connection -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub enum AMQPScheme { /// Plain AMQP AMQP, @@ -47,7 +47,7 @@ impl FromStr for AMQPScheme { } /// The connection information -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub struct AMQPAuthority { /// The credentials used to connect to the server pub userinfo: AMQPUserInfo, @@ -58,7 +58,7 @@ pub struct AMQPAuthority { } /// The credentials used to connect to the server -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub struct AMQPUserInfo { /// The username pub username: String, @@ -67,7 +67,7 @@ pub struct AMQPUserInfo { } /// The optional query string to pass parameters to the server -#[derive(Clone, Debug, Default, PartialEq)] +#[derive(Clone, Debug, Default, PartialEq, Eq)] pub struct AMQPQueryString { /// The maximum size of an AMQP Frame pub frame_max: Option<FrameSize>, From b5e80f9ad5eae4f2775bdb17a7817a24db3c4df8 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Tue, 16 Feb 2021 21:26:16 +0100 Subject: [PATCH 060/133] codegen: fix warning Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/src/internal.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codegen/src/internal.rs b/codegen/src/internal.rs index 629972f1..402062eb 100644 --- a/codegen/src/internal.rs +++ b/codegen/src/internal.rs @@ -484,7 +484,7 @@ impl _AMQPArgument { None => { let domain = match self.domain { Some(ref domain) => domain, - None => panic!(format!("{} has no type nor domain", self.name)), + None => panic!("{} has no type nor domain", self.name), }; *domains .get(domain) From 7e8cf0b0e1bda0eecf8658b72a9ec65d913dfcd8 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Tue, 16 Feb 2021 21:27:44 +0100 Subject: [PATCH 061/133] v7.0.0-alpha.6 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/Cargo.toml | 4 ++-- codegen/src/lib.rs | 2 +- protocol/Cargo.toml | 10 +++++----- protocol/src/lib.rs | 2 +- tcp/Cargo.toml | 4 ++-- tcp/src/lib.rs | 2 +- types/Cargo.toml | 2 +- types/src/lib.rs | 2 +- uri/Cargo.toml | 4 ++-- uri/src/lib.rs | 2 +- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 32aacd50..77daa119 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "7.0.0-alpha.5" # remember to update html_root_url +version = "7.0.0-alpha.6" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" @@ -18,7 +18,7 @@ handlebars = "^3.0" serde_json = "^1.0" [dependencies.amq-protocol-types] -version = "=7.0.0-alpha.5" +version = "=7.0.0-alpha.6" path = "../types" [dependencies.serde] diff --git a/codegen/src/lib.rs b/codegen/src/lib.rs index e7a610f7..a6e30bc3 100644 --- a/codegen/src/lib.rs +++ b/codegen/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/7.0.0-alpha.5/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/7.0.0-alpha.6/")] //! # AMQP code generation utilities //! diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index baf6e4bf..cc122e5b 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "7.0.0-alpha.5" # remember to update html_root_url +version = "7.0.0-alpha.6" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" @@ -27,21 +27,21 @@ vendored-openssl = ["amq-protocol-tcp/vendored-openssl"] verbose-errors = ["amq-protocol-types/verbose-errors"] [build-dependencies.amq-protocol-codegen] -version = "=7.0.0-alpha.5" +version = "=7.0.0-alpha.6" path = "../codegen" optional = true [dependencies.amq-protocol-tcp] -version = "=7.0.0-alpha.5" +version = "=7.0.0-alpha.6" default-features = false path = "../tcp" [dependencies.amq-protocol-types] -version = "=7.0.0-alpha.5" +version = "=7.0.0-alpha.6" path = "../types" [dependencies.amq-protocol-uri] -version = "=7.0.0-alpha.5" +version = "=7.0.0-alpha.6" path = "../uri" [dependencies.cookie-factory] diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs index b701d8da..5424248c 100644 --- a/protocol/src/lib.rs +++ b/protocol/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol/7.0.0-alpha.5/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol/7.0.0-alpha.6/")] //! # AMQP manipulation library //! diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index bb50ec04..5d8f4a74 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "7.0.0-alpha.5" # remember to update html_root_url +version = "7.0.0-alpha.6" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" @@ -24,7 +24,7 @@ rustls-connector = ["tcp-stream/rustls-connector"] vendored-openssl = ["tcp-stream/vendored-openssl"] [dependencies.amq-protocol-uri] -version = "=7.0.0-alpha.5" +version = "=7.0.0-alpha.6" path = "../uri" [dependencies.tcp-stream] diff --git a/tcp/src/lib.rs b/tcp/src/lib.rs index 8545276e..8fb3cc20 100644 --- a/tcp/src/lib.rs +++ b/tcp/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/7.0.0-alpha.5/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/7.0.0-alpha.6/")] //! # AMQP URI TCP connection handling //! diff --git a/types/Cargo.toml b/types/Cargo.toml index 8a439f0b..0a028949 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "7.0.0-alpha.5" # remember to update html_root_url +version = "7.0.0-alpha.6" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/types/src/lib.rs b/types/src/lib.rs index b17e68ae..283c1a42 100644 --- a/types/src/lib.rs +++ b/types/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-types/7.0.0-alpha.5/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-types/7.0.0-alpha.6/")] //! # AMQP types manipulation library //! diff --git a/uri/Cargo.toml b/uri/Cargo.toml index 7f0df4b6..3277f7bb 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "7.0.0-alpha.5" # remember to update html_root_url +version = "7.0.0-alpha.6" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" @@ -14,7 +14,7 @@ license = "BSD-2-Clause" name = "amq_protocol_uri" [dependencies.amq-protocol-types] -version = "=7.0.0-alpha.5" +version = "=7.0.0-alpha.6" path = "../types" [dependencies] diff --git a/uri/src/lib.rs b/uri/src/lib.rs index 903f9676..4cf9c579 100644 --- a/uri/src/lib.rs +++ b/uri/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/7.0.0-alpha.5/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/7.0.0-alpha.6/")] //! # AMQP URI manipulation library //! From 3b32c7601f787ce327433c7c9897e99d1807ca6c Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Wed, 17 Mar 2021 22:53:04 +0100 Subject: [PATCH 062/133] update handlebars Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/Cargo.toml | 2 +- codegen/src/templating.rs | 7 +- protocol/src/generated.rs | 148 -------------------------------------- 3 files changed, 4 insertions(+), 153 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 77daa119..841828f8 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -14,7 +14,7 @@ license = "BSD-2-Clause" name = "amq_protocol_codegen" [dependencies] -handlebars = "^3.0" +handlebars = "^4.0.0-beta" serde_json = "^1.0" [dependencies.amq-protocol-types] diff --git a/codegen/src/templating.rs b/codegen/src/templating.rs index fcc8851c..f1b02eae 100644 --- a/codegen/src/templating.rs +++ b/codegen/src/templating.rs @@ -316,9 +316,9 @@ impl HelperDef for EachArgumentHelper { AMQPArgument::Value(_) => ("Value".to_owned(), true), AMQPArgument::Flags(_) => ("Flags".to_owned(), false), }; - block.set_local_var("@index".to_string(), to_json(&index)); - block.set_local_var("@last".to_string(), to_json(index == len - 1)); - block.set_local_var("@argument_is_value".to_string(), to_json(&is_value)); + block.set_local_var("index", to_json(&index)); + block.set_local_var("last", to_json(index == len - 1)); + block.set_local_var("argument_is_value", to_json(&is_value)); if let Some(ref p) = array_path { if index == 0 { let mut path = Vec::with_capacity(p.len() + 1); @@ -506,7 +506,6 @@ property1: LongString 64 - method1 synchronous: true argument1(domain1): LongString - flag1: true flag2: false "# diff --git a/protocol/src/generated.rs b/protocol/src/generated.rs index e942f55a..57a4fd37 100644 --- a/protocol/src/generated.rs +++ b/protocol/src/generated.rs @@ -558,7 +558,6 @@ pub mod connection { Ok(input) } } - /// start-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct StartOk { @@ -614,7 +613,6 @@ pub mod connection { Ok(input) } } - /// secure (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct Secure { @@ -650,7 +648,6 @@ pub mod connection { Ok(input) } } - /// secure-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct SecureOk { @@ -686,7 +683,6 @@ pub mod connection { Ok(input) } } - /// tune (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct Tune { @@ -737,7 +733,6 @@ pub mod connection { Ok(input) } } - /// tune-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct TuneOk { @@ -788,7 +783,6 @@ pub mod connection { Ok(input) } } - /// open (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct Open { @@ -812,7 +806,6 @@ pub mod connection { pub fn parse_open<I: ParsableInput>(i: I) -> ParserResult<I, Open> { let (i, virtual_host) = parse_short_string(i)?; let (i, _) = parse_short_string(i)?; - let (i, _) = parse_flags(i, &["insist"])?; Ok((i, Open { virtual_host })) } @@ -827,12 +820,10 @@ pub mod connection { input = gen_id(40)(input)?; input = gen_short_string(method.virtual_host.as_str())(input)?; input = gen_short_string("")(input)?; - input = gen_flags(&flags)(input)?; Ok(input) } } - /// open-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct OpenOk {} @@ -865,7 +856,6 @@ pub mod connection { Ok(input) } } - /// close (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct Close { @@ -921,7 +911,6 @@ pub mod connection { Ok(input) } } - /// close-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct CloseOk {} @@ -952,7 +941,6 @@ pub mod connection { Ok(input) } } - /// blocked (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct Blocked { @@ -988,7 +976,6 @@ pub mod connection { Ok(input) } } - /// unblocked (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct Unblocked {} @@ -1019,7 +1006,6 @@ pub mod connection { Ok(input) } } - /// update-secret (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct UpdateSecret { @@ -1059,7 +1045,6 @@ pub mod connection { Ok(input) } } - /// update-secret-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct UpdateSecretOk {} @@ -1091,7 +1076,6 @@ pub mod connection { } } } - /// channel (generated) pub mod channel { use super::*; @@ -1196,7 +1180,6 @@ pub mod channel { Ok(input) } } - /// open-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct OpenOk {} @@ -1229,7 +1212,6 @@ pub mod channel { Ok(input) } } - /// flow (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct Flow { @@ -1268,12 +1250,10 @@ pub mod channel { let mut flags = AMQPFlags::default(); flags.add_flag("active".to_string(), method.active); input = gen_id(20)(input)?; - input = gen_flags(&flags)(input)?; Ok(input) } } - /// flow-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct FlowOk { @@ -1312,12 +1292,10 @@ pub mod channel { let mut flags = AMQPFlags::default(); flags.add_flag("active".to_string(), method.active); input = gen_id(21)(input)?; - input = gen_flags(&flags)(input)?; Ok(input) } } - /// close (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct Close { @@ -1373,7 +1351,6 @@ pub mod channel { Ok(input) } } - /// close-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct CloseOk {} @@ -1405,7 +1382,6 @@ pub mod channel { } } } - /// access (generated) pub mod access { use super::*; @@ -1457,7 +1433,6 @@ pub mod access { pub struct Request { /// realm (Generated) pub realm: ShortString, - /// exclusive (Generated) pub exclusive: Boolean, /// passive (Generated) @@ -1485,13 +1460,11 @@ pub mod access { /// Parse request (Generated) pub fn parse_request<I: ParsableInput>(i: I) -> ParserResult<I, Request> { let (i, realm) = parse_short_string(i)?; - let (i, flags) = parse_flags(i, &["exclusive", "passive", "active", "write", "read"])?; Ok(( i, Request { realm, - exclusive: flags.get_flag("exclusive").unwrap_or(false), passive: flags.get_flag("passive").unwrap_or(false), active: flags.get_flag("active").unwrap_or(false), @@ -1514,12 +1487,10 @@ pub mod access { flags.add_flag("read".to_string(), method.read); input = gen_id(10)(input)?; input = gen_short_string(method.realm.as_str())(input)?; - input = gen_flags(&flags)(input)?; Ok(input) } } - /// request-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct RequestOk {} @@ -1553,7 +1524,6 @@ pub mod access { } } } - /// exchange (generated) pub mod exchange { use super::*; @@ -1648,7 +1618,6 @@ pub mod exchange { pub exchange: ShortString, /// type (Generated) pub kind: ShortString, - /// passive (Generated) pub passive: Boolean, /// durable (Generated) @@ -1680,7 +1649,6 @@ pub mod exchange { let (i, _) = parse_short_uint(i)?; let (i, exchange) = parse_short_string(i)?; let (i, kind) = parse_short_string(i)?; - let (i, flags) = parse_flags( i, &["passive", "durable", "auto-delete", "internal", "nowait"], @@ -1691,7 +1659,6 @@ pub mod exchange { Declare { exchange, kind, - passive: flags.get_flag("passive").unwrap_or(false), durable: flags.get_flag("durable").unwrap_or(false), auto_delete: flags.get_flag("auto_delete").unwrap_or(false), @@ -1717,13 +1684,11 @@ pub mod exchange { input = gen_short_uint(0)(input)?; input = gen_short_string(method.exchange.as_str())(input)?; input = gen_short_string(method.kind.as_str())(input)?; - input = gen_flags(&flags)(input)?; input = gen_field_table(&method.arguments)(input)?; Ok(input) } } - /// declare-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct DeclareOk {} @@ -1754,13 +1719,11 @@ pub mod exchange { Ok(input) } } - /// delete (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct Delete { /// exchange (Generated) pub exchange: ShortString, - /// if-unused (Generated) pub if_unused: Boolean, /// nowait (Generated) @@ -1783,13 +1746,11 @@ pub mod exchange { pub fn parse_delete<I: ParsableInput>(i: I) -> ParserResult<I, Delete> { let (i, _) = parse_short_uint(i)?; let (i, exchange) = parse_short_string(i)?; - let (i, flags) = parse_flags(i, &["if-unused", "nowait"])?; Ok(( i, Delete { exchange, - if_unused: flags.get_flag("if_unused").unwrap_or(false), nowait: flags.get_flag("nowait").unwrap_or(false), }, @@ -1807,12 +1768,10 @@ pub mod exchange { input = gen_id(20)(input)?; input = gen_short_uint(0)(input)?; input = gen_short_string(method.exchange.as_str())(input)?; - input = gen_flags(&flags)(input)?; Ok(input) } } - /// delete-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct DeleteOk {} @@ -1843,7 +1802,6 @@ pub mod exchange { Ok(input) } } - /// bind (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct Bind { @@ -1853,7 +1811,6 @@ pub mod exchange { pub source: ShortString, /// routing-key (Generated) pub routing_key: ShortString, - /// nowait (Generated) pub nowait: Boolean, /// arguments (Generated) @@ -1878,7 +1835,6 @@ pub mod exchange { let (i, destination) = parse_short_string(i)?; let (i, source) = parse_short_string(i)?; let (i, routing_key) = parse_short_string(i)?; - let (i, flags) = parse_flags(i, &["nowait"])?; let (i, arguments) = parse_field_table(i)?; Ok(( @@ -1887,7 +1843,6 @@ pub mod exchange { destination, source, routing_key, - nowait: flags.get_flag("nowait").unwrap_or(false), arguments, }, @@ -1906,13 +1861,11 @@ pub mod exchange { input = gen_short_string(method.destination.as_str())(input)?; input = gen_short_string(method.source.as_str())(input)?; input = gen_short_string(method.routing_key.as_str())(input)?; - input = gen_flags(&flags)(input)?; input = gen_field_table(&method.arguments)(input)?; Ok(input) } } - /// bind-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct BindOk {} @@ -1943,7 +1896,6 @@ pub mod exchange { Ok(input) } } - /// unbind (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct Unbind { @@ -1953,7 +1905,6 @@ pub mod exchange { pub source: ShortString, /// routing-key (Generated) pub routing_key: ShortString, - /// nowait (Generated) pub nowait: Boolean, /// arguments (Generated) @@ -1978,7 +1929,6 @@ pub mod exchange { let (i, destination) = parse_short_string(i)?; let (i, source) = parse_short_string(i)?; let (i, routing_key) = parse_short_string(i)?; - let (i, flags) = parse_flags(i, &["nowait"])?; let (i, arguments) = parse_field_table(i)?; Ok(( @@ -1987,7 +1937,6 @@ pub mod exchange { destination, source, routing_key, - nowait: flags.get_flag("nowait").unwrap_or(false), arguments, }, @@ -2006,13 +1955,11 @@ pub mod exchange { input = gen_short_string(method.destination.as_str())(input)?; input = gen_short_string(method.source.as_str())(input)?; input = gen_short_string(method.routing_key.as_str())(input)?; - input = gen_flags(&flags)(input)?; input = gen_field_table(&method.arguments)(input)?; Ok(input) } } - /// unbind-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct UnbindOk {} @@ -2044,7 +1991,6 @@ pub mod exchange { } } } - /// queue (generated) pub mod queue { use super::*; @@ -2151,7 +2097,6 @@ pub mod queue { pub struct Declare { /// queue (Generated) pub queue: ShortString, - /// passive (Generated) pub passive: Boolean, /// durable (Generated) @@ -2182,7 +2127,6 @@ pub mod queue { pub fn parse_declare<I: ParsableInput>(i: I) -> ParserResult<I, Declare> { let (i, _) = parse_short_uint(i)?; let (i, queue) = parse_short_string(i)?; - let (i, flags) = parse_flags( i, &["passive", "durable", "exclusive", "auto-delete", "nowait"], @@ -2192,7 +2136,6 @@ pub mod queue { i, Declare { queue, - passive: flags.get_flag("passive").unwrap_or(false), durable: flags.get_flag("durable").unwrap_or(false), exclusive: flags.get_flag("exclusive").unwrap_or(false), @@ -2217,13 +2160,11 @@ pub mod queue { input = gen_id(10)(input)?; input = gen_short_uint(0)(input)?; input = gen_short_string(method.queue.as_str())(input)?; - input = gen_flags(&flags)(input)?; input = gen_field_table(&method.arguments)(input)?; Ok(input) } } - /// declare-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct DeclareOk { @@ -2274,7 +2215,6 @@ pub mod queue { Ok(input) } } - /// bind (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct Bind { @@ -2284,7 +2224,6 @@ pub mod queue { pub exchange: ShortString, /// routing-key (Generated) pub routing_key: ShortString, - /// nowait (Generated) pub nowait: Boolean, /// arguments (Generated) @@ -2309,7 +2248,6 @@ pub mod queue { let (i, queue) = parse_short_string(i)?; let (i, exchange) = parse_short_string(i)?; let (i, routing_key) = parse_short_string(i)?; - let (i, flags) = parse_flags(i, &["nowait"])?; let (i, arguments) = parse_field_table(i)?; Ok(( @@ -2318,7 +2256,6 @@ pub mod queue { queue, exchange, routing_key, - nowait: flags.get_flag("nowait").unwrap_or(false), arguments, }, @@ -2337,13 +2274,11 @@ pub mod queue { input = gen_short_string(method.queue.as_str())(input)?; input = gen_short_string(method.exchange.as_str())(input)?; input = gen_short_string(method.routing_key.as_str())(input)?; - input = gen_flags(&flags)(input)?; input = gen_field_table(&method.arguments)(input)?; Ok(input) } } - /// bind-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct BindOk {} @@ -2374,13 +2309,11 @@ pub mod queue { Ok(input) } } - /// purge (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct Purge { /// queue (Generated) pub queue: ShortString, - /// nowait (Generated) pub nowait: Boolean, } @@ -2401,13 +2334,11 @@ pub mod queue { pub fn parse_purge<I: ParsableInput>(i: I) -> ParserResult<I, Purge> { let (i, _) = parse_short_uint(i)?; let (i, queue) = parse_short_string(i)?; - let (i, flags) = parse_flags(i, &["nowait"])?; Ok(( i, Purge { queue, - nowait: flags.get_flag("nowait").unwrap_or(false), }, )) @@ -2423,12 +2354,10 @@ pub mod queue { input = gen_id(30)(input)?; input = gen_short_uint(0)(input)?; input = gen_short_string(method.queue.as_str())(input)?; - input = gen_flags(&flags)(input)?; Ok(input) } } - /// purge-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct PurgeOk { @@ -2464,13 +2393,11 @@ pub mod queue { Ok(input) } } - /// delete (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct Delete { /// queue (Generated) pub queue: ShortString, - /// if-unused (Generated) pub if_unused: Boolean, /// if-empty (Generated) @@ -2495,13 +2422,11 @@ pub mod queue { pub fn parse_delete<I: ParsableInput>(i: I) -> ParserResult<I, Delete> { let (i, _) = parse_short_uint(i)?; let (i, queue) = parse_short_string(i)?; - let (i, flags) = parse_flags(i, &["if-unused", "if-empty", "nowait"])?; Ok(( i, Delete { queue, - if_unused: flags.get_flag("if_unused").unwrap_or(false), if_empty: flags.get_flag("if_empty").unwrap_or(false), nowait: flags.get_flag("nowait").unwrap_or(false), @@ -2521,12 +2446,10 @@ pub mod queue { input = gen_id(40)(input)?; input = gen_short_uint(0)(input)?; input = gen_short_string(method.queue.as_str())(input)?; - input = gen_flags(&flags)(input)?; Ok(input) } } - /// delete-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct DeleteOk { @@ -2562,7 +2485,6 @@ pub mod queue { Ok(input) } } - /// unbind (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct Unbind { @@ -2620,7 +2542,6 @@ pub mod queue { Ok(input) } } - /// unbind-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct UnbindOk {} @@ -2652,7 +2573,6 @@ pub mod queue { } } } - /// basic (generated) pub mod basic { use super::*; @@ -2806,7 +2726,6 @@ pub mod basic { pub struct Qos { /// prefetch-count (Generated) pub prefetch_count: ShortUInt, - /// global (Generated) pub global: Boolean, } @@ -2827,13 +2746,11 @@ pub mod basic { pub fn parse_qos<I: ParsableInput>(i: I) -> ParserResult<I, Qos> { let (i, _) = parse_long_uint(i)?; let (i, prefetch_count) = parse_short_uint(i)?; - let (i, flags) = parse_flags(i, &["global"])?; Ok(( i, Qos { prefetch_count, - global: flags.get_flag("global").unwrap_or(false), }, )) @@ -2849,12 +2766,10 @@ pub mod basic { input = gen_id(10)(input)?; input = gen_long_uint(0)(input)?; input = gen_short_uint(method.prefetch_count)(input)?; - input = gen_flags(&flags)(input)?; Ok(input) } } - /// qos-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct QosOk {} @@ -2885,7 +2800,6 @@ pub mod basic { Ok(input) } } - /// consume (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct Consume { @@ -2893,7 +2807,6 @@ pub mod basic { pub queue: ShortString, /// consumer-tag (Generated) pub consumer_tag: ShortString, - /// no-local (Generated) pub no_local: Boolean, /// no-ack (Generated) @@ -2923,7 +2836,6 @@ pub mod basic { let (i, _) = parse_short_uint(i)?; let (i, queue) = parse_short_string(i)?; let (i, consumer_tag) = parse_short_string(i)?; - let (i, flags) = parse_flags(i, &["no-local", "no-ack", "exclusive", "nowait"])?; let (i, arguments) = parse_field_table(i)?; Ok(( @@ -2931,7 +2843,6 @@ pub mod basic { Consume { queue, consumer_tag, - no_local: flags.get_flag("no_local").unwrap_or(false), no_ack: flags.get_flag("no_ack").unwrap_or(false), exclusive: flags.get_flag("exclusive").unwrap_or(false), @@ -2955,13 +2866,11 @@ pub mod basic { input = gen_short_uint(0)(input)?; input = gen_short_string(method.queue.as_str())(input)?; input = gen_short_string(method.consumer_tag.as_str())(input)?; - input = gen_flags(&flags)(input)?; input = gen_field_table(&method.arguments)(input)?; Ok(input) } } - /// consume-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct ConsumeOk { @@ -2997,13 +2906,11 @@ pub mod basic { Ok(input) } } - /// cancel (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct Cancel { /// consumer-tag (Generated) pub consumer_tag: ShortString, - /// nowait (Generated) pub nowait: Boolean, } @@ -3023,13 +2930,11 @@ pub mod basic { /// Parse cancel (Generated) pub fn parse_cancel<I: ParsableInput>(i: I) -> ParserResult<I, Cancel> { let (i, consumer_tag) = parse_short_string(i)?; - let (i, flags) = parse_flags(i, &["nowait"])?; Ok(( i, Cancel { consumer_tag, - nowait: flags.get_flag("nowait").unwrap_or(false), }, )) @@ -3044,12 +2949,10 @@ pub mod basic { flags.add_flag("nowait".to_string(), method.nowait); input = gen_id(30)(input)?; input = gen_short_string(method.consumer_tag.as_str())(input)?; - input = gen_flags(&flags)(input)?; Ok(input) } } - /// cancel-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct CancelOk { @@ -3085,7 +2988,6 @@ pub mod basic { Ok(input) } } - /// publish (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct Publish { @@ -3093,7 +2995,6 @@ pub mod basic { pub exchange: ShortString, /// routing-key (Generated) pub routing_key: ShortString, - /// mandatory (Generated) pub mandatory: Boolean, /// immediate (Generated) @@ -3117,14 +3018,12 @@ pub mod basic { let (i, _) = parse_short_uint(i)?; let (i, exchange) = parse_short_string(i)?; let (i, routing_key) = parse_short_string(i)?; - let (i, flags) = parse_flags(i, &["mandatory", "immediate"])?; Ok(( i, Publish { exchange, routing_key, - mandatory: flags.get_flag("mandatory").unwrap_or(false), immediate: flags.get_flag("immediate").unwrap_or(false), }, @@ -3143,12 +3042,10 @@ pub mod basic { input = gen_short_uint(0)(input)?; input = gen_short_string(method.exchange.as_str())(input)?; input = gen_short_string(method.routing_key.as_str())(input)?; - input = gen_flags(&flags)(input)?; Ok(input) } } - /// return (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct Return { @@ -3204,7 +3101,6 @@ pub mod basic { Ok(input) } } - /// deliver (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct Deliver { @@ -3212,7 +3108,6 @@ pub mod basic { pub consumer_tag: ShortString, /// delivery-tag (Generated) pub delivery_tag: LongLongUInt, - /// redelivered (Generated) pub redelivered: Boolean, /// exchange (Generated) @@ -3237,7 +3132,6 @@ pub mod basic { pub fn parse_deliver<I: ParsableInput>(i: I) -> ParserResult<I, Deliver> { let (i, consumer_tag) = parse_short_string(i)?; let (i, delivery_tag) = parse_long_long_uint(i)?; - let (i, flags) = parse_flags(i, &["redelivered"])?; let (i, exchange) = parse_short_string(i)?; let (i, routing_key) = parse_short_string(i)?; @@ -3246,7 +3140,6 @@ pub mod basic { Deliver { consumer_tag, delivery_tag, - redelivered: flags.get_flag("redelivered").unwrap_or(false), exchange, routing_key, @@ -3264,20 +3157,17 @@ pub mod basic { input = gen_id(60)(input)?; input = gen_short_string(method.consumer_tag.as_str())(input)?; input = gen_long_long_uint(method.delivery_tag)(input)?; - input = gen_flags(&flags)(input)?; input = gen_short_string(method.exchange.as_str())(input)?; input = gen_short_string(method.routing_key.as_str())(input)?; Ok(input) } } - /// get (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct Get { /// queue (Generated) pub queue: ShortString, - /// no-ack (Generated) pub no_ack: Boolean, } @@ -3298,13 +3188,11 @@ pub mod basic { pub fn parse_get<I: ParsableInput>(i: I) -> ParserResult<I, Get> { let (i, _) = parse_short_uint(i)?; let (i, queue) = parse_short_string(i)?; - let (i, flags) = parse_flags(i, &["no-ack"])?; Ok(( i, Get { queue, - no_ack: flags.get_flag("no_ack").unwrap_or(false), }, )) @@ -3320,18 +3208,15 @@ pub mod basic { input = gen_id(70)(input)?; input = gen_short_uint(0)(input)?; input = gen_short_string(method.queue.as_str())(input)?; - input = gen_flags(&flags)(input)?; Ok(input) } } - /// get-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct GetOk { /// delivery-tag (Generated) pub delivery_tag: LongLongUInt, - /// redelivered (Generated) pub redelivered: Boolean, /// exchange (Generated) @@ -3357,7 +3242,6 @@ pub mod basic { /// Parse get-ok (Generated) pub fn parse_get_ok<I: ParsableInput>(i: I) -> ParserResult<I, GetOk> { let (i, delivery_tag) = parse_long_long_uint(i)?; - let (i, flags) = parse_flags(i, &["redelivered"])?; let (i, exchange) = parse_short_string(i)?; let (i, routing_key) = parse_short_string(i)?; @@ -3366,7 +3250,6 @@ pub mod basic { i, GetOk { delivery_tag, - redelivered: flags.get_flag("redelivered").unwrap_or(false), exchange, routing_key, @@ -3384,7 +3267,6 @@ pub mod basic { flags.add_flag("redelivered".to_string(), method.redelivered); input = gen_id(71)(input)?; input = gen_long_long_uint(method.delivery_tag)(input)?; - input = gen_flags(&flags)(input)?; input = gen_short_string(method.exchange.as_str())(input)?; input = gen_short_string(method.routing_key.as_str())(input)?; @@ -3392,7 +3274,6 @@ pub mod basic { Ok(input) } } - /// get-empty (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct GetEmpty {} @@ -3425,13 +3306,11 @@ pub mod basic { Ok(input) } } - /// ack (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct Ack { /// delivery-tag (Generated) pub delivery_tag: LongLongUInt, - /// multiple (Generated) pub multiple: Boolean, } @@ -3451,13 +3330,11 @@ pub mod basic { /// Parse ack (Generated) pub fn parse_ack<I: ParsableInput>(i: I) -> ParserResult<I, Ack> { let (i, delivery_tag) = parse_long_long_uint(i)?; - let (i, flags) = parse_flags(i, &["multiple"])?; Ok(( i, Ack { delivery_tag, - multiple: flags.get_flag("multiple").unwrap_or(false), }, )) @@ -3472,18 +3349,15 @@ pub mod basic { flags.add_flag("multiple".to_string(), method.multiple); input = gen_id(80)(input)?; input = gen_long_long_uint(method.delivery_tag)(input)?; - input = gen_flags(&flags)(input)?; Ok(input) } } - /// reject (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct Reject { /// delivery-tag (Generated) pub delivery_tag: LongLongUInt, - /// requeue (Generated) pub requeue: Boolean, } @@ -3503,13 +3377,11 @@ pub mod basic { /// Parse reject (Generated) pub fn parse_reject<I: ParsableInput>(i: I) -> ParserResult<I, Reject> { let (i, delivery_tag) = parse_long_long_uint(i)?; - let (i, flags) = parse_flags(i, &["requeue"])?; Ok(( i, Reject { delivery_tag, - requeue: flags.get_flag("requeue").unwrap_or(false), }, )) @@ -3524,12 +3396,10 @@ pub mod basic { flags.add_flag("requeue".to_string(), method.requeue); input = gen_id(90)(input)?; input = gen_long_long_uint(method.delivery_tag)(input)?; - input = gen_flags(&flags)(input)?; Ok(input) } } - /// recover-async (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct RecoverAsync { @@ -3568,12 +3438,10 @@ pub mod basic { let mut flags = AMQPFlags::default(); flags.add_flag("requeue".to_string(), method.requeue); input = gen_id(100)(input)?; - input = gen_flags(&flags)(input)?; Ok(input) } } - /// recover (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct Recover { @@ -3612,12 +3480,10 @@ pub mod basic { let mut flags = AMQPFlags::default(); flags.add_flag("requeue".to_string(), method.requeue); input = gen_id(110)(input)?; - input = gen_flags(&flags)(input)?; Ok(input) } } - /// recover-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct RecoverOk {} @@ -3648,13 +3514,11 @@ pub mod basic { Ok(input) } } - /// nack (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct Nack { /// delivery-tag (Generated) pub delivery_tag: LongLongUInt, - /// multiple (Generated) pub multiple: Boolean, /// requeue (Generated) @@ -3676,13 +3540,11 @@ pub mod basic { /// Parse nack (Generated) pub fn parse_nack<I: ParsableInput>(i: I) -> ParserResult<I, Nack> { let (i, delivery_tag) = parse_long_long_uint(i)?; - let (i, flags) = parse_flags(i, &["multiple", "requeue"])?; Ok(( i, Nack { delivery_tag, - multiple: flags.get_flag("multiple").unwrap_or(false), requeue: flags.get_flag("requeue").unwrap_or(false), }, @@ -3699,7 +3561,6 @@ pub mod basic { flags.add_flag("requeue".to_string(), method.requeue); input = gen_id(120)(input)?; input = gen_long_long_uint(method.delivery_tag)(input)?; - input = gen_flags(&flags)(input)?; Ok(input) } @@ -4080,7 +3941,6 @@ pub mod basic { }) } } - /// tx (generated) pub mod tx { use super::*; @@ -4185,7 +4045,6 @@ pub mod tx { Ok(input) } } - /// select-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct SelectOk {} @@ -4216,7 +4075,6 @@ pub mod tx { Ok(input) } } - /// commit (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct Commit {} @@ -4247,7 +4105,6 @@ pub mod tx { Ok(input) } } - /// commit-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct CommitOk {} @@ -4278,7 +4135,6 @@ pub mod tx { Ok(input) } } - /// rollback (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct Rollback {} @@ -4309,7 +4165,6 @@ pub mod tx { Ok(input) } } - /// rollback-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct RollbackOk {} @@ -4341,7 +4196,6 @@ pub mod tx { } } } - /// confirm (generated) pub mod confirm { use super::*; @@ -4426,12 +4280,10 @@ pub mod confirm { let mut flags = AMQPFlags::default(); flags.add_flag("nowait".to_string(), method.nowait); input = gen_id(10)(input)?; - input = gen_flags(&flags)(input)?; Ok(input) } } - /// select-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] pub struct SelectOk {} From 790c92bacc8ba789e6282227e26be692e16218a0 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Fri, 26 Mar 2021 17:08:49 +0100 Subject: [PATCH 063/133] convert LongString to Vec<u8> It can contain non-utf8 data Fixes #28 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/src/templating.rs | 25 ++++++++++++++++++++++++- protocol/src/generated.rs | 14 +++++++------- protocol/templates/protocol.rs | 2 +- types/src/generation.rs | 10 +++++----- types/src/types.rs | 29 +++++++++++------------------ 5 files changed, 48 insertions(+), 32 deletions(-) diff --git a/codegen/src/templating.rs b/codegen/src/templating.rs index f1b02eae..2b287f84 100644 --- a/codegen/src/templating.rs +++ b/codegen/src/templating.rs @@ -55,6 +55,7 @@ impl<'a> HandlebarsAMQPExtension for CodeGenerator<'a> { self.register_helper("include_more", Box::new(IncludeMoreHelper)); self.register_helper("pass_by_ref", Box::new(PassByRefHelper)); self.register_helper("use_str_ref", Box::new(UseStrRefHelper)); + self.register_helper("use_bytes_ref", Box::new(UseBytesRefHelper)); self.register_helper("each_argument", Box::new(EachArgumentHelper)); self.register_helper("amqp_value_ref", Box::new(AMQPValueRefHelper)); self @@ -280,6 +281,28 @@ impl HelperDef for UseStrRefHelper { } } +/// Helper to check whether a param is passed using an &[u8] or its real type +pub struct UseBytesRefHelper; +impl HelperDef for UseBytesRefHelper { + fn call_inner<'reg: 'rc, 'rc>( + &self, + h: &Helper<'reg, 'rc>, + _: &'reg Handlebars<'_>, + _: &'rc Context, + _: &mut RenderContext<'reg, 'rc>, + ) -> Result<Option<ScopedJson<'reg, 'rc>>, RenderError> { + let value = h + .param(0) + .ok_or_else(|| RenderError::new("Param not found for helper \"use_bytes_ref\""))?; + let param = serde_json::from_value::<AMQPType>(value.value().clone()).ok(); + let use_bytes_ref = matches!( + param, + Some(AMQPType::LongString) + ); + Ok(Some(ScopedJson::Derived(JsonValue::from(use_bytes_ref)))) + } +} + /// Helper to walk through a Vec of [AMQPArgument](../specs.AMQPArgument.html). pub struct EachArgumentHelper; impl HelperDef for EachArgumentHelper { @@ -371,7 +394,7 @@ impl HelperDef for AMQPValueRefHelper { AMQPValue::Double(v) => serde_json::to_value(v)?, AMQPValue::DecimalValue(v) => serde_json::to_value(v)?, AMQPValue::ShortString(v) => serde_json::to_value(format!("\"{}\"", v))?, - AMQPValue::LongString(v) => serde_json::to_value(format!("\"{}\"", v))?, + AMQPValue::LongString(v) => serde_json::to_value(format!("b\"{}\"", v))?, AMQPValue::FieldArray(v) => serde_json::to_value(v)?, AMQPValue::Timestamp(v) => serde_json::to_value(v)?, AMQPValue::FieldTable(v) => serde_json::to_value(v)?, diff --git a/protocol/src/generated.rs b/protocol/src/generated.rs index 57a4fd37..c44e1e22 100644 --- a/protocol/src/generated.rs +++ b/protocol/src/generated.rs @@ -553,8 +553,8 @@ pub mod connection { input = gen_short_short_uint(method.version_major)(input)?; input = gen_short_short_uint(method.version_minor)(input)?; input = gen_field_table(&method.server_properties)(input)?; - input = gen_long_string(method.mechanisms.as_str())(input)?; - input = gen_long_string(method.locales.as_str())(input)?; + input = gen_long_string(method.mechanisms.as_bytes())(input)?; + input = gen_long_string(method.locales.as_bytes())(input)?; Ok(input) } } @@ -608,7 +608,7 @@ pub mod connection { input = gen_id(11)(input)?; input = gen_field_table(&method.client_properties)(input)?; input = gen_short_string(method.mechanism.as_str())(input)?; - input = gen_long_string(method.response.as_str())(input)?; + input = gen_long_string(method.response.as_bytes())(input)?; input = gen_short_string(method.locale.as_str())(input)?; Ok(input) } @@ -644,7 +644,7 @@ pub mod connection { ) -> impl SerializeFn<W> + 'a { move |mut input| { input = gen_id(20)(input)?; - input = gen_long_string(method.challenge.as_str())(input)?; + input = gen_long_string(method.challenge.as_bytes())(input)?; Ok(input) } } @@ -679,7 +679,7 @@ pub mod connection { ) -> impl SerializeFn<W> + 'a { move |mut input| { input = gen_id(21)(input)?; - input = gen_long_string(method.response.as_str())(input)?; + input = gen_long_string(method.response.as_bytes())(input)?; Ok(input) } } @@ -1040,7 +1040,7 @@ pub mod connection { ) -> impl SerializeFn<W> + 'a { move |mut input| { input = gen_id(70)(input)?; - input = gen_long_string(method.new_secret.as_str())(input)?; + input = gen_long_string(method.new_secret.as_bytes())(input)?; input = gen_short_string(method.reason.as_str())(input)?; Ok(input) } @@ -1208,7 +1208,7 @@ pub mod channel { ) -> impl SerializeFn<W> + 'a { move |mut input| { input = gen_id(11)(input)?; - input = gen_long_string("")(input)?; + input = gen_long_string(b"")(input)?; Ok(input) } } diff --git a/protocol/templates/protocol.rs b/protocol/templates/protocol.rs index 29213cfa..58ea77b1 100644 --- a/protocol/templates/protocol.rs +++ b/protocol/templates/protocol.rs @@ -281,7 +281,7 @@ pub mod {{snake class.name}} { {{#if @argument_is_value ~}} {{#if argument.force_default ~}} {{/if ~}} - input = gen_{{snake_type argument.type}}({{#if (and (pass_by_ref argument.type) (not (use_str_ref argument.type))) ~}}&{{/if ~}}{{#if argument.force_default ~}}{{amqp_value_ref argument.default_value}}{{else}}method.{{snake argument.name}}{{#if (use_str_ref argument.type) ~}}.as_str(){{/if ~}}{{/if ~}})(input)?; + input = gen_{{snake_type argument.type}}({{#if (and (pass_by_ref argument.type) (not (use_str_ref argument.type))) ~}}&{{/if ~}}{{#if argument.force_default ~}}{{amqp_value_ref argument.default_value}}{{else}}method.{{snake argument.name}}{{#if (use_str_ref argument.type) ~}}{{#if (use_bytes_ref argument.type) ~}}.as_bytes(){{else}}.as_str(){{/if ~}}{{/if ~}}{{/if ~}})(input)?; {{else}} input = gen_flags(&flags)(input)?; {{/if ~}} diff --git a/types/src/generation.rs b/types/src/generation.rs index a69a5754..6465c6b1 100644 --- a/types/src/generation.rs +++ b/types/src/generation.rs @@ -41,7 +41,7 @@ pub fn gen_raw_value<'a, W: Write + BackToTheBuffer + 'a>( AMQPValue::Double(d) => gen_double(d)(x), AMQPValue::DecimalValue(d) => gen_decimal_value(d)(x), AMQPValue::ShortString(ref s) => gen_short_string(s.as_str())(x), - AMQPValue::LongString(ref s) => gen_long_string(s.as_str())(x), + AMQPValue::LongString(ref s) => gen_long_string(s.as_bytes())(x), AMQPValue::FieldArray(ref a) => gen_field_array(a)(x), AMQPValue::Timestamp(t) => gen_timestamp(t)(x), AMQPValue::FieldTable(ref t) => gen_field_table(t)(x), @@ -136,8 +136,8 @@ pub fn gen_short_string<'a, W: Write + 'a>(s: &'a str) -> impl SerializeFn<W> + } /// Generate the [LongString](../type.LongString.html) in the given buffer (x) -pub fn gen_long_string<'a, W: Write + 'a>(s: &'a str) -> impl SerializeFn<W> + 'a { - pair(gen_long_uint(s.len() as LongUInt), slice(s.as_bytes())) +pub fn gen_long_string<'a, W: Write + 'a>(s: &'a [u8]) -> impl SerializeFn<W> + 'a { + pair(gen_long_uint(s.len() as LongUInt), slice(s)) } /// Generate the [FieldArray](../type.FieldArray.html) in the given buffer (x) @@ -416,11 +416,11 @@ mod test { #[test] fn test_gen_long_string() { assert_eq!( - test_gen!(&mut [0, 0, 0, 0][..], gen_long_string, ""), + test_gen!(&mut [0, 0, 0, 0][..], gen_long_string, &[]), Ok((vec![0, 0, 0, 0], 4)) ); assert_eq!( - test_gen!(&mut [0, 0, 0, 0, 0, 0, 0, 0][..], gen_long_string, "test"), + test_gen!(&mut [0, 0, 0, 0, 0, 0, 0, 0][..], gen_long_string, b"test"), Ok((vec![0, 0, 0, 4, 116, 101, 115, 116], 8)) ); } diff --git a/types/src/types.rs b/types/src/types.rs index 0b08ed2a..6d8cdc8e 100644 --- a/types/src/types.rs +++ b/types/src/types.rs @@ -151,7 +151,7 @@ pub type Void = (); pub struct ShortString(String); /// A String #[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash, Deserialize, Serialize)] -pub struct LongString(String); +pub struct LongString(Vec<u8>); /// An array of AMQPValue #[derive(Clone, Debug, Default, PartialEq, Deserialize, Serialize)] pub struct FieldArray(Vec<AMQPValue>); @@ -172,7 +172,7 @@ pub struct DecimalValue { } impl<'a> ShortString { - /// Get a reference to a LongString as &str + /// Get a reference to a ShortString as &str pub fn as_str(&'a self) -> &'a str { self.0.as_str() } @@ -208,20 +208,15 @@ impl fmt::Display for ShortString { } impl<'a> LongString { - /// Get a reference to a LongString as &str - pub fn as_str(&'a self) -> &'a str { - self.0.as_str() - } - - /// Splits a string slice by whitespace. - pub fn split_whitespace(&'a self) -> str::SplitWhitespace<'a> { - self.0.split_whitespace() + /// Get a reference to a LongString as &[u8] + pub fn as_bytes(&'a self) -> &'a [u8] { + &self.0[..] } } impl From<String> for LongString { fn from(s: String) -> Self { - Self(s) + Self(s.into_bytes()) } } @@ -231,15 +226,13 @@ impl From<&str> for LongString { } } -impl borrow::Borrow<str> for LongString { - fn borrow(&self) -> &str { - self.0.borrow() - } -} - impl fmt::Display for LongString { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - self.0.fmt(f) + if let Ok(s) = String::from_utf8(self.0.clone()) { + s.fmt(f) + } else { + f.write_fmt(format_args!("{:?}", self.0)) + } } } From 8ca2d0d37c97d184cb85181b5ad02d49624db042 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Teo=20Klestrup=20R=C3=B6ijezon?= <teo@nullable.se> Date: Fri, 26 Mar 2021 17:12:28 +0100 Subject: [PATCH 064/133] Allow lossy UTF-8 parsing of LongString values According to the spec `LongString` may contain arbitrary octet streams. Ideally, `Vec<u8>` would be the correct representation, but that requires a compatibility break (so is appropriate for 7.x, but not an option for 6.x). Workaround for #28 --- types/src/parsing.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/types/src/parsing.rs b/types/src/parsing.rs index 2bd7ac67..395a513a 100644 --- a/types/src/parsing.rs +++ b/types/src/parsing.rs @@ -205,6 +205,10 @@ fn make_str<I: nom::InputIter<Item = u8>>(i: I) -> Result<String, std::string::F String::from_utf8(i.iter_elements().collect()) } +fn make_str_lossy<I: nom::InputIter<Item = u8>>(i: I) -> String { + String::from_utf8_lossy(&i.iter_elements().collect::<Vec<_>>()).into_owned() +} + /// Parse a [ShortString](../type.ShortString.html) pub fn parse_short_string<I: ParsableInput>(i: I) -> ParserResult<I, ShortString> { context( @@ -221,7 +225,7 @@ pub fn parse_long_string<I: ParsableInput>(i: I) -> ParserResult<I, LongString> context( "parse_long_string", map( - map_res(flat_map(parse_long_uint, take), make_str), + map(flat_map(parse_long_uint, take), make_str_lossy), LongString::from, ), )(i) From b0ad679fea4a282778b45d8416b09b61de68831a Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Fri, 26 Mar 2021 17:36:24 +0100 Subject: [PATCH 065/133] v6.0.3 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/Cargo.toml | 4 ++-- codegen/src/lib.rs | 2 +- protocol/Cargo.toml | 10 +++++----- protocol/src/lib.rs | 2 +- tcp/Cargo.toml | 4 ++-- tcp/src/lib.rs | 2 +- types/Cargo.toml | 2 +- types/src/lib.rs | 2 +- uri/Cargo.toml | 2 +- uri/src/lib.rs | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 6f8ff4eb..0fec6ab1 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "6.0.2" # remember to update html_root_url +version = "6.0.3" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" @@ -18,7 +18,7 @@ handlebars = "^3.0" serde_json = "^1.0" [dependencies.amq-protocol-types] -version = "^6.0.2" +version = "^6.0.3" path = "../types" [dependencies.serde] diff --git a/codegen/src/lib.rs b/codegen/src/lib.rs index b981dd31..0b48a53d 100644 --- a/codegen/src/lib.rs +++ b/codegen/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/6.0.2/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/6.0.3/")] //! # AMQP code generation utilities //! diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index 573bc076..47fb3a0e 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "6.0.2" # remember to update html_root_url +version = "6.0.3" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" @@ -27,21 +27,21 @@ vendored-openssl = ["amq-protocol-tcp/vendored-openssl"] verbose-errors = ["amq-protocol-types/verbose-errors"] [build-dependencies.amq-protocol-codegen] -version = "^6.0.2" +version = "^6.0.3" path = "../codegen" optional = true [dependencies.amq-protocol-tcp] -version = "^6.0.2" +version = "^6.0.3" default-features = false path = "../tcp" [dependencies.amq-protocol-types] -version = "^6.0.2" +version = "^6.0.3" path = "../types" [dependencies.amq-protocol-uri] -version = "^6.0.2" +version = "^6.0.3" path = "../uri" [dependencies.cookie-factory] diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs index 2f904e2b..9e597fcc 100644 --- a/protocol/src/lib.rs +++ b/protocol/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol/6.0.2/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol/6.0.3/")] //! # AMQP manipulation library //! diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index 11262171..4d0d2602 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "6.0.2" # remember to update html_root_url +version = "6.0.3" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" @@ -24,7 +24,7 @@ rustls-connector = ["tcp-stream/rustls-connector"] vendored-openssl = ["tcp-stream/vendored-openssl"] [dependencies.amq-protocol-uri] -version = "^6.0.2" +version = "^6.0.3" path = "../uri" [dependencies.tcp-stream] diff --git a/tcp/src/lib.rs b/tcp/src/lib.rs index 679baed8..57da2095 100644 --- a/tcp/src/lib.rs +++ b/tcp/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/6.0.2/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/6.0.3/")] //! # AMQP URI TCP connection handling //! diff --git a/types/Cargo.toml b/types/Cargo.toml index 33067c46..74763785 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "6.0.2" # remember to update html_root_url +version = "6.0.3" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/types/src/lib.rs b/types/src/lib.rs index d2cf19cf..af2ccb1d 100644 --- a/types/src/lib.rs +++ b/types/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-types/6.0.2/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-types/6.0.3/")] //! # AMQP types manipulation library //! diff --git a/uri/Cargo.toml b/uri/Cargo.toml index 851d9401..230c3ab4 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "6.0.2" # remember to update html_root_url +version = "6.0.3" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" diff --git a/uri/src/lib.rs b/uri/src/lib.rs index 3f08fd02..cf028788 100644 --- a/uri/src/lib.rs +++ b/uri/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/6.0.2/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/6.0.3/")] //! # AMQP URI manipulation library //! From 694aabe551d806261b1ff311c993e60c334ebcd2 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Fri, 26 Mar 2021 17:47:40 +0100 Subject: [PATCH 066/133] fmt Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/src/templating.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/codegen/src/templating.rs b/codegen/src/templating.rs index 2b287f84..d0658af4 100644 --- a/codegen/src/templating.rs +++ b/codegen/src/templating.rs @@ -295,10 +295,7 @@ impl HelperDef for UseBytesRefHelper { .param(0) .ok_or_else(|| RenderError::new("Param not found for helper \"use_bytes_ref\""))?; let param = serde_json::from_value::<AMQPType>(value.value().clone()).ok(); - let use_bytes_ref = matches!( - param, - Some(AMQPType::LongString) - ); + let use_bytes_ref = matches!(param, Some(AMQPType::LongString)); Ok(Some(ScopedJson::Derived(JsonValue::from(use_bytes_ref)))) } } From a4cb6353d2925f0d74faf745c8100be9a58be2ea Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Fri, 26 Mar 2021 17:49:25 +0100 Subject: [PATCH 067/133] v7.0.0-alpha.7 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/Cargo.toml | 4 ++-- codegen/src/lib.rs | 2 +- protocol/Cargo.toml | 10 +++++----- protocol/src/lib.rs | 2 +- tcp/Cargo.toml | 4 ++-- tcp/src/lib.rs | 2 +- types/Cargo.toml | 2 +- types/src/lib.rs | 2 +- uri/Cargo.toml | 4 ++-- uri/src/lib.rs | 2 +- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 841828f8..ea6f3846 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "7.0.0-alpha.6" # remember to update html_root_url +version = "7.0.0-alpha.7" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" @@ -18,7 +18,7 @@ handlebars = "^4.0.0-beta" serde_json = "^1.0" [dependencies.amq-protocol-types] -version = "=7.0.0-alpha.6" +version = "=7.0.0-alpha.7" path = "../types" [dependencies.serde] diff --git a/codegen/src/lib.rs b/codegen/src/lib.rs index a6e30bc3..7089295a 100644 --- a/codegen/src/lib.rs +++ b/codegen/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/7.0.0-alpha.6/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/7.0.0-alpha.7/")] //! # AMQP code generation utilities //! diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index cc122e5b..65aba67e 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "7.0.0-alpha.6" # remember to update html_root_url +version = "7.0.0-alpha.7" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" @@ -27,21 +27,21 @@ vendored-openssl = ["amq-protocol-tcp/vendored-openssl"] verbose-errors = ["amq-protocol-types/verbose-errors"] [build-dependencies.amq-protocol-codegen] -version = "=7.0.0-alpha.6" +version = "=7.0.0-alpha.7" path = "../codegen" optional = true [dependencies.amq-protocol-tcp] -version = "=7.0.0-alpha.6" +version = "=7.0.0-alpha.7" default-features = false path = "../tcp" [dependencies.amq-protocol-types] -version = "=7.0.0-alpha.6" +version = "=7.0.0-alpha.7" path = "../types" [dependencies.amq-protocol-uri] -version = "=7.0.0-alpha.6" +version = "=7.0.0-alpha.7" path = "../uri" [dependencies.cookie-factory] diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs index 5424248c..ec1b5bb3 100644 --- a/protocol/src/lib.rs +++ b/protocol/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol/7.0.0-alpha.6/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol/7.0.0-alpha.7/")] //! # AMQP manipulation library //! diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index 5d8f4a74..b87de93b 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "7.0.0-alpha.6" # remember to update html_root_url +version = "7.0.0-alpha.7" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" @@ -24,7 +24,7 @@ rustls-connector = ["tcp-stream/rustls-connector"] vendored-openssl = ["tcp-stream/vendored-openssl"] [dependencies.amq-protocol-uri] -version = "=7.0.0-alpha.6" +version = "=7.0.0-alpha.7" path = "../uri" [dependencies.tcp-stream] diff --git a/tcp/src/lib.rs b/tcp/src/lib.rs index 8fb3cc20..d565d992 100644 --- a/tcp/src/lib.rs +++ b/tcp/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/7.0.0-alpha.6/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/7.0.0-alpha.7/")] //! # AMQP URI TCP connection handling //! diff --git a/types/Cargo.toml b/types/Cargo.toml index 0a028949..affb87f8 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "7.0.0-alpha.6" # remember to update html_root_url +version = "7.0.0-alpha.7" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/types/src/lib.rs b/types/src/lib.rs index 283c1a42..8e41d7fe 100644 --- a/types/src/lib.rs +++ b/types/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-types/7.0.0-alpha.6/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-types/7.0.0-alpha.7/")] //! # AMQP types manipulation library //! diff --git a/uri/Cargo.toml b/uri/Cargo.toml index 3277f7bb..85b63c1c 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "7.0.0-alpha.6" # remember to update html_root_url +version = "7.0.0-alpha.7" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" @@ -14,7 +14,7 @@ license = "BSD-2-Clause" name = "amq_protocol_uri" [dependencies.amq-protocol-types] -version = "=7.0.0-alpha.6" +version = "=7.0.0-alpha.7" path = "../types" [dependencies] diff --git a/uri/src/lib.rs b/uri/src/lib.rs index 4cf9c579..15c9d2a2 100644 --- a/uri/src/lib.rs +++ b/uri/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/7.0.0-alpha.6/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/7.0.0-alpha.7/")] //! # AMQP URI manipulation library //! From 29f83014a28291510912db14216d74188d17a424 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Fri, 26 Mar 2021 17:56:03 +0100 Subject: [PATCH 068/133] drop unused method Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- types/src/types.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/types/src/types.rs b/types/src/types.rs index 6d8cdc8e..a171817e 100644 --- a/types/src/types.rs +++ b/types/src/types.rs @@ -176,11 +176,6 @@ impl<'a> ShortString { pub fn as_str(&'a self) -> &'a str { self.0.as_str() } - - /// Splits a string slice by whitespace. - pub fn split_whitespace(&'a self) -> str::SplitWhitespace<'a> { - self.0.split_whitespace() - } } impl From<String> for ShortString { From fa78037d97616b03d42be63e6238f713a136c511 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Fri, 26 Mar 2021 18:14:21 +0100 Subject: [PATCH 069/133] better display impl for LongString Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- types/src/types.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/types/src/types.rs b/types/src/types.rs index a171817e..cd3e242f 100644 --- a/types/src/types.rs +++ b/types/src/types.rs @@ -223,11 +223,7 @@ impl From<&str> for LongString { impl fmt::Display for LongString { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - if let Ok(s) = String::from_utf8(self.0.clone()) { - s.fmt(f) - } else { - f.write_fmt(format_args!("{:?}", self.0)) - } + String::from_utf8_lossy(&self.0).fmt(f) } } From e0f20a2ef5997e65e2d9dc09ddc833b21be01192 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Wed, 26 May 2021 09:51:07 +0200 Subject: [PATCH 070/133] codegen: update to handlebars 4.0 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/Cargo.toml | 2 +- codegen/src/templating.rs | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index ea6f3846..8d0f1368 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -14,7 +14,7 @@ license = "BSD-2-Clause" name = "amq_protocol_codegen" [dependencies] -handlebars = "^4.0.0-beta" +handlebars = "^4.0" serde_json = "^1.0" [dependencies.amq-protocol-types] diff --git a/codegen/src/templating.rs b/codegen/src/templating.rs index d0658af4..bfbc5f6c 100644 --- a/codegen/src/templating.rs +++ b/codegen/src/templating.rs @@ -241,7 +241,7 @@ impl HelperDef for PassByRefHelper { _: &'reg Handlebars<'_>, _: &'rc Context, _: &mut RenderContext<'reg, 'rc>, - ) -> Result<Option<ScopedJson<'reg, 'rc>>, RenderError> { + ) -> Result<ScopedJson<'reg, 'rc>, RenderError> { let value = h .param(0) .ok_or_else(|| RenderError::new("Param not found for helper \"pass_by_ref\""))?; @@ -255,7 +255,7 @@ impl HelperDef for PassByRefHelper { | AMQPType::FieldTable | AMQPType::ByteArray ); - Ok(Some(ScopedJson::Derived(JsonValue::from(pass_by_ref)))) + Ok(ScopedJson::Derived(JsonValue::from(pass_by_ref))) } } @@ -268,7 +268,7 @@ impl HelperDef for UseStrRefHelper { _: &'reg Handlebars<'_>, _: &'rc Context, _: &mut RenderContext<'reg, 'rc>, - ) -> Result<Option<ScopedJson<'reg, 'rc>>, RenderError> { + ) -> Result<ScopedJson<'reg, 'rc>, RenderError> { let value = h .param(0) .ok_or_else(|| RenderError::new("Param not found for helper \"use_str_ref\""))?; @@ -277,7 +277,7 @@ impl HelperDef for UseStrRefHelper { param, Some(AMQPType::ShortString) | Some(AMQPType::LongString) ); - Ok(Some(ScopedJson::Derived(JsonValue::from(use_str_ref)))) + Ok(ScopedJson::Derived(JsonValue::from(use_str_ref))) } } @@ -290,13 +290,13 @@ impl HelperDef for UseBytesRefHelper { _: &'reg Handlebars<'_>, _: &'rc Context, _: &mut RenderContext<'reg, 'rc>, - ) -> Result<Option<ScopedJson<'reg, 'rc>>, RenderError> { + ) -> Result<ScopedJson<'reg, 'rc>, RenderError> { let value = h .param(0) .ok_or_else(|| RenderError::new("Param not found for helper \"use_bytes_ref\""))?; let param = serde_json::from_value::<AMQPType>(value.value().clone()).ok(); let use_bytes_ref = matches!(param, Some(AMQPType::LongString)); - Ok(Some(ScopedJson::Derived(JsonValue::from(use_bytes_ref)))) + Ok(ScopedJson::Derived(JsonValue::from(use_bytes_ref))) } } @@ -372,7 +372,7 @@ impl HelperDef for AMQPValueRefHelper { _: &'reg Handlebars<'_>, _: &'rc Context, _: &mut RenderContext<'reg, 'rc>, - ) -> Result<Option<ScopedJson<'reg, 'rc>>, RenderError> { + ) -> Result<ScopedJson<'reg, 'rc>, RenderError> { let arg = h .param(0) .ok_or_else(|| RenderError::new("First param not found for helper \"amqp_value\""))?; @@ -398,7 +398,7 @@ impl HelperDef for AMQPValueRefHelper { AMQPValue::ByteArray(v) => serde_json::to_value(v)?, AMQPValue::Void => JsonValue::Null, }; - Ok(Some(ScopedJson::Derived(value))) + Ok(ScopedJson::Derived(value)) } } From a4bf562a804e1957cd430c0cbd814d66fd04aac9 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Fri, 20 Aug 2021 19:21:03 +0200 Subject: [PATCH 071/133] codegen: silence warning Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/src/internal.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codegen/src/internal.rs b/codegen/src/internal.rs index d119224d..8c4bb896 100644 --- a/codegen/src/internal.rs +++ b/codegen/src/internal.rs @@ -482,7 +482,7 @@ impl _AMQPArgument { None => { let domain = match self.domain { Some(ref domain) => domain, - None => panic!(format!("{} has no type nor domain", self.name)), + None => panic!("{} has no type nor domain", self.name), }; *domains .get(domain) From 4411adba48b35dce6018cc99ce92f5321353d41e Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Fri, 20 Aug 2021 19:21:17 +0200 Subject: [PATCH 072/133] update to nom 7 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- protocol/Cargo.toml | 2 +- types/Cargo.toml | 2 +- types/src/parsing.rs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index 47fb3a0e..40efee0b 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -49,7 +49,7 @@ version = "^0.3" features = ["std"] [dependencies.nom] -version = "^6.0" +version = "=7.0.0-alpha3" features = ["std"] [badges] diff --git a/types/Cargo.toml b/types/Cargo.toml index 74763785..436139c6 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -24,7 +24,7 @@ version = "^0.3" features = ["std"] [dependencies.nom] -version = "^6.0" +version = "=7.0.0-alpha3" features = ["std"] [dependencies.serde] diff --git a/types/src/parsing.rs b/types/src/parsing.rs index 395a513a..c3c6425f 100644 --- a/types/src/parsing.rs +++ b/types/src/parsing.rs @@ -239,7 +239,7 @@ pub fn parse_field_array<I: ParsableInput>(i: I) -> ParserResult<I, FieldArray> flat_map(parse_long_uint, take), all_consuming(fold_many0( context("parse_field_array_entry", complete(parse_value)), - FieldArray::default(), + FieldArray::default, |mut acc, elem| { acc.push(elem); acc @@ -265,7 +265,7 @@ pub fn parse_field_table<I: ParsableInput>(i: I) -> ParserResult<I, FieldTable> "parse_field_table_entry", complete(pair(parse_short_string, parse_value)), ), - FieldTable::default(), + FieldTable::default, |mut acc, (key, value)| { acc.insert(key, value); acc From b68393ee914c7305def07a7cae78a9e45e1c045d Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Sun, 22 Aug 2021 20:31:59 +0200 Subject: [PATCH 073/133] update to released nom 7 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- protocol/Cargo.toml | 2 +- types/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index 40efee0b..f4e6fad7 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -49,7 +49,7 @@ version = "^0.3" features = ["std"] [dependencies.nom] -version = "=7.0.0-alpha3" +version = "^7.0" features = ["std"] [badges] diff --git a/types/Cargo.toml b/types/Cargo.toml index 436139c6..fe3f6f48 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -24,7 +24,7 @@ version = "^0.3" features = ["std"] [dependencies.nom] -version = "=7.0.0-alpha3" +version = "^7.0" features = ["std"] [dependencies.serde] From 64ef24f7346cf059efeee0a9f4a30f79d895896f Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Sun, 22 Aug 2021 20:33:56 +0200 Subject: [PATCH 074/133] v6.1.0 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/Cargo.toml | 4 ++-- codegen/src/lib.rs | 2 +- protocol/Cargo.toml | 10 +++++----- protocol/src/lib.rs | 2 +- tcp/Cargo.toml | 4 ++-- tcp/src/lib.rs | 2 +- types/Cargo.toml | 2 +- types/src/lib.rs | 2 +- uri/Cargo.toml | 2 +- uri/src/lib.rs | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 0fec6ab1..01c9f47f 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "6.0.3" # remember to update html_root_url +version = "6.1.0" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" @@ -18,7 +18,7 @@ handlebars = "^3.0" serde_json = "^1.0" [dependencies.amq-protocol-types] -version = "^6.0.3" +version = "^6.1.0" path = "../types" [dependencies.serde] diff --git a/codegen/src/lib.rs b/codegen/src/lib.rs index 0b48a53d..56fc33df 100644 --- a/codegen/src/lib.rs +++ b/codegen/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/6.0.3/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/6.1.0/")] //! # AMQP code generation utilities //! diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index f4e6fad7..f5c083ae 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "6.0.3" # remember to update html_root_url +version = "6.1.0" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" @@ -27,21 +27,21 @@ vendored-openssl = ["amq-protocol-tcp/vendored-openssl"] verbose-errors = ["amq-protocol-types/verbose-errors"] [build-dependencies.amq-protocol-codegen] -version = "^6.0.3" +version = "^6.1.0" path = "../codegen" optional = true [dependencies.amq-protocol-tcp] -version = "^6.0.3" +version = "^6.1.0" default-features = false path = "../tcp" [dependencies.amq-protocol-types] -version = "^6.0.3" +version = "^6.1.0" path = "../types" [dependencies.amq-protocol-uri] -version = "^6.0.3" +version = "^6.1.0" path = "../uri" [dependencies.cookie-factory] diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs index 9e597fcc..75bdcb9b 100644 --- a/protocol/src/lib.rs +++ b/protocol/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol/6.0.3/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol/6.1.0/")] //! # AMQP manipulation library //! diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index 4d0d2602..4585dd7c 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "6.0.3" # remember to update html_root_url +version = "6.1.0" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" @@ -24,7 +24,7 @@ rustls-connector = ["tcp-stream/rustls-connector"] vendored-openssl = ["tcp-stream/vendored-openssl"] [dependencies.amq-protocol-uri] -version = "^6.0.3" +version = "^6.1.0" path = "../uri" [dependencies.tcp-stream] diff --git a/tcp/src/lib.rs b/tcp/src/lib.rs index 57da2095..27f8f4af 100644 --- a/tcp/src/lib.rs +++ b/tcp/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/6.0.3/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/6.1.0/")] //! # AMQP URI TCP connection handling //! diff --git a/types/Cargo.toml b/types/Cargo.toml index fe3f6f48..daab7934 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "6.0.3" # remember to update html_root_url +version = "6.1.0" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/types/src/lib.rs b/types/src/lib.rs index af2ccb1d..643f919c 100644 --- a/types/src/lib.rs +++ b/types/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-types/6.0.3/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-types/6.1.0/")] //! # AMQP types manipulation library //! diff --git a/uri/Cargo.toml b/uri/Cargo.toml index 230c3ab4..50cbe795 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "6.0.3" # remember to update html_root_url +version = "6.1.0" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" diff --git a/uri/src/lib.rs b/uri/src/lib.rs index cf028788..c6cdb8b3 100644 --- a/uri/src/lib.rs +++ b/uri/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/6.0.3/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/6.1.0/")] //! # AMQP URI manipulation library //! From 6db656f1a86ec93577c9a7609c8337e8388fdb49 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Mon, 25 Oct 2021 13:08:00 +0200 Subject: [PATCH 075/133] v7.0.0-beta.1 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/Cargo.toml | 4 ++-- codegen/src/lib.rs | 2 +- protocol/Cargo.toml | 10 +++++----- protocol/src/lib.rs | 2 +- tcp/Cargo.toml | 4 ++-- tcp/src/lib.rs | 2 +- types/Cargo.toml | 2 +- types/src/lib.rs | 2 +- uri/Cargo.toml | 4 ++-- uri/src/lib.rs | 2 +- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 8d0f1368..930323dc 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "7.0.0-alpha.7" # remember to update html_root_url +version = "7.0.0-beta.1" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" @@ -18,7 +18,7 @@ handlebars = "^4.0" serde_json = "^1.0" [dependencies.amq-protocol-types] -version = "=7.0.0-alpha.7" +version = "=7.0.0-beta.1" path = "../types" [dependencies.serde] diff --git a/codegen/src/lib.rs b/codegen/src/lib.rs index 7089295a..55e69b77 100644 --- a/codegen/src/lib.rs +++ b/codegen/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/7.0.0-alpha.7/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/7.0.0-beta.1/")] //! # AMQP code generation utilities //! diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index a0acbc6b..c445fd52 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "7.0.0-alpha.7" # remember to update html_root_url +version = "7.0.0-beta.1" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" @@ -27,21 +27,21 @@ vendored-openssl = ["amq-protocol-tcp/vendored-openssl"] verbose-errors = ["amq-protocol-types/verbose-errors"] [build-dependencies.amq-protocol-codegen] -version = "=7.0.0-alpha.7" +version = "=7.0.0-beta.1" path = "../codegen" optional = true [dependencies.amq-protocol-tcp] -version = "=7.0.0-alpha.7" +version = "=7.0.0-beta.1" default-features = false path = "../tcp" [dependencies.amq-protocol-types] -version = "=7.0.0-alpha.7" +version = "=7.0.0-beta.1" path = "../types" [dependencies.amq-protocol-uri] -version = "=7.0.0-alpha.7" +version = "=7.0.0-beta.1" path = "../uri" [dependencies.cookie-factory] diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs index ec1b5bb3..76056a7f 100644 --- a/protocol/src/lib.rs +++ b/protocol/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol/7.0.0-alpha.7/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol/7.0.0-beta.1/")] //! # AMQP manipulation library //! diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index b518fdc4..73ba29a9 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "7.0.0-alpha.7" # remember to update html_root_url +version = "7.0.0-beta.1" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" @@ -24,7 +24,7 @@ rustls-connector = ["tcp-stream/rustls-connector"] vendored-openssl = ["tcp-stream/vendored-openssl"] [dependencies.amq-protocol-uri] -version = "=7.0.0-alpha.7" +version = "=7.0.0-beta.1" path = "../uri" [dependencies.tcp-stream] diff --git a/tcp/src/lib.rs b/tcp/src/lib.rs index d565d992..e500e6c9 100644 --- a/tcp/src/lib.rs +++ b/tcp/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/7.0.0-alpha.7/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/7.0.0-beta.1/")] //! # AMQP URI TCP connection handling //! diff --git a/types/Cargo.toml b/types/Cargo.toml index 9424414b..243681dc 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "7.0.0-alpha.7" # remember to update html_root_url +version = "7.0.0-beta.1" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/types/src/lib.rs b/types/src/lib.rs index 8e41d7fe..fbc2ec5c 100644 --- a/types/src/lib.rs +++ b/types/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-types/7.0.0-alpha.7/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-types/7.0.0-beta.1/")] //! # AMQP types manipulation library //! diff --git a/uri/Cargo.toml b/uri/Cargo.toml index 85b63c1c..ecfd9112 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "7.0.0-alpha.7" # remember to update html_root_url +version = "7.0.0-beta.1" # remember to update html_root_url edition = "2018" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" @@ -14,7 +14,7 @@ license = "BSD-2-Clause" name = "amq_protocol_uri" [dependencies.amq-protocol-types] -version = "=7.0.0-alpha.7" +version = "=7.0.0-beta.1" path = "../types" [dependencies] diff --git a/uri/src/lib.rs b/uri/src/lib.rs index 15c9d2a2..672ff27f 100644 --- a/uri/src/lib.rs +++ b/uri/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/7.0.0-alpha.7/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/7.0.0-beta.1/")] //! # AMQP URI manipulation library //! From 6add73a2b0463fb4170617e28668333474b18838 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Mon, 25 Oct 2021 16:20:49 +0200 Subject: [PATCH 076/133] ci: update MSRV Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- .github/workflows/build-and-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index f6bb5c04..744ac1d3 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -13,7 +13,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - rust: [nightly, beta, stable, 1.43.0] + rust: [nightly, beta, stable, 1.50.0] steps: - uses: actions/checkout@v2 From fbaaddfbb7be9a6a9b3aa4c73f06e4ca1504e45a Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Thu, 30 Dec 2021 21:03:23 +0100 Subject: [PATCH 077/133] edition 2021 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- .github/workflows/build-and-test.yaml | 2 +- codegen/Cargo.toml | 3 ++- codegen/src/templating.rs | 2 +- protocol/Cargo.toml | 3 ++- protocol/src/generated.rs | 23 +---------------------- protocol/templates/protocol.rs | 12 +----------- tcp/Cargo.toml | 5 +++-- types/Cargo.toml | 3 ++- types/src/flags.rs | 8 +------- types/src/generation.rs | 2 +- uri/Cargo.toml | 3 ++- uri/src/lib.rs | 2 +- 12 files changed, 18 insertions(+), 50 deletions(-) diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index 744ac1d3..3d6a05c0 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -13,7 +13,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - rust: [nightly, beta, stable, 1.50.0] + rust: [nightly, beta, stable, 1.56.0] steps: - uses: actions/checkout@v2 diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 930323dc..b3591290 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "amq-protocol-codegen" version = "7.0.0-beta.1" # remember to update html_root_url -edition = "2018" +edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" repository = "https://github.com/CleverCloud/amq-protocol" @@ -9,6 +9,7 @@ documentation = "https://docs.rs/amq-protocol-codegen" keywords = ["amqp","rabbitmq","protocol"] categories = ["api-bindings","network-programming"] license = "BSD-2-Clause" +rust-version = "1.56.0" [lib] name = "amq_protocol_codegen" diff --git a/codegen/src/templating.rs b/codegen/src/templating.rs index 2cfdca8e..a1655c20 100644 --- a/codegen/src/templating.rs +++ b/codegen/src/templating.rs @@ -339,7 +339,7 @@ impl HelperDef for EachArgumentHelper { block.set_local_var("index", to_json(&index)); block.set_local_var("last", to_json(index == len - 1)); block.set_local_var("argument_is_value", to_json(&is_value)); - if let Some(ref p) = array_path { + if let Some(p) = array_path { if index == 0 { let mut path = Vec::with_capacity(p.len() + 1); path.extend_from_slice(p); diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index c445fd52..36649332 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "amq-protocol" version = "7.0.0-beta.1" # remember to update html_root_url -edition = "2018" +edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" repository = "https://github.com/CleverCloud/amq-protocol" @@ -10,6 +10,7 @@ keywords = ["amqp","rabbitmq","protocol","nom"] categories = ["api-bindings","network-programming"] license = "BSD-2-Clause" build = "build.rs" +rust-version = "1.56.0" [lib] name = "amq_protocol" diff --git a/protocol/src/generated.rs b/protocol/src/generated.rs index c44e1e22..bb465705 100644 --- a/protocol/src/generated.rs +++ b/protocol/src/generated.rs @@ -3566,7 +3566,7 @@ pub mod basic { } } /// basic properties (Generated) - #[derive(Clone, Debug, PartialEq)] + #[derive(Clone, Debug, Default, PartialEq)] pub struct AMQPProperties { content_type: Option<ShortString>, content_encoding: Option<ShortString>, @@ -3584,27 +3584,6 @@ pub mod basic { cluster_id: Option<ShortString>, } - impl Default for AMQPProperties { - fn default() -> AMQPProperties { - AMQPProperties { - content_type: None, - content_encoding: None, - headers: None, - delivery_mode: None, - priority: None, - correlation_id: None, - reply_to: None, - expiration: None, - message_id: None, - timestamp: None, - kind: None, - user_id: None, - app_id: None, - cluster_id: None, - } - } - } - impl AMQPProperties { /// Set content-type (Generated) pub fn with_content_type(mut self, value: ShortString) -> AMQPProperties { diff --git a/protocol/templates/protocol.rs b/protocol/templates/protocol.rs index 58ea77b1..3c6fecbe 100644 --- a/protocol/templates/protocol.rs +++ b/protocol/templates/protocol.rs @@ -292,23 +292,13 @@ pub mod {{snake class.name}} { {{/each ~}} {{#if class.properties ~}} /// {{class.name}} properties (Generated) - #[derive(Clone, Debug, PartialEq)] + #[derive(Clone, Debug, Default, PartialEq)] pub struct AMQPProperties { {{#each class.properties as |property| ~}} {{snake property.name}}: Option<{{property.type}}>, {{/each ~}} } - impl Default for AMQPProperties { - fn default() -> AMQPProperties { - AMQPProperties { - {{#each class.properties as |property| ~}} - {{snake property.name}}: None, - {{/each ~}} - } - } - } - impl AMQPProperties { {{#each class.properties as |property| ~}} /// Set {{property.name}} (Generated) diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index 73ba29a9..157d68e8 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "amq-protocol-tcp" version = "7.0.0-beta.1" # remember to update html_root_url -edition = "2018" +edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" repository = "https://github.com/CleverCloud/amq-protocol" @@ -9,6 +9,7 @@ documentation = "https://docs.rs/amq-protocol-tcp" keywords = ["amqp","rabbitmq","protocol"] categories = ["api-bindings","network-programming"] license = "BSD-2-Clause" +rust-version = "1.56.0" [lib] name = "amq_protocol_tcp" @@ -28,7 +29,7 @@ version = "=7.0.0-beta.1" path = "../uri" [dependencies.tcp-stream] -version = "^0.23" +version = "^0.24" default-features = false [dependencies.tracing] diff --git a/types/Cargo.toml b/types/Cargo.toml index 243681dc..8565541b 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "amq-protocol-types" version = "7.0.0-beta.1" # remember to update html_root_url -edition = "2018" +edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" repository = "https://github.com/CleverCloud/amq-protocol" @@ -9,6 +9,7 @@ documentation = "https://docs.rs/amq-protocol-types" keywords = ["amqp","rabbitmq","protocol","nom"] categories = ["api-bindings","network-programming"] license = "BSD-2-Clause" +rust-version = "1.56.0" [lib] name = "amq_protocol_types" diff --git a/types/src/flags.rs b/types/src/flags.rs index 3daafca2..d2c8e6d4 100644 --- a/types/src/flags.rs +++ b/types/src/flags.rs @@ -3,7 +3,7 @@ use crate::types::Boolean; use serde::{Deserialize, Serialize}; /// A struct representing AMQP boolean flags for RPC -#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] +#[derive(Clone, Debug, Default, PartialEq, Deserialize, Serialize)] pub struct AMQPFlags { flags: Vec<(String, Boolean)>, } @@ -50,12 +50,6 @@ impl AMQPFlags { } } -impl Default for AMQPFlags { - fn default() -> AMQPFlags { - AMQPFlags { flags: Vec::new() } - } -} - #[cfg(test)] mod test { use super::*; diff --git a/types/src/generation.rs b/types/src/generation.rs index 6465c6b1..463bef00 100644 --- a/types/src/generation.rs +++ b/types/src/generation.rs @@ -162,7 +162,7 @@ pub fn gen_field_table<'a, W: Write + BackToTheBuffer + 'a>( fn gen_field_entry<'a, W: Write + BackToTheBuffer + 'a>( e: (&'a ShortString, &'a AMQPValue), ) -> impl SerializeFn<W> + 'a { - pair(gen_short_string(e.0.as_str()), gen_value(&e.1)) + pair(gen_short_string(e.0.as_str()), gen_value(e.1)) } /// Generate the [ByteArray](../type.ByteArray.html) in the given buffer (x) diff --git a/uri/Cargo.toml b/uri/Cargo.toml index ecfd9112..262d9d44 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "amq-protocol-uri" version = "7.0.0-beta.1" # remember to update html_root_url -edition = "2018" +edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" repository = "https://github.com/CleverCloud/amq-protocol" @@ -9,6 +9,7 @@ documentation = "https://docs.rs/amq-protocol-uri" keywords = ["amqp","rabbitmq","protocol"] categories = ["api-bindings","network-programming"] license = "BSD-2-Clause" +rust-version = "1.56.0" [lib] name = "amq_protocol_uri" diff --git a/uri/src/lib.rs b/uri/src/lib.rs index 672ff27f..d76dc126 100644 --- a/uri/src/lib.rs +++ b/uri/src/lib.rs @@ -177,7 +177,7 @@ impl FromStr for AMQPUri { .domain() .map_or(Ok(default.authority.host), percent_decode)?; let port = url.port().unwrap_or_else(|| scheme.default_port()); - let vhost = percent_decode(&url.path().get(1..).unwrap_or("/"))?; + let vhost = percent_decode(url.path().get(1..).unwrap_or("/"))?; let frame_max = int_queryparam(&url, "frame_max")?; let channel_max = int_queryparam(&url, "channel_max")?; let heartbeat = int_queryparam(&url, "heartbeat")?; From 9b9b381a989da02b7b51f9e302047d526b30c1fc Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Thu, 30 Dec 2021 21:05:43 +0100 Subject: [PATCH 078/133] switch to main branch Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- .github/workflows/build-and-test.yaml | 2 +- .github/workflows/lint.yaml | 2 +- .github/workflows/security.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index 3d6a05c0..2f45f55d 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -3,7 +3,7 @@ name: Build and test on: push: branches: - - master + - main pull_request: jobs: diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 440ae87b..c672e393 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -3,7 +3,7 @@ name: Lint on: push: branches: - - master + - main pull_request: jobs: diff --git a/.github/workflows/security.yaml b/.github/workflows/security.yaml index c4f7947a..4238fb02 100644 --- a/.github/workflows/security.yaml +++ b/.github/workflows/security.yaml @@ -3,7 +3,7 @@ name: Security audit on: push: branches: - - master + - main pull_request: jobs: From 7fc19490ec841cad28dd784df8fa2173712d00c5 Mon Sep 17 00:00:00 2001 From: Wiktor Sikora <wiktorsikora7@gmail.com> Date: Sat, 18 Dec 2021 18:22:25 +0100 Subject: [PATCH 079/133] AMQPValue as_* conversions --- types/src/value.rs | 145 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) diff --git a/types/src/value.rs b/types/src/value.rs index 0b023232..45826126 100644 --- a/types/src/value.rs +++ b/types/src/value.rs @@ -1,3 +1,4 @@ +use std::collections::BTreeMap; use crate::types::*; use serde::{Deserialize, Serialize}; @@ -107,6 +108,150 @@ impl AMQPValue { AMQPType::Void => value.as_null().map(|_| AMQPValue::Void), } } + + /// If the value is bool, returns associated value. Returns None otherwise. + pub fn as_bool(&self) -> Option<bool> { + match self { + AMQPValue::Boolean(value) => Some(*value), + _ => None + } + } + + /// If the value is ShortShortInt, returns associated value. Returns None otherwise. + pub fn as_short_short_int(&self) -> Option<i8> { + match self { + AMQPValue::ShortShortInt(value) => Some(*value), + _ => None + } + } + + /// If the value is ShortShortUInt, returns associated value. Returns None otherwise. + pub fn as_short_short_uint(&self) -> Option<u8> { + match self { + AMQPValue::ShortShortUInt(value) => Some(*value), + _ => None + } + } + + /// If the value is ShortInt, returns associated value. Returns None otherwise. + pub fn as_short_int(&self) -> Option<i16> { + match self { + AMQPValue::ShortInt(value) => Some(*value), + _ => None + } + } + + /// If the value is ShortUInt, returns associated value. Returns None otherwise. + pub fn as_short_uint(&self) -> Option<u16> { + match self { + AMQPValue::ShortUInt(value) => Some(*value), + _ => None + } + } + + /// If the value is LongInt, returns associated value. Returns None otherwise. + pub fn as_long_int(&self) -> Option<i32> { + match self { + AMQPValue::LongInt(value) => Some(*value), + _ => None + } + } + + /// If the value is LongUInt, returns associated value. Returns None otherwise. + pub fn as_long_uint(&self) -> Option<u32> { + match self { + AMQPValue::LongUInt(value) => Some(*value), + _ => None + } + } + + /// If the value is LongLongInt, returns associated value. Returns None otherwise. + pub fn as_long_long_int(&self) -> Option<i64> { + match self { + AMQPValue::LongLongInt(value) => Some(*value), + _ => None + } + } + + /// If the value is Float, returns associated value. Returns None otherwise. + pub fn as_float(&self) -> Option<f32> { + match self { + AMQPValue::Float(value) => Some(*value), + _ => None + } + } + + /// If the value is Double, returns associated value. Returns None otherwise. + pub fn as_double(&self) -> Option<f64> { + match self { + AMQPValue::Double(value) => Some(*value), + _ => None + } + } + + /// If the value is DecimalValue, returns associated value. Returns None otherwise. + pub fn as_decimal(&self) -> Option<&DecimalValue> { + match self { + AMQPValue::DecimalValue(value) => Some(value), + _ => None + } + } + + /// If the value is ShortString, returns associated value as str. Returns None otherwise. + pub fn as_short_string(&self) -> Option<&str> { + match self { + AMQPValue::ShortString(value) => Some(value.as_str()), + _ => None + } + } + + /// If the value is LongString, returns associated value as bytes. Returns None otherwise. + pub fn as_long_string(&self) -> Option<&[u8]> { + match self { + AMQPValue::LongString(value) => Some(value.as_bytes()), + _ => None + } + } + + /// If the value is FieldArray, returns associated value. Returns None otherwise. + pub fn as_array(&self) -> Option<&[AMQPValue]> { + match self { + AMQPValue::FieldArray(value) => Some(value.as_slice()), + _ => None + } + } + + /// If the value is Timestamp, returns associated value. Returns None otherwise. + pub fn as_timestamp(&self) -> Option<u64> { + match self { + AMQPValue::Timestamp(value) => Some(*value), + _ => None + } + } + + /// If the value is FieldTable, returns associated value. Returns None otherwise. + pub fn as_field_table(&self) -> Option<&BTreeMap<ShortString, AMQPValue>> { + match self { + AMQPValue::FieldTable(value) => Some(value.inner()), + _ => None + } + } + + /// If the value is ByteArray, returns associated value. Returns None otherwise. + pub fn as_byte_array(&self) -> Option<&[u8]> { + match self { + AMQPValue::ByteArray(value) => Some(value.as_slice()), + _ => None + } + } + + /// Returns true if value is Void. + pub fn is_void(&self) -> bool { + match self { + AMQPValue::Void => true, + _ => false + } + } } impl From<Boolean> for AMQPValue { From 45be42860cd8786d97ef03967996ee3f7a105bd9 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Tue, 4 Jan 2022 12:38:06 +0100 Subject: [PATCH 080/133] types: use internal types in as_* conversions Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- types/src/value.rs | 87 +++++++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 44 deletions(-) diff --git a/types/src/value.rs b/types/src/value.rs index 45826126..2889f132 100644 --- a/types/src/value.rs +++ b/types/src/value.rs @@ -1,4 +1,3 @@ -use std::collections::BTreeMap; use crate::types::*; use serde::{Deserialize, Serialize}; @@ -110,146 +109,146 @@ impl AMQPValue { } /// If the value is bool, returns associated value. Returns None otherwise. - pub fn as_bool(&self) -> Option<bool> { + pub fn as_bool(&self) -> Option<Boolean> { match self { AMQPValue::Boolean(value) => Some(*value), - _ => None + _ => None, } } /// If the value is ShortShortInt, returns associated value. Returns None otherwise. - pub fn as_short_short_int(&self) -> Option<i8> { + pub fn as_short_short_int(&self) -> Option<ShortShortInt> { match self { AMQPValue::ShortShortInt(value) => Some(*value), - _ => None + _ => None, } } /// If the value is ShortShortUInt, returns associated value. Returns None otherwise. - pub fn as_short_short_uint(&self) -> Option<u8> { + pub fn as_short_short_uint(&self) -> Option<ShortShortUInt> { match self { AMQPValue::ShortShortUInt(value) => Some(*value), - _ => None + _ => None, } } /// If the value is ShortInt, returns associated value. Returns None otherwise. - pub fn as_short_int(&self) -> Option<i16> { + pub fn as_short_int(&self) -> Option<ShortInt> { match self { AMQPValue::ShortInt(value) => Some(*value), - _ => None + _ => None, } } /// If the value is ShortUInt, returns associated value. Returns None otherwise. - pub fn as_short_uint(&self) -> Option<u16> { + pub fn as_short_uint(&self) -> Option<ShortUInt> { match self { AMQPValue::ShortUInt(value) => Some(*value), - _ => None + _ => None, } } /// If the value is LongInt, returns associated value. Returns None otherwise. - pub fn as_long_int(&self) -> Option<i32> { + pub fn as_long_int(&self) -> Option<LongInt> { match self { AMQPValue::LongInt(value) => Some(*value), - _ => None + _ => None, } } /// If the value is LongUInt, returns associated value. Returns None otherwise. - pub fn as_long_uint(&self) -> Option<u32> { + pub fn as_long_uint(&self) -> Option<LongUInt> { match self { AMQPValue::LongUInt(value) => Some(*value), - _ => None + _ => None, } } /// If the value is LongLongInt, returns associated value. Returns None otherwise. - pub fn as_long_long_int(&self) -> Option<i64> { + pub fn as_long_long_int(&self) -> Option<LongLongInt> { match self { AMQPValue::LongLongInt(value) => Some(*value), - _ => None + _ => None, } } /// If the value is Float, returns associated value. Returns None otherwise. - pub fn as_float(&self) -> Option<f32> { + pub fn as_float(&self) -> Option<Float> { match self { AMQPValue::Float(value) => Some(*value), - _ => None + _ => None, } } /// If the value is Double, returns associated value. Returns None otherwise. - pub fn as_double(&self) -> Option<f64> { + pub fn as_double(&self) -> Option<Double> { match self { AMQPValue::Double(value) => Some(*value), - _ => None + _ => None, } } /// If the value is DecimalValue, returns associated value. Returns None otherwise. - pub fn as_decimal(&self) -> Option<&DecimalValue> { + pub fn as_decimal_value(&self) -> Option<DecimalValue> { match self { - AMQPValue::DecimalValue(value) => Some(value), - _ => None + AMQPValue::DecimalValue(value) => Some(*value), + _ => None, } } /// If the value is ShortString, returns associated value as str. Returns None otherwise. - pub fn as_short_string(&self) -> Option<&str> { + pub fn as_short_string(&self) -> Option<&ShortString> { match self { - AMQPValue::ShortString(value) => Some(value.as_str()), - _ => None + AMQPValue::ShortString(value) => Some(value), + _ => None, } } /// If the value is LongString, returns associated value as bytes. Returns None otherwise. - pub fn as_long_string(&self) -> Option<&[u8]> { + pub fn as_long_string(&self) -> Option<&LongString> { match self { - AMQPValue::LongString(value) => Some(value.as_bytes()), - _ => None + AMQPValue::LongString(value) => Some(value), + _ => None, } } /// If the value is FieldArray, returns associated value. Returns None otherwise. - pub fn as_array(&self) -> Option<&[AMQPValue]> { + pub fn as_array(&self) -> Option<&FieldArray> { match self { - AMQPValue::FieldArray(value) => Some(value.as_slice()), - _ => None + AMQPValue::FieldArray(value) => Some(value), + _ => None, } } /// If the value is Timestamp, returns associated value. Returns None otherwise. - pub fn as_timestamp(&self) -> Option<u64> { + pub fn as_timestamp(&self) -> Option<Timestamp> { match self { AMQPValue::Timestamp(value) => Some(*value), - _ => None + _ => None, } } /// If the value is FieldTable, returns associated value. Returns None otherwise. - pub fn as_field_table(&self) -> Option<&BTreeMap<ShortString, AMQPValue>> { + pub fn as_field_table(&self) -> Option<&FieldTable> { match self { - AMQPValue::FieldTable(value) => Some(value.inner()), - _ => None + AMQPValue::FieldTable(value) => Some(value), + _ => None, } } /// If the value is ByteArray, returns associated value. Returns None otherwise. - pub fn as_byte_array(&self) -> Option<&[u8]> { + pub fn as_byte_array(&self) -> Option<&ByteArray> { match self { - AMQPValue::ByteArray(value) => Some(value.as_slice()), - _ => None + AMQPValue::ByteArray(value) => Some(value), + _ => None, } } /// Returns true if value is Void. - pub fn is_void(&self) -> bool { + pub fn as_void(&self) -> Option<()> { match self { - AMQPValue::Void => true, - _ => false + AMQPValue::Void => Some(()), + _ => None, } } } From 3b0f2804636b026c67256b750afb6be2100b6c10 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Tue, 4 Jan 2022 12:44:37 +0100 Subject: [PATCH 081/133] update badges Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- README.md | 2 +- codegen/Cargo.toml | 5 ++--- protocol/Cargo.toml | 5 ++--- tcp/Cargo.toml | 5 ++--- types/Cargo.toml | 5 ++--- uri/Cargo.toml | 5 ++--- 6 files changed, 11 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 3aaa9d9c..23e6f4e7 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # amq-protocol [](https://docs.rs/amq-protocol) -[](https://github.com/CleverCloud/amq-protocol/actions) +[](https://github.com/amqp-rs/amq-protocol/actions) [](https://crates.io/crates/amq-protocol) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index b3591290..66282279 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -4,7 +4,7 @@ version = "7.0.0-beta.1" # remember to update html_root_url edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" -repository = "https://github.com/CleverCloud/amq-protocol" +repository = "https://github.com/amqp-rs/amq-protocol" documentation = "https://docs.rs/amq-protocol-codegen" keywords = ["amqp","rabbitmq","protocol"] categories = ["api-bindings","network-programming"] @@ -27,5 +27,4 @@ version = "^1.0" features = ["derive"] [badges] -travis-ci = { repository = "sozu-proxy/amq-protocol" } -appveyor = { repository = "Keruspe/amq-protocol" } +maintenance = { status = "actively-developed" } diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index 36649332..3cd0b05f 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -4,7 +4,7 @@ version = "7.0.0-beta.1" # remember to update html_root_url edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" -repository = "https://github.com/CleverCloud/amq-protocol" +repository = "https://github.com/amqp-rs/amq-protocol" documentation = "https://docs.rs/amq-protocol" keywords = ["amqp","rabbitmq","protocol","nom"] categories = ["api-bindings","network-programming"] @@ -54,5 +54,4 @@ version = "^7.0" features = ["std"] [badges] -travis-ci = { repository = "sozu-proxy/amq-protocol" } -appveyor = { repository = "Keruspe/amq-protocol" } +maintenance = { status = "actively-developed" } diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index 157d68e8..d838f937 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -4,7 +4,7 @@ version = "7.0.0-beta.1" # remember to update html_root_url edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" -repository = "https://github.com/CleverCloud/amq-protocol" +repository = "https://github.com/amqp-rs/amq-protocol" documentation = "https://docs.rs/amq-protocol-tcp" keywords = ["amqp","rabbitmq","protocol"] categories = ["api-bindings","network-programming"] @@ -37,5 +37,4 @@ version = "^0.1" default-features = false [badges] -travis-ci = { repository = "sozu-proxy/amq-protocol" } -appveyor = { repository = "Keruspe/amq-protocol" } +maintenance = { status = "actively-developed" } diff --git a/types/Cargo.toml b/types/Cargo.toml index 8565541b..dc2f1560 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -4,7 +4,7 @@ version = "7.0.0-beta.1" # remember to update html_root_url edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" -repository = "https://github.com/CleverCloud/amq-protocol" +repository = "https://github.com/amqp-rs/amq-protocol" documentation = "https://docs.rs/amq-protocol-types" keywords = ["amqp","rabbitmq","protocol","nom"] categories = ["api-bindings","network-programming"] @@ -33,5 +33,4 @@ version = "^1.0" features = ["derive"] [badges] -travis-ci = { repository = "sozu-proxy/amq-protocol" } -appveyor = { repository = "Keruspe/amq-protocol" } +maintenance = { status = "actively-developed" } diff --git a/uri/Cargo.toml b/uri/Cargo.toml index 262d9d44..d49b405f 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -4,7 +4,7 @@ version = "7.0.0-beta.1" # remember to update html_root_url edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" -repository = "https://github.com/CleverCloud/amq-protocol" +repository = "https://github.com/amqp-rs/amq-protocol" documentation = "https://docs.rs/amq-protocol-uri" keywords = ["amqp","rabbitmq","protocol"] categories = ["api-bindings","network-programming"] @@ -23,5 +23,4 @@ percent-encoding = "^2.0" url = "^2.0" [badges] -travis-ci = { repository = "sozu-proxy/amq-protocol" } -appveyor = { repository = "Keruspe/amq-protocol" } +maintenance = { status = "actively-developed" } From 7a9ddbe0c66b5e05668bc86484a2b7786ad7f7b3 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Tue, 4 Jan 2022 12:59:11 +0100 Subject: [PATCH 082/133] v7.0.0 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/Cargo.toml | 4 ++-- codegen/src/lib.rs | 2 +- protocol/Cargo.toml | 10 +++++----- protocol/src/lib.rs | 2 +- tcp/Cargo.toml | 4 ++-- tcp/src/lib.rs | 2 +- types/Cargo.toml | 2 +- types/src/lib.rs | 2 +- uri/Cargo.toml | 4 ++-- uri/src/lib.rs | 2 +- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 66282279..ba7f171c 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "7.0.0-beta.1" # remember to update html_root_url +version = "7.0.0" # remember to update html_root_url edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" @@ -19,7 +19,7 @@ handlebars = "^4.0" serde_json = "^1.0" [dependencies.amq-protocol-types] -version = "=7.0.0-beta.1" +version = "=7.0.0" path = "../types" [dependencies.serde] diff --git a/codegen/src/lib.rs b/codegen/src/lib.rs index 55e69b77..a7772c69 100644 --- a/codegen/src/lib.rs +++ b/codegen/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/7.0.0-beta.1/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/7.0.0/")] //! # AMQP code generation utilities //! diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index 3cd0b05f..2e132748 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "7.0.0-beta.1" # remember to update html_root_url +version = "7.0.0" # remember to update html_root_url edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" @@ -28,21 +28,21 @@ vendored-openssl = ["amq-protocol-tcp/vendored-openssl"] verbose-errors = ["amq-protocol-types/verbose-errors"] [build-dependencies.amq-protocol-codegen] -version = "=7.0.0-beta.1" +version = "=7.0.0" path = "../codegen" optional = true [dependencies.amq-protocol-tcp] -version = "=7.0.0-beta.1" +version = "=7.0.0" default-features = false path = "../tcp" [dependencies.amq-protocol-types] -version = "=7.0.0-beta.1" +version = "=7.0.0" path = "../types" [dependencies.amq-protocol-uri] -version = "=7.0.0-beta.1" +version = "=7.0.0" path = "../uri" [dependencies.cookie-factory] diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs index 76056a7f..f49e1ce4 100644 --- a/protocol/src/lib.rs +++ b/protocol/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol/7.0.0-beta.1/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol/7.0.0/")] //! # AMQP manipulation library //! diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index d838f937..bc6798d5 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "7.0.0-beta.1" # remember to update html_root_url +version = "7.0.0" # remember to update html_root_url edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" @@ -25,7 +25,7 @@ rustls-connector = ["tcp-stream/rustls-connector"] vendored-openssl = ["tcp-stream/vendored-openssl"] [dependencies.amq-protocol-uri] -version = "=7.0.0-beta.1" +version = "=7.0.0" path = "../uri" [dependencies.tcp-stream] diff --git a/tcp/src/lib.rs b/tcp/src/lib.rs index e500e6c9..2944a59a 100644 --- a/tcp/src/lib.rs +++ b/tcp/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/7.0.0-beta.1/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/7.0.0/")] //! # AMQP URI TCP connection handling //! diff --git a/types/Cargo.toml b/types/Cargo.toml index dc2f1560..7d07d33e 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "7.0.0-beta.1" # remember to update html_root_url +version = "7.0.0" # remember to update html_root_url edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/types/src/lib.rs b/types/src/lib.rs index fbc2ec5c..701765db 100644 --- a/types/src/lib.rs +++ b/types/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-types/7.0.0-beta.1/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-types/7.0.0/")] //! # AMQP types manipulation library //! diff --git a/uri/Cargo.toml b/uri/Cargo.toml index d49b405f..e4200e75 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "7.0.0-beta.1" # remember to update html_root_url +version = "7.0.0" # remember to update html_root_url edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" @@ -15,7 +15,7 @@ rust-version = "1.56.0" name = "amq_protocol_uri" [dependencies.amq-protocol-types] -version = "=7.0.0-beta.1" +version = "=7.0.0" path = "../types" [dependencies] diff --git a/uri/src/lib.rs b/uri/src/lib.rs index d76dc126..6cbab696 100644 --- a/uri/src/lib.rs +++ b/uri/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/7.0.0-beta.1/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/7.0.0/")] //! # AMQP URI manipulation library //! From 546d60744c69f8dbf4fff80ad65d8057bd78a77b Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Tue, 4 Jan 2022 13:47:34 +0100 Subject: [PATCH 083/133] pass edition to rustfmt Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- regen-code.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regen-code.sh b/regen-code.sh index bdce42f3..2c9912f2 100755 --- a/regen-code.sh +++ b/regen-code.sh @@ -5,7 +5,7 @@ main() { export AMQ_PROTOCOL_CODEGEN_FILE="generated" cargo build --manifest-path protocol/Cargo.toml --features=codegen-internal - rustfmt "${AMQ_PROTOCOL_CODEGEN_DIR}/${AMQ_PROTOCOL_CODEGEN_FILE}.rs" + rustfmt --edition=2021 "${AMQ_PROTOCOL_CODEGEN_DIR}/${AMQ_PROTOCOL_CODEGEN_FILE}.rs" } main "${@}" From b9f16f793112700223a4d676f1693e0ac403c2b8 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Sun, 13 Feb 2022 22:00:45 +0100 Subject: [PATCH 084/133] update specs Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/specs/amqp-rabbitmq-0.9.1.json | 224 +- protocol/src/generated.rs | 5000 ++++++++++++------------ update-specs.sh | 2 +- 3 files changed, 2613 insertions(+), 2613 deletions(-) diff --git a/codegen/specs/amqp-rabbitmq-0.9.1.json b/codegen/specs/amqp-rabbitmq-0.9.1.json index 329d63ee..43f3cf64 100644 --- a/codegen/specs/amqp-rabbitmq-0.9.1.json +++ b/codegen/specs/amqp-rabbitmq-0.9.1.json @@ -98,6 +98,118 @@ ], "classes": [ + { + "id": 60, + "methods": [{"id": 10, + "arguments": [{"type": "long", "name": "prefetch-size", "default-value": 0}, + {"type": "short", "name": "prefetch-count", "default-value": 0}, + {"type": "bit", "name": "global", "default-value": false}], + "name": "qos", + "synchronous" : true}, + {"id": 11, + "arguments": [], + "name": "qos-ok"}, + {"id": 20, + "arguments": [{"domain": "short", "name": "ticket", "default-value": 0}, + {"domain": "queue-name", "name": "queue", "default-value": ""}, + {"type": "shortstr", "name": "consumer-tag", "default-value": ""}, + {"type": "bit", "name": "no-local", "default-value": false}, + {"type": "bit", "name": "no-ack", "default-value": false}, + {"type": "bit", "name": "exclusive", "default-value": false}, + {"type": "bit", "name": "nowait", "default-value": false}, + {"type": "table", "name": "arguments", "default-value": {}}], + "name": "consume", + "synchronous" : true}, + {"id": 21, + "arguments": [{"type": "shortstr", "name": "consumer-tag"}], + "name": "consume-ok"}, + {"id": 30, + "arguments": [{"type": "shortstr", "name": "consumer-tag"}, + {"type": "bit", "name": "nowait", "default-value": false}], + "name": "cancel", + "synchronous" : true}, + {"id": 31, + "arguments": [{"type": "shortstr", "name": "consumer-tag"}], + "name": "cancel-ok"}, + {"content": true, + "id": 40, + "arguments": [{"type": "short", "name": "ticket", "default-value": 0}, + {"domain": "exchange-name", "name": "exchange", "default-value": ""}, + {"type": "shortstr", "name": "routing-key", "default-value": ""}, + {"type": "bit", "name": "mandatory", "default-value": false}, + {"type": "bit", "name": "immediate", "default-value": false}], + "name": "publish"}, + {"content": true, + "id": 50, + "arguments": [{"type": "short", "name": "reply-code"}, + {"type": "shortstr", "name": "reply-text", "default-value": ""}, + {"domain": "exchange-name", "name": "exchange"}, + {"type": "shortstr", "name": "routing-key"}], + "name": "return"}, + {"content": true, + "id": 60, + "arguments": [{"type": "shortstr", "name": "consumer-tag"}, + {"type": "longlong", "name": "delivery-tag"}, + {"type": "bit", "name": "redelivered", "default-value": false}, + {"domain": "exchange-name", "name": "exchange"}, + {"type": "shortstr", "name": "routing-key"}], + "name": "deliver"}, + {"id": 70, + "arguments": [{"type": "short", "name": "ticket", "default-value": 0}, + {"domain": "queue-name", "name": "queue", "default-value": ""}, + {"type": "bit", "name": "no-ack", "default-value": false}], + "name": "get", + "synchronous" : true}, + {"content": true, + "id": 71, + "arguments": [{"type": "longlong", "name": "delivery-tag"}, + {"type": "bit", "name": "redelivered", "default-value": false}, + {"domain": "exchange-name", "name": "exchange"}, + {"type": "shortstr", "name": "routing-key"}, + {"domain": "message-count", "name": "message-count"}], + "name": "get-ok"}, + {"id": 72, + "arguments": [{"type": "shortstr", "name": "cluster-id", "default-value": ""}], + "name": "get-empty"}, + {"id": 80, + "arguments": [{"type": "longlong", "name": "delivery-tag", "default-value": 0}, + {"type": "bit", "name": "multiple", "default-value": false}], + "name": "ack"}, + {"id": 90, + "arguments": [{"type": "longlong", "name": "delivery-tag"}, + {"type": "bit", "name": "requeue", "default-value": true}], + "name": "reject"}, + {"id": 100, + "arguments": [{"type": "bit", "name": "requeue", "default-value": false}], + "name": "recover-async"}, + {"id": 110, + "arguments": [{"type": "bit", "name": "requeue", "default-value": false}], + "name": "recover", + "synchronous" : true}, + {"id": 111, + "arguments": [], + "name": "recover-ok"}, + {"id": 120, + "arguments": [{"type": "longlong", "name": "delivery-tag", "default-value": 0}, + {"type": "bit", "name": "multiple", "default-value": false}, + {"type": "bit", "name": "requeue", "default-value": true}], + "name": "nack"}], + "name": "basic", + "properties": [{"type": "shortstr", "name": "content-type"}, + {"type": "shortstr", "name": "content-encoding"}, + {"type": "table", "name": "headers"}, + {"type": "octet", "name": "delivery-mode"}, + {"type": "octet", "name": "priority"}, + {"type": "shortstr", "name": "correlation-id"}, + {"type": "shortstr", "name": "reply-to"}, + {"type": "shortstr", "name": "expiration"}, + {"type": "shortstr", "name": "message-id"}, + {"type": "timestamp", "name": "timestamp"}, + {"type": "shortstr", "name": "type"}, + {"type": "shortstr", "name": "user-id"}, + {"type": "shortstr", "name": "app-id"}, + {"type": "shortstr", "name": "cluster-id"}] + }, { "id": 10, "methods": [{"id": 10, @@ -330,118 +442,6 @@ ], "name": "queue" }, - { - "id": 60, - "methods": [{"id": 10, - "arguments": [{"type": "long", "name": "prefetch-size", "default-value": 0}, - {"type": "short", "name": "prefetch-count", "default-value": 0}, - {"type": "bit", "name": "global", "default-value": false}], - "name": "qos", - "synchronous" : true}, - {"id": 11, - "arguments": [], - "name": "qos-ok"}, - {"id": 20, - "arguments": [{"domain": "short", "name": "ticket", "default-value": 0}, - {"domain": "queue-name", "name": "queue", "default-value": ""}, - {"type": "shortstr", "name": "consumer-tag", "default-value": ""}, - {"type": "bit", "name": "no-local", "default-value": false}, - {"type": "bit", "name": "no-ack", "default-value": false}, - {"type": "bit", "name": "exclusive", "default-value": false}, - {"type": "bit", "name": "nowait", "default-value": false}, - {"type": "table", "name": "arguments", "default-value": {}}], - "name": "consume", - "synchronous" : true}, - {"id": 21, - "arguments": [{"type": "shortstr", "name": "consumer-tag"}], - "name": "consume-ok"}, - {"id": 30, - "arguments": [{"type": "shortstr", "name": "consumer-tag"}, - {"type": "bit", "name": "nowait", "default-value": false}], - "name": "cancel", - "synchronous" : true}, - {"id": 31, - "arguments": [{"type": "shortstr", "name": "consumer-tag"}], - "name": "cancel-ok"}, - {"content": true, - "id": 40, - "arguments": [{"type": "short", "name": "ticket", "default-value": 0}, - {"domain": "exchange-name", "name": "exchange", "default-value": ""}, - {"type": "shortstr", "name": "routing-key", "default-value": ""}, - {"type": "bit", "name": "mandatory", "default-value": false}, - {"type": "bit", "name": "immediate", "default-value": false}], - "name": "publish"}, - {"content": true, - "id": 50, - "arguments": [{"type": "short", "name": "reply-code"}, - {"type": "shortstr", "name": "reply-text", "default-value": ""}, - {"domain": "exchange-name", "name": "exchange"}, - {"type": "shortstr", "name": "routing-key"}], - "name": "return"}, - {"content": true, - "id": 60, - "arguments": [{"type": "shortstr", "name": "consumer-tag"}, - {"type": "longlong", "name": "delivery-tag"}, - {"type": "bit", "name": "redelivered", "default-value": false}, - {"domain": "exchange-name", "name": "exchange"}, - {"type": "shortstr", "name": "routing-key"}], - "name": "deliver"}, - {"id": 70, - "arguments": [{"type": "short", "name": "ticket", "default-value": 0}, - {"domain": "queue-name", "name": "queue", "default-value": ""}, - {"type": "bit", "name": "no-ack", "default-value": false}], - "name": "get", - "synchronous" : true}, - {"content": true, - "id": 71, - "arguments": [{"type": "longlong", "name": "delivery-tag"}, - {"type": "bit", "name": "redelivered", "default-value": false}, - {"domain": "exchange-name", "name": "exchange"}, - {"type": "shortstr", "name": "routing-key"}, - {"domain": "message-count", "name": "message-count"}], - "name": "get-ok"}, - {"id": 72, - "arguments": [{"type": "shortstr", "name": "cluster-id", "default-value": ""}], - "name": "get-empty"}, - {"id": 80, - "arguments": [{"type": "longlong", "name": "delivery-tag", "default-value": 0}, - {"type": "bit", "name": "multiple", "default-value": false}], - "name": "ack"}, - {"id": 90, - "arguments": [{"type": "longlong", "name": "delivery-tag"}, - {"type": "bit", "name": "requeue", "default-value": true}], - "name": "reject"}, - {"id": 100, - "arguments": [{"type": "bit", "name": "requeue", "default-value": false}], - "name": "recover-async"}, - {"id": 110, - "arguments": [{"type": "bit", "name": "requeue", "default-value": false}], - "name": "recover", - "synchronous" : true}, - {"id": 111, - "arguments": [], - "name": "recover-ok"}, - {"id": 120, - "arguments": [{"type": "longlong", "name": "delivery-tag", "default-value": 0}, - {"type": "bit", "name": "multiple", "default-value": false}, - {"type": "bit", "name": "requeue", "default-value": true}], - "name": "nack"}], - "name": "basic", - "properties": [{"type": "shortstr", "name": "content-type"}, - {"type": "shortstr", "name": "content-encoding"}, - {"type": "table", "name": "headers"}, - {"type": "octet", "name": "delivery-mode"}, - {"type": "octet", "name": "priority"}, - {"type": "shortstr", "name": "correlation-id"}, - {"type": "shortstr", "name": "reply-to"}, - {"type": "shortstr", "name": "expiration"}, - {"type": "shortstr", "name": "message-id"}, - {"type": "timestamp", "name": "timestamp"}, - {"type": "shortstr", "name": "type"}, - {"type": "shortstr", "name": "user-id"}, - {"type": "shortstr", "name": "app-id"}, - {"type": "shortstr", "name": "cluster-id"}] - }, { "id": 90, "methods": [{"id": 10, diff --git a/protocol/src/generated.rs b/protocol/src/generated.rs index bb465705..c9caee1e 100644 --- a/protocol/src/generated.rs +++ b/protocol/src/generated.rs @@ -224,12 +224,12 @@ pub fn parse_class<I: ParsableInput>(i: I) -> ParserResult<I, AMQPClass> { map_opt( flat_map(parse_id, |id| { move |i| match id { + 60 => map(map(parse_basic, AMQPClass::Basic), Some)(i), 10 => map(map(parse_connection, AMQPClass::Connection), Some)(i), 20 => map(map(parse_channel, AMQPClass::Channel), Some)(i), 30 => map(map(parse_access, AMQPClass::Access), Some)(i), 40 => map(map(parse_exchange, AMQPClass::Exchange), Some)(i), 50 => map(map(parse_queue, AMQPClass::Queue), Some)(i), - 60 => map(map(parse_basic, AMQPClass::Basic), Some)(i), 90 => map(map(parse_tx, AMQPClass::Tx), Some)(i), 85 => map(map(parse_confirm, AMQPClass::Confirm), Some)(i), _ => Ok((i, None)), @@ -245,12 +245,12 @@ pub fn gen_class<'a, W: Write + BackToTheBuffer + 'a>( class: &'a AMQPClass, ) -> impl SerializeFn<W> + 'a { move |input| match *class { + AMQPClass::Basic(ref basic) => basic::gen_basic(basic)(input), AMQPClass::Connection(ref connection) => connection::gen_connection(connection)(input), AMQPClass::Channel(ref channel) => channel::gen_channel(channel)(input), AMQPClass::Access(ref access) => access::gen_access(access)(input), AMQPClass::Exchange(ref exchange) => exchange::gen_exchange(exchange)(input), AMQPClass::Queue(ref queue) => queue::gen_queue(queue)(input), - AMQPClass::Basic(ref basic) => basic::gen_basic(basic)(input), AMQPClass::Tx(ref tx) => tx::gen_tx(tx)(input), AMQPClass::Confirm(ref confirm) => confirm::gen_confirm(confirm)(input), } @@ -259,6 +259,8 @@ pub fn gen_class<'a, W: Write + BackToTheBuffer + 'a>( /// The available AMQP classes #[derive(Clone, Debug, PartialEq)] pub enum AMQPClass { + /// basic (Generated) + Basic(basic::AMQPMethod), /// connection (Generated) Connection(connection::AMQPMethod), /// channel (Generated) @@ -269,8 +271,6 @@ pub enum AMQPClass { Exchange(exchange::AMQPMethod), /// queue (Generated) Queue(queue::AMQPMethod), - /// basic (Generated) - Basic(basic::AMQPMethod), /// tx (Generated) Tx(tx::AMQPMethod), /// confirm (Generated) @@ -281,12 +281,12 @@ impl AMQPClass { /// Get the AMQP class id (Generated) pub fn get_amqp_class_id(&self) -> Identifier { match self { + AMQPClass::Basic(_) => 60, AMQPClass::Connection(_) => 10, AMQPClass::Channel(_) => 20, AMQPClass::Access(_) => 30, AMQPClass::Exchange(_) => 40, AMQPClass::Queue(_) => 50, - AMQPClass::Basic(_) => 60, AMQPClass::Tx(_) => 90, AMQPClass::Confirm(_) => 85, } @@ -295,6 +295,24 @@ impl AMQPClass { /// Get the AMQP method id (Generated) pub fn get_amqp_method_id(&self) -> Identifier { match self { + AMQPClass::Basic(basic::AMQPMethod::Qos(_)) => 10, + AMQPClass::Basic(basic::AMQPMethod::QosOk(_)) => 11, + AMQPClass::Basic(basic::AMQPMethod::Consume(_)) => 20, + AMQPClass::Basic(basic::AMQPMethod::ConsumeOk(_)) => 21, + AMQPClass::Basic(basic::AMQPMethod::Cancel(_)) => 30, + AMQPClass::Basic(basic::AMQPMethod::CancelOk(_)) => 31, + AMQPClass::Basic(basic::AMQPMethod::Publish(_)) => 40, + AMQPClass::Basic(basic::AMQPMethod::Return(_)) => 50, + AMQPClass::Basic(basic::AMQPMethod::Deliver(_)) => 60, + AMQPClass::Basic(basic::AMQPMethod::Get(_)) => 70, + AMQPClass::Basic(basic::AMQPMethod::GetOk(_)) => 71, + AMQPClass::Basic(basic::AMQPMethod::GetEmpty(_)) => 72, + AMQPClass::Basic(basic::AMQPMethod::Ack(_)) => 80, + AMQPClass::Basic(basic::AMQPMethod::Reject(_)) => 90, + AMQPClass::Basic(basic::AMQPMethod::RecoverAsync(_)) => 100, + AMQPClass::Basic(basic::AMQPMethod::Recover(_)) => 110, + AMQPClass::Basic(basic::AMQPMethod::RecoverOk(_)) => 111, + AMQPClass::Basic(basic::AMQPMethod::Nack(_)) => 120, AMQPClass::Connection(connection::AMQPMethod::Start(_)) => 10, AMQPClass::Connection(connection::AMQPMethod::StartOk(_)) => 11, AMQPClass::Connection(connection::AMQPMethod::Secure(_)) => 20, @@ -335,24 +353,6 @@ impl AMQPClass { AMQPClass::Queue(queue::AMQPMethod::DeleteOk(_)) => 41, AMQPClass::Queue(queue::AMQPMethod::Unbind(_)) => 50, AMQPClass::Queue(queue::AMQPMethod::UnbindOk(_)) => 51, - AMQPClass::Basic(basic::AMQPMethod::Qos(_)) => 10, - AMQPClass::Basic(basic::AMQPMethod::QosOk(_)) => 11, - AMQPClass::Basic(basic::AMQPMethod::Consume(_)) => 20, - AMQPClass::Basic(basic::AMQPMethod::ConsumeOk(_)) => 21, - AMQPClass::Basic(basic::AMQPMethod::Cancel(_)) => 30, - AMQPClass::Basic(basic::AMQPMethod::CancelOk(_)) => 31, - AMQPClass::Basic(basic::AMQPMethod::Publish(_)) => 40, - AMQPClass::Basic(basic::AMQPMethod::Return(_)) => 50, - AMQPClass::Basic(basic::AMQPMethod::Deliver(_)) => 60, - AMQPClass::Basic(basic::AMQPMethod::Get(_)) => 70, - AMQPClass::Basic(basic::AMQPMethod::GetOk(_)) => 71, - AMQPClass::Basic(basic::AMQPMethod::GetEmpty(_)) => 72, - AMQPClass::Basic(basic::AMQPMethod::Ack(_)) => 80, - AMQPClass::Basic(basic::AMQPMethod::Reject(_)) => 90, - AMQPClass::Basic(basic::AMQPMethod::RecoverAsync(_)) => 100, - AMQPClass::Basic(basic::AMQPMethod::Recover(_)) => 110, - AMQPClass::Basic(basic::AMQPMethod::RecoverOk(_)) => 111, - AMQPClass::Basic(basic::AMQPMethod::Nack(_)) => 120, AMQPClass::Tx(tx::AMQPMethod::Select(_)) => 10, AMQPClass::Tx(tx::AMQPMethod::SelectOk(_)) => 11, AMQPClass::Tx(tx::AMQPMethod::Commit(_)) => 20, @@ -365,74 +365,79 @@ impl AMQPClass { } } -/// connection (generated) -pub mod connection { +/// basic (generated) +pub mod basic { use super::*; - /// Parse connection (Generated) - pub fn parse_connection<I: ParsableInput>(i: I) -> ParserResult<I, connection::AMQPMethod> { + /// Parse basic (Generated) + pub fn parse_basic<I: ParsableInput>(i: I) -> ParserResult<I, basic::AMQPMethod> { context( - "parse_connection", + "parse_basic", map_opt( flat_map(parse_id, |id| { move |i| match id { - 10 => context( - "parse_start", - map(map(parse_start, AMQPMethod::Start), Some), - )(i), + 10 => context("parse_qos", map(map(parse_qos, AMQPMethod::Qos), Some))(i), 11 => context( - "parse_start_ok", - map(map(parse_start_ok, AMQPMethod::StartOk), Some), + "parse_qos_ok", + map(map(parse_qos_ok, AMQPMethod::QosOk), Some), )(i), 20 => context( - "parse_secure", - map(map(parse_secure, AMQPMethod::Secure), Some), + "parse_consume", + map(map(parse_consume, AMQPMethod::Consume), Some), )(i), 21 => context( - "parse_secure_ok", - map(map(parse_secure_ok, AMQPMethod::SecureOk), Some), + "parse_consume_ok", + map(map(parse_consume_ok, AMQPMethod::ConsumeOk), Some), + )(i), + 30 => context( + "parse_cancel", + map(map(parse_cancel, AMQPMethod::Cancel), Some), )(i), - 30 => { - context("parse_tune", map(map(parse_tune, AMQPMethod::Tune), Some))(i) - } 31 => context( - "parse_tune_ok", - map(map(parse_tune_ok, AMQPMethod::TuneOk), Some), + "parse_cancel_ok", + map(map(parse_cancel_ok, AMQPMethod::CancelOk), Some), )(i), - 40 => { - context("parse_open", map(map(parse_open, AMQPMethod::Open), Some))(i) - } - 41 => context( - "parse_open_ok", - map(map(parse_open_ok, AMQPMethod::OpenOk), Some), + 40 => context( + "parse_publish", + map(map(parse_publish, AMQPMethod::Publish), Some), )(i), 50 => context( - "parse_close", - map(map(parse_close, AMQPMethod::Close), Some), - )(i), - 51 => context( - "parse_close_ok", - map(map(parse_close_ok, AMQPMethod::CloseOk), Some), + "parse_return", + map(map(parse_return, AMQPMethod::Return), Some), )(i), 60 => context( - "parse_blocked", - map(map(parse_blocked, AMQPMethod::Blocked), Some), + "parse_deliver", + map(map(parse_deliver, AMQPMethod::Deliver), Some), )(i), - 61 => context( - "parse_unblocked", - map(map(parse_unblocked, AMQPMethod::Unblocked), Some), + 70 => context("parse_get", map(map(parse_get, AMQPMethod::Get), Some))(i), + 71 => context( + "parse_get_ok", + map(map(parse_get_ok, AMQPMethod::GetOk), Some), )(i), - 70 => context( - "parse_update_secret", - map(map(parse_update_secret, AMQPMethod::UpdateSecret), Some), + 72 => context( + "parse_get_empty", + map(map(parse_get_empty, AMQPMethod::GetEmpty), Some), )(i), - 71 => context( - "parse_update_secret_ok", - map( - map(parse_update_secret_ok, AMQPMethod::UpdateSecretOk), - Some, - ), + 80 => context("parse_ack", map(map(parse_ack, AMQPMethod::Ack), Some))(i), + 90 => context( + "parse_reject", + map(map(parse_reject, AMQPMethod::Reject), Some), )(i), + 100 => context( + "parse_recover_async", + map(map(parse_recover_async, AMQPMethod::RecoverAsync), Some), + )(i), + 110 => context( + "parse_recover", + map(map(parse_recover, AMQPMethod::Recover), Some), + )(i), + 111 => context( + "parse_recover_ok", + map(map(parse_recover_ok, AMQPMethod::RecoverOk), Some), + )(i), + 120 => { + context("parse_nack", map(map(parse_nack, AMQPMethod::Nack), Some))(i) + } _ => Ok((i, None)), } }), @@ -441,2211 +446,2016 @@ pub mod connection { )(i) } - /// Serialize connection (Generated) - pub fn gen_connection<'a, W: Write + BackToTheBuffer + 'a>( + /// Serialize basic (Generated) + pub fn gen_basic<'a, W: Write + BackToTheBuffer + 'a>( method: &'a AMQPMethod, ) -> impl SerializeFn<W> + 'a { - cookie_factory::sequence::pair(gen_id(10), move |input| match *method { - AMQPMethod::Start(ref start) => gen_start(start)(input), - AMQPMethod::StartOk(ref start_ok) => gen_start_ok(start_ok)(input), - AMQPMethod::Secure(ref secure) => gen_secure(secure)(input), - AMQPMethod::SecureOk(ref secure_ok) => gen_secure_ok(secure_ok)(input), - AMQPMethod::Tune(ref tune) => gen_tune(tune)(input), - AMQPMethod::TuneOk(ref tune_ok) => gen_tune_ok(tune_ok)(input), - AMQPMethod::Open(ref open) => gen_open(open)(input), - AMQPMethod::OpenOk(ref open_ok) => gen_open_ok(open_ok)(input), - AMQPMethod::Close(ref close) => gen_close(close)(input), - AMQPMethod::CloseOk(ref close_ok) => gen_close_ok(close_ok)(input), - AMQPMethod::Blocked(ref blocked) => gen_blocked(blocked)(input), - AMQPMethod::Unblocked(ref unblocked) => gen_unblocked(unblocked)(input), - AMQPMethod::UpdateSecret(ref update_secret) => gen_update_secret(update_secret)(input), - AMQPMethod::UpdateSecretOk(ref update_secret_ok) => { - gen_update_secret_ok(update_secret_ok)(input) - } + cookie_factory::sequence::pair(gen_id(60), move |input| match *method { + AMQPMethod::Qos(ref qos) => gen_qos(qos)(input), + AMQPMethod::QosOk(ref qos_ok) => gen_qos_ok(qos_ok)(input), + AMQPMethod::Consume(ref consume) => gen_consume(consume)(input), + AMQPMethod::ConsumeOk(ref consume_ok) => gen_consume_ok(consume_ok)(input), + AMQPMethod::Cancel(ref cancel) => gen_cancel(cancel)(input), + AMQPMethod::CancelOk(ref cancel_ok) => gen_cancel_ok(cancel_ok)(input), + AMQPMethod::Publish(ref publish) => gen_publish(publish)(input), + AMQPMethod::Return(ref r#return) => gen_return(r#return)(input), + AMQPMethod::Deliver(ref deliver) => gen_deliver(deliver)(input), + AMQPMethod::Get(ref get) => gen_get(get)(input), + AMQPMethod::GetOk(ref get_ok) => gen_get_ok(get_ok)(input), + AMQPMethod::GetEmpty(ref get_empty) => gen_get_empty(get_empty)(input), + AMQPMethod::Ack(ref ack) => gen_ack(ack)(input), + AMQPMethod::Reject(ref reject) => gen_reject(reject)(input), + AMQPMethod::RecoverAsync(ref recover_async) => gen_recover_async(recover_async)(input), + AMQPMethod::Recover(ref recover) => gen_recover(recover)(input), + AMQPMethod::RecoverOk(ref recover_ok) => gen_recover_ok(recover_ok)(input), + AMQPMethod::Nack(ref nack) => gen_nack(nack)(input), }) } - /// The available methods in connection + /// The available methods in basic #[derive(Clone, Debug, PartialEq)] pub enum AMQPMethod { - /// start (Generated) - Start(Start), - /// start-ok (Generated) - StartOk(StartOk), - /// secure (Generated) - Secure(Secure), - /// secure-ok (Generated) - SecureOk(SecureOk), - /// tune (Generated) - Tune(Tune), - /// tune-ok (Generated) - TuneOk(TuneOk), - /// open (Generated) - Open(Open), - /// open-ok (Generated) - OpenOk(OpenOk), - /// close (Generated) - Close(Close), - /// close-ok (Generated) - CloseOk(CloseOk), - /// blocked (Generated) - Blocked(Blocked), - /// unblocked (Generated) - Unblocked(Unblocked), - /// update-secret (Generated) - UpdateSecret(UpdateSecret), - /// update-secret-ok (Generated) - UpdateSecretOk(UpdateSecretOk), + /// qos (Generated) + Qos(Qos), + /// qos-ok (Generated) + QosOk(QosOk), + /// consume (Generated) + Consume(Consume), + /// consume-ok (Generated) + ConsumeOk(ConsumeOk), + /// cancel (Generated) + Cancel(Cancel), + /// cancel-ok (Generated) + CancelOk(CancelOk), + /// publish (Generated) + Publish(Publish), + /// return (Generated) + Return(Return), + /// deliver (Generated) + Deliver(Deliver), + /// get (Generated) + Get(Get), + /// get-ok (Generated) + GetOk(GetOk), + /// get-empty (Generated) + GetEmpty(GetEmpty), + /// ack (Generated) + Ack(Ack), + /// reject (Generated) + Reject(Reject), + /// recover-async (Generated) + RecoverAsync(RecoverAsync), + /// recover (Generated) + Recover(Recover), + /// recover-ok (Generated) + RecoverOk(RecoverOk), + /// nack (Generated) + Nack(Nack), } - /// start (Generated) + /// qos (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct Start { - /// version-major (Generated) - pub version_major: ShortShortUInt, - /// version-minor (Generated) - pub version_minor: ShortShortUInt, - /// server-properties (Generated) - pub server_properties: FieldTable, - /// mechanisms (Generated) - pub mechanisms: LongString, - /// locales (Generated) - pub locales: LongString, + pub struct Qos { + /// prefetch-count (Generated) + pub prefetch_count: ShortUInt, + /// global (Generated) + pub global: Boolean, } - impl Start { - /// Get the AMQP class id for start (Generated) + impl Qos { + /// Get the AMQP class id for qos (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 10 + 60 } - /// Get the AMQP method id for start (Generated) + /// Get the AMQP method id for qos (Generated) pub fn get_amqp_method_id(&self) -> Identifier { 10 } } - /// Parse start (Generated) - pub fn parse_start<I: ParsableInput>(i: I) -> ParserResult<I, Start> { - let (i, version_major) = parse_short_short_uint(i)?; - let (i, version_minor) = parse_short_short_uint(i)?; - let (i, server_properties) = parse_field_table(i)?; - let (i, mechanisms) = parse_long_string(i)?; - let (i, locales) = parse_long_string(i)?; + /// Parse qos (Generated) + pub fn parse_qos<I: ParsableInput>(i: I) -> ParserResult<I, Qos> { + let (i, _) = parse_long_uint(i)?; + let (i, prefetch_count) = parse_short_uint(i)?; + let (i, flags) = parse_flags(i, &["global"])?; Ok(( i, - Start { - version_major, - version_minor, - server_properties, - mechanisms, - locales, + Qos { + prefetch_count, + global: flags.get_flag("global").unwrap_or(false), }, )) } - /// Serialize start (Generated) - pub fn gen_start<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a Start, + /// Serialize qos (Generated) + pub fn gen_qos<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Qos, ) -> impl SerializeFn<W> + 'a { move |mut input| { + let mut flags = AMQPFlags::default(); + flags.add_flag("global".to_string(), method.global); input = gen_id(10)(input)?; - input = gen_short_short_uint(method.version_major)(input)?; - input = gen_short_short_uint(method.version_minor)(input)?; - input = gen_field_table(&method.server_properties)(input)?; - input = gen_long_string(method.mechanisms.as_bytes())(input)?; - input = gen_long_string(method.locales.as_bytes())(input)?; + input = gen_long_uint(0)(input)?; + input = gen_short_uint(method.prefetch_count)(input)?; + input = gen_flags(&flags)(input)?; Ok(input) } } - /// start-ok (Generated) + /// qos-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct StartOk { - /// client-properties (Generated) - pub client_properties: FieldTable, - /// mechanism (Generated) - pub mechanism: ShortString, - /// response (Generated) - pub response: LongString, - /// locale (Generated) - pub locale: ShortString, - } + pub struct QosOk {} - impl StartOk { - /// Get the AMQP class id for start-ok (Generated) + impl QosOk { + /// Get the AMQP class id for qos-ok (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 10 + 60 } - /// Get the AMQP method id for start-ok (Generated) + /// Get the AMQP method id for qos-ok (Generated) pub fn get_amqp_method_id(&self) -> Identifier { 11 } } - /// Parse start-ok (Generated) - pub fn parse_start_ok<I: ParsableInput>(i: I) -> ParserResult<I, StartOk> { - let (i, client_properties) = parse_field_table(i)?; - let (i, mechanism) = parse_short_string(i)?; - let (i, response) = parse_long_string(i)?; - let (i, locale) = parse_short_string(i)?; - Ok(( - i, - StartOk { - client_properties, - mechanism, - response, - locale, - }, - )) + /// Parse qos-ok (Generated) + pub fn parse_qos_ok<I: ParsableInput>(i: I) -> ParserResult<I, QosOk> { + Ok((i, QosOk {})) } - /// Serialize start-ok (Generated) - pub fn gen_start_ok<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a StartOk, + /// Serialize qos-ok (Generated) + pub fn gen_qos_ok<'a, W: Write + BackToTheBuffer + 'a>( + _: &'a QosOk, ) -> impl SerializeFn<W> + 'a { move |mut input| { input = gen_id(11)(input)?; - input = gen_field_table(&method.client_properties)(input)?; - input = gen_short_string(method.mechanism.as_str())(input)?; - input = gen_long_string(method.response.as_bytes())(input)?; - input = gen_short_string(method.locale.as_str())(input)?; Ok(input) } } - /// secure (Generated) + /// consume (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct Secure { - /// challenge (Generated) - pub challenge: LongString, + pub struct Consume { + /// queue (Generated) + pub queue: ShortString, + /// consumer-tag (Generated) + pub consumer_tag: ShortString, + /// no-local (Generated) + pub no_local: Boolean, + /// no-ack (Generated) + pub no_ack: Boolean, + /// exclusive (Generated) + pub exclusive: Boolean, + /// nowait (Generated) + pub nowait: Boolean, + /// arguments (Generated) + pub arguments: FieldTable, } - impl Secure { - /// Get the AMQP class id for secure (Generated) + impl Consume { + /// Get the AMQP class id for consume (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 10 + 60 } - /// Get the AMQP method id for secure (Generated) + /// Get the AMQP method id for consume (Generated) pub fn get_amqp_method_id(&self) -> Identifier { 20 } } - /// Parse secure (Generated) - pub fn parse_secure<I: ParsableInput>(i: I) -> ParserResult<I, Secure> { - let (i, challenge) = parse_long_string(i)?; - Ok((i, Secure { challenge })) + /// Parse consume (Generated) + pub fn parse_consume<I: ParsableInput>(i: I) -> ParserResult<I, Consume> { + let (i, _) = parse_short_uint(i)?; + let (i, queue) = parse_short_string(i)?; + let (i, consumer_tag) = parse_short_string(i)?; + let (i, flags) = parse_flags(i, &["no-local", "no-ack", "exclusive", "nowait"])?; + let (i, arguments) = parse_field_table(i)?; + Ok(( + i, + Consume { + queue, + consumer_tag, + no_local: flags.get_flag("no_local").unwrap_or(false), + no_ack: flags.get_flag("no_ack").unwrap_or(false), + exclusive: flags.get_flag("exclusive").unwrap_or(false), + nowait: flags.get_flag("nowait").unwrap_or(false), + arguments, + }, + )) } - /// Serialize secure (Generated) - pub fn gen_secure<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a Secure, + /// Serialize consume (Generated) + pub fn gen_consume<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Consume, ) -> impl SerializeFn<W> + 'a { move |mut input| { + let mut flags = AMQPFlags::default(); + flags.add_flag("no_local".to_string(), method.no_local); + flags.add_flag("no_ack".to_string(), method.no_ack); + flags.add_flag("exclusive".to_string(), method.exclusive); + flags.add_flag("nowait".to_string(), method.nowait); input = gen_id(20)(input)?; - input = gen_long_string(method.challenge.as_bytes())(input)?; + input = gen_short_uint(0)(input)?; + input = gen_short_string(method.queue.as_str())(input)?; + input = gen_short_string(method.consumer_tag.as_str())(input)?; + input = gen_flags(&flags)(input)?; + input = gen_field_table(&method.arguments)(input)?; Ok(input) } } - /// secure-ok (Generated) + /// consume-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct SecureOk { - /// response (Generated) - pub response: LongString, + pub struct ConsumeOk { + /// consumer-tag (Generated) + pub consumer_tag: ShortString, } - impl SecureOk { - /// Get the AMQP class id for secure-ok (Generated) + impl ConsumeOk { + /// Get the AMQP class id for consume-ok (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 10 + 60 } - /// Get the AMQP method id for secure-ok (Generated) + /// Get the AMQP method id for consume-ok (Generated) pub fn get_amqp_method_id(&self) -> Identifier { 21 } } - /// Parse secure-ok (Generated) - pub fn parse_secure_ok<I: ParsableInput>(i: I) -> ParserResult<I, SecureOk> { - let (i, response) = parse_long_string(i)?; - Ok((i, SecureOk { response })) + /// Parse consume-ok (Generated) + pub fn parse_consume_ok<I: ParsableInput>(i: I) -> ParserResult<I, ConsumeOk> { + let (i, consumer_tag) = parse_short_string(i)?; + Ok((i, ConsumeOk { consumer_tag })) } - /// Serialize secure-ok (Generated) - pub fn gen_secure_ok<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a SecureOk, + /// Serialize consume-ok (Generated) + pub fn gen_consume_ok<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a ConsumeOk, ) -> impl SerializeFn<W> + 'a { move |mut input| { input = gen_id(21)(input)?; - input = gen_long_string(method.response.as_bytes())(input)?; + input = gen_short_string(method.consumer_tag.as_str())(input)?; Ok(input) } } - /// tune (Generated) + /// cancel (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct Tune { - /// channel-max (Generated) - pub channel_max: ShortUInt, - /// frame-max (Generated) - pub frame_max: LongUInt, - /// heartbeat (Generated) - pub heartbeat: ShortUInt, + pub struct Cancel { + /// consumer-tag (Generated) + pub consumer_tag: ShortString, + /// nowait (Generated) + pub nowait: Boolean, } - impl Tune { - /// Get the AMQP class id for tune (Generated) + impl Cancel { + /// Get the AMQP class id for cancel (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 10 + 60 } - /// Get the AMQP method id for tune (Generated) + /// Get the AMQP method id for cancel (Generated) pub fn get_amqp_method_id(&self) -> Identifier { 30 } } - /// Parse tune (Generated) - pub fn parse_tune<I: ParsableInput>(i: I) -> ParserResult<I, Tune> { - let (i, channel_max) = parse_short_uint(i)?; - let (i, frame_max) = parse_long_uint(i)?; - let (i, heartbeat) = parse_short_uint(i)?; + /// Parse cancel (Generated) + pub fn parse_cancel<I: ParsableInput>(i: I) -> ParserResult<I, Cancel> { + let (i, consumer_tag) = parse_short_string(i)?; + let (i, flags) = parse_flags(i, &["nowait"])?; Ok(( i, - Tune { - channel_max, - frame_max, - heartbeat, + Cancel { + consumer_tag, + nowait: flags.get_flag("nowait").unwrap_or(false), }, )) } - /// Serialize tune (Generated) - pub fn gen_tune<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a Tune, + /// Serialize cancel (Generated) + pub fn gen_cancel<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Cancel, ) -> impl SerializeFn<W> + 'a { move |mut input| { + let mut flags = AMQPFlags::default(); + flags.add_flag("nowait".to_string(), method.nowait); input = gen_id(30)(input)?; - input = gen_short_uint(method.channel_max)(input)?; - input = gen_long_uint(method.frame_max)(input)?; - input = gen_short_uint(method.heartbeat)(input)?; + input = gen_short_string(method.consumer_tag.as_str())(input)?; + input = gen_flags(&flags)(input)?; Ok(input) } } - /// tune-ok (Generated) + /// cancel-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct TuneOk { - /// channel-max (Generated) - pub channel_max: ShortUInt, - /// frame-max (Generated) - pub frame_max: LongUInt, - /// heartbeat (Generated) - pub heartbeat: ShortUInt, + pub struct CancelOk { + /// consumer-tag (Generated) + pub consumer_tag: ShortString, } - impl TuneOk { - /// Get the AMQP class id for tune-ok (Generated) + impl CancelOk { + /// Get the AMQP class id for cancel-ok (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 10 + 60 } - /// Get the AMQP method id for tune-ok (Generated) + /// Get the AMQP method id for cancel-ok (Generated) pub fn get_amqp_method_id(&self) -> Identifier { 31 } } - /// Parse tune-ok (Generated) - pub fn parse_tune_ok<I: ParsableInput>(i: I) -> ParserResult<I, TuneOk> { - let (i, channel_max) = parse_short_uint(i)?; - let (i, frame_max) = parse_long_uint(i)?; - let (i, heartbeat) = parse_short_uint(i)?; - Ok(( - i, - TuneOk { - channel_max, - frame_max, - heartbeat, - }, - )) + /// Parse cancel-ok (Generated) + pub fn parse_cancel_ok<I: ParsableInput>(i: I) -> ParserResult<I, CancelOk> { + let (i, consumer_tag) = parse_short_string(i)?; + Ok((i, CancelOk { consumer_tag })) } - /// Serialize tune-ok (Generated) - pub fn gen_tune_ok<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a TuneOk, + /// Serialize cancel-ok (Generated) + pub fn gen_cancel_ok<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a CancelOk, ) -> impl SerializeFn<W> + 'a { move |mut input| { input = gen_id(31)(input)?; - input = gen_short_uint(method.channel_max)(input)?; - input = gen_long_uint(method.frame_max)(input)?; - input = gen_short_uint(method.heartbeat)(input)?; + input = gen_short_string(method.consumer_tag.as_str())(input)?; Ok(input) } } - /// open (Generated) + /// publish (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct Open { - /// virtual-host (Generated) - pub virtual_host: ShortString, + pub struct Publish { + /// exchange (Generated) + pub exchange: ShortString, + /// routing-key (Generated) + pub routing_key: ShortString, + /// mandatory (Generated) + pub mandatory: Boolean, + /// immediate (Generated) + pub immediate: Boolean, } - impl Open { - /// Get the AMQP class id for open (Generated) + impl Publish { + /// Get the AMQP class id for publish (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 10 + 60 } - /// Get the AMQP method id for open (Generated) + /// Get the AMQP method id for publish (Generated) pub fn get_amqp_method_id(&self) -> Identifier { 40 } } - /// Parse open (Generated) - pub fn parse_open<I: ParsableInput>(i: I) -> ParserResult<I, Open> { - let (i, virtual_host) = parse_short_string(i)?; - let (i, _) = parse_short_string(i)?; - let (i, _) = parse_flags(i, &["insist"])?; - Ok((i, Open { virtual_host })) + /// Parse publish (Generated) + pub fn parse_publish<I: ParsableInput>(i: I) -> ParserResult<I, Publish> { + let (i, _) = parse_short_uint(i)?; + let (i, exchange) = parse_short_string(i)?; + let (i, routing_key) = parse_short_string(i)?; + let (i, flags) = parse_flags(i, &["mandatory", "immediate"])?; + Ok(( + i, + Publish { + exchange, + routing_key, + mandatory: flags.get_flag("mandatory").unwrap_or(false), + immediate: flags.get_flag("immediate").unwrap_or(false), + }, + )) } - /// Serialize open (Generated) - pub fn gen_open<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a Open, + /// Serialize publish (Generated) + pub fn gen_publish<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Publish, ) -> impl SerializeFn<W> + 'a { move |mut input| { let mut flags = AMQPFlags::default(); - flags.add_flag("insist".to_string(), false); + flags.add_flag("mandatory".to_string(), method.mandatory); + flags.add_flag("immediate".to_string(), method.immediate); input = gen_id(40)(input)?; - input = gen_short_string(method.virtual_host.as_str())(input)?; - input = gen_short_string("")(input)?; + input = gen_short_uint(0)(input)?; + input = gen_short_string(method.exchange.as_str())(input)?; + input = gen_short_string(method.routing_key.as_str())(input)?; input = gen_flags(&flags)(input)?; Ok(input) } } - /// open-ok (Generated) - #[derive(Clone, Debug, Default, PartialEq)] - pub struct OpenOk {} - - impl OpenOk { - /// Get the AMQP class id for open-ok (Generated) - pub fn get_amqp_class_id(&self) -> Identifier { - 10 - } - - /// Get the AMQP method id for open-ok (Generated) - pub fn get_amqp_method_id(&self) -> Identifier { - 41 - } - } - - /// Parse open-ok (Generated) - pub fn parse_open_ok<I: ParsableInput>(i: I) -> ParserResult<I, OpenOk> { - let (i, _) = parse_short_string(i)?; - Ok((i, OpenOk {})) - } - - /// Serialize open-ok (Generated) - pub fn gen_open_ok<'a, W: Write + BackToTheBuffer + 'a>( - _method: &'a OpenOk, - ) -> impl SerializeFn<W> + 'a { - move |mut input| { - input = gen_id(41)(input)?; - input = gen_short_string("")(input)?; - Ok(input) - } - } - /// close (Generated) + /// return (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct Close { + pub struct Return { /// reply-code (Generated) pub reply_code: ShortUInt, /// reply-text (Generated) pub reply_text: ShortString, - /// class-id (Generated) - pub class_id: ShortUInt, - /// method-id (Generated) - pub method_id: ShortUInt, + /// exchange (Generated) + pub exchange: ShortString, + /// routing-key (Generated) + pub routing_key: ShortString, } - impl Close { - /// Get the AMQP class id for close (Generated) + impl Return { + /// Get the AMQP class id for return (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 10 + 60 } - /// Get the AMQP method id for close (Generated) + /// Get the AMQP method id for return (Generated) pub fn get_amqp_method_id(&self) -> Identifier { 50 } } - /// Parse close (Generated) - pub fn parse_close<I: ParsableInput>(i: I) -> ParserResult<I, Close> { + /// Parse return (Generated) + pub fn parse_return<I: ParsableInput>(i: I) -> ParserResult<I, Return> { let (i, reply_code) = parse_short_uint(i)?; let (i, reply_text) = parse_short_string(i)?; - let (i, class_id) = parse_short_uint(i)?; - let (i, method_id) = parse_short_uint(i)?; + let (i, exchange) = parse_short_string(i)?; + let (i, routing_key) = parse_short_string(i)?; Ok(( i, - Close { + Return { reply_code, reply_text, - class_id, - method_id, + exchange, + routing_key, }, )) } - /// Serialize close (Generated) - pub fn gen_close<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a Close, + /// Serialize return (Generated) + pub fn gen_return<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Return, ) -> impl SerializeFn<W> + 'a { move |mut input| { input = gen_id(50)(input)?; input = gen_short_uint(method.reply_code)(input)?; input = gen_short_string(method.reply_text.as_str())(input)?; - input = gen_short_uint(method.class_id)(input)?; - input = gen_short_uint(method.method_id)(input)?; + input = gen_short_string(method.exchange.as_str())(input)?; + input = gen_short_string(method.routing_key.as_str())(input)?; Ok(input) } } - /// close-ok (Generated) + /// deliver (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct CloseOk {} + pub struct Deliver { + /// consumer-tag (Generated) + pub consumer_tag: ShortString, + /// delivery-tag (Generated) + pub delivery_tag: LongLongUInt, + /// redelivered (Generated) + pub redelivered: Boolean, + /// exchange (Generated) + pub exchange: ShortString, + /// routing-key (Generated) + pub routing_key: ShortString, + } - impl CloseOk { - /// Get the AMQP class id for close-ok (Generated) + impl Deliver { + /// Get the AMQP class id for deliver (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 10 + 60 } - /// Get the AMQP method id for close-ok (Generated) + /// Get the AMQP method id for deliver (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 51 + 60 } } - /// Parse close-ok (Generated) - pub fn parse_close_ok<I: ParsableInput>(i: I) -> ParserResult<I, CloseOk> { - Ok((i, CloseOk {})) + /// Parse deliver (Generated) + pub fn parse_deliver<I: ParsableInput>(i: I) -> ParserResult<I, Deliver> { + let (i, consumer_tag) = parse_short_string(i)?; + let (i, delivery_tag) = parse_long_long_uint(i)?; + let (i, flags) = parse_flags(i, &["redelivered"])?; + let (i, exchange) = parse_short_string(i)?; + let (i, routing_key) = parse_short_string(i)?; + Ok(( + i, + Deliver { + consumer_tag, + delivery_tag, + redelivered: flags.get_flag("redelivered").unwrap_or(false), + exchange, + routing_key, + }, + )) } - /// Serialize close-ok (Generated) - pub fn gen_close_ok<'a, W: Write + BackToTheBuffer + 'a>( - _: &'a CloseOk, + /// Serialize deliver (Generated) + pub fn gen_deliver<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Deliver, ) -> impl SerializeFn<W> + 'a { move |mut input| { - input = gen_id(51)(input)?; + let mut flags = AMQPFlags::default(); + flags.add_flag("redelivered".to_string(), method.redelivered); + input = gen_id(60)(input)?; + input = gen_short_string(method.consumer_tag.as_str())(input)?; + input = gen_long_long_uint(method.delivery_tag)(input)?; + input = gen_flags(&flags)(input)?; + input = gen_short_string(method.exchange.as_str())(input)?; + input = gen_short_string(method.routing_key.as_str())(input)?; Ok(input) } } - /// blocked (Generated) + /// get (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct Blocked { - /// reason (Generated) - pub reason: ShortString, + pub struct Get { + /// queue (Generated) + pub queue: ShortString, + /// no-ack (Generated) + pub no_ack: Boolean, } - impl Blocked { - /// Get the AMQP class id for blocked (Generated) + impl Get { + /// Get the AMQP class id for get (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 10 + 60 } - /// Get the AMQP method id for blocked (Generated) + /// Get the AMQP method id for get (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 60 + 70 } } - /// Parse blocked (Generated) - pub fn parse_blocked<I: ParsableInput>(i: I) -> ParserResult<I, Blocked> { - let (i, reason) = parse_short_string(i)?; - Ok((i, Blocked { reason })) + /// Parse get (Generated) + pub fn parse_get<I: ParsableInput>(i: I) -> ParserResult<I, Get> { + let (i, _) = parse_short_uint(i)?; + let (i, queue) = parse_short_string(i)?; + let (i, flags) = parse_flags(i, &["no-ack"])?; + Ok(( + i, + Get { + queue, + no_ack: flags.get_flag("no_ack").unwrap_or(false), + }, + )) } - /// Serialize blocked (Generated) - pub fn gen_blocked<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a Blocked, + /// Serialize get (Generated) + pub fn gen_get<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Get, ) -> impl SerializeFn<W> + 'a { move |mut input| { - input = gen_id(60)(input)?; - input = gen_short_string(method.reason.as_str())(input)?; + let mut flags = AMQPFlags::default(); + flags.add_flag("no_ack".to_string(), method.no_ack); + input = gen_id(70)(input)?; + input = gen_short_uint(0)(input)?; + input = gen_short_string(method.queue.as_str())(input)?; + input = gen_flags(&flags)(input)?; Ok(input) } } - /// unblocked (Generated) + /// get-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct Unblocked {} + pub struct GetOk { + /// delivery-tag (Generated) + pub delivery_tag: LongLongUInt, + /// redelivered (Generated) + pub redelivered: Boolean, + /// exchange (Generated) + pub exchange: ShortString, + /// routing-key (Generated) + pub routing_key: ShortString, + /// message-count (Generated) + pub message_count: LongUInt, + } - impl Unblocked { - /// Get the AMQP class id for unblocked (Generated) + impl GetOk { + /// Get the AMQP class id for get-ok (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 10 + 60 } - /// Get the AMQP method id for unblocked (Generated) + /// Get the AMQP method id for get-ok (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 61 + 71 } } - /// Parse unblocked (Generated) - pub fn parse_unblocked<I: ParsableInput>(i: I) -> ParserResult<I, Unblocked> { - Ok((i, Unblocked {})) + /// Parse get-ok (Generated) + pub fn parse_get_ok<I: ParsableInput>(i: I) -> ParserResult<I, GetOk> { + let (i, delivery_tag) = parse_long_long_uint(i)?; + let (i, flags) = parse_flags(i, &["redelivered"])?; + let (i, exchange) = parse_short_string(i)?; + let (i, routing_key) = parse_short_string(i)?; + let (i, message_count) = parse_long_uint(i)?; + Ok(( + i, + GetOk { + delivery_tag, + redelivered: flags.get_flag("redelivered").unwrap_or(false), + exchange, + routing_key, + message_count, + }, + )) } - /// Serialize unblocked (Generated) - pub fn gen_unblocked<'a, W: Write + BackToTheBuffer + 'a>( - _: &'a Unblocked, + /// Serialize get-ok (Generated) + pub fn gen_get_ok<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a GetOk, ) -> impl SerializeFn<W> + 'a { move |mut input| { - input = gen_id(61)(input)?; + let mut flags = AMQPFlags::default(); + flags.add_flag("redelivered".to_string(), method.redelivered); + input = gen_id(71)(input)?; + input = gen_long_long_uint(method.delivery_tag)(input)?; + input = gen_flags(&flags)(input)?; + input = gen_short_string(method.exchange.as_str())(input)?; + input = gen_short_string(method.routing_key.as_str())(input)?; + input = gen_long_uint(method.message_count)(input)?; Ok(input) } } - /// update-secret (Generated) + /// get-empty (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct UpdateSecret { - /// new-secret (Generated) - pub new_secret: LongString, - /// reason (Generated) - pub reason: ShortString, - } + pub struct GetEmpty {} - impl UpdateSecret { - /// Get the AMQP class id for update-secret (Generated) + impl GetEmpty { + /// Get the AMQP class id for get-empty (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 10 + 60 } - /// Get the AMQP method id for update-secret (Generated) + /// Get the AMQP method id for get-empty (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 70 + 72 } } - /// Parse update-secret (Generated) - pub fn parse_update_secret<I: ParsableInput>(i: I) -> ParserResult<I, UpdateSecret> { - let (i, new_secret) = parse_long_string(i)?; - let (i, reason) = parse_short_string(i)?; - Ok((i, UpdateSecret { new_secret, reason })) + /// Parse get-empty (Generated) + pub fn parse_get_empty<I: ParsableInput>(i: I) -> ParserResult<I, GetEmpty> { + let (i, _) = parse_short_string(i)?; + Ok((i, GetEmpty {})) } - /// Serialize update-secret (Generated) - pub fn gen_update_secret<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a UpdateSecret, + /// Serialize get-empty (Generated) + pub fn gen_get_empty<'a, W: Write + BackToTheBuffer + 'a>( + _method: &'a GetEmpty, ) -> impl SerializeFn<W> + 'a { move |mut input| { - input = gen_id(70)(input)?; - input = gen_long_string(method.new_secret.as_bytes())(input)?; - input = gen_short_string(method.reason.as_str())(input)?; + input = gen_id(72)(input)?; + input = gen_short_string("")(input)?; Ok(input) } } - /// update-secret-ok (Generated) + /// ack (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct UpdateSecretOk {} + pub struct Ack { + /// delivery-tag (Generated) + pub delivery_tag: LongLongUInt, + /// multiple (Generated) + pub multiple: Boolean, + } - impl UpdateSecretOk { - /// Get the AMQP class id for update-secret-ok (Generated) + impl Ack { + /// Get the AMQP class id for ack (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 10 + 60 } - /// Get the AMQP method id for update-secret-ok (Generated) + /// Get the AMQP method id for ack (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 71 + 80 } } - /// Parse update-secret-ok (Generated) - pub fn parse_update_secret_ok<I: ParsableInput>(i: I) -> ParserResult<I, UpdateSecretOk> { - Ok((i, UpdateSecretOk {})) + /// Parse ack (Generated) + pub fn parse_ack<I: ParsableInput>(i: I) -> ParserResult<I, Ack> { + let (i, delivery_tag) = parse_long_long_uint(i)?; + let (i, flags) = parse_flags(i, &["multiple"])?; + Ok(( + i, + Ack { + delivery_tag, + multiple: flags.get_flag("multiple").unwrap_or(false), + }, + )) } - /// Serialize update-secret-ok (Generated) - pub fn gen_update_secret_ok<'a, W: Write + BackToTheBuffer + 'a>( - _: &'a UpdateSecretOk, + /// Serialize ack (Generated) + pub fn gen_ack<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Ack, ) -> impl SerializeFn<W> + 'a { move |mut input| { - input = gen_id(71)(input)?; + let mut flags = AMQPFlags::default(); + flags.add_flag("multiple".to_string(), method.multiple); + input = gen_id(80)(input)?; + input = gen_long_long_uint(method.delivery_tag)(input)?; + input = gen_flags(&flags)(input)?; Ok(input) } } -} -/// channel (generated) -pub mod channel { - use super::*; - - /// Parse channel (Generated) - pub fn parse_channel<I: ParsableInput>(i: I) -> ParserResult<I, channel::AMQPMethod> { - context( - "parse_channel", - map_opt( - flat_map(parse_id, |id| { - move |i| match id { - 10 => { - context("parse_open", map(map(parse_open, AMQPMethod::Open), Some))(i) - } - 11 => context( - "parse_open_ok", - map(map(parse_open_ok, AMQPMethod::OpenOk), Some), - )(i), - 20 => { - context("parse_flow", map(map(parse_flow, AMQPMethod::Flow), Some))(i) - } - 21 => context( - "parse_flow_ok", - map(map(parse_flow_ok, AMQPMethod::FlowOk), Some), - )(i), - 40 => context( - "parse_close", - map(map(parse_close, AMQPMethod::Close), Some), - )(i), - 41 => context( - "parse_close_ok", - map(map(parse_close_ok, AMQPMethod::CloseOk), Some), - )(i), - _ => Ok((i, None)), - } - }), - std::convert::identity, - ), - )(i) + /// reject (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Reject { + /// delivery-tag (Generated) + pub delivery_tag: LongLongUInt, + /// requeue (Generated) + pub requeue: Boolean, } - /// Serialize channel (Generated) - pub fn gen_channel<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a AMQPMethod, - ) -> impl SerializeFn<W> + 'a { - cookie_factory::sequence::pair(gen_id(20), move |input| match *method { - AMQPMethod::Open(ref open) => gen_open(open)(input), - AMQPMethod::OpenOk(ref open_ok) => gen_open_ok(open_ok)(input), - AMQPMethod::Flow(ref flow) => gen_flow(flow)(input), - AMQPMethod::FlowOk(ref flow_ok) => gen_flow_ok(flow_ok)(input), - AMQPMethod::Close(ref close) => gen_close(close)(input), - AMQPMethod::CloseOk(ref close_ok) => gen_close_ok(close_ok)(input), - }) + impl Reject { + /// Get the AMQP class id for reject (Generated) + pub fn get_amqp_class_id(&self) -> Identifier { + 60 + } + + /// Get the AMQP method id for reject (Generated) + pub fn get_amqp_method_id(&self) -> Identifier { + 90 + } } - /// The available methods in channel - #[derive(Clone, Debug, PartialEq)] - pub enum AMQPMethod { - /// open (Generated) - Open(Open), - /// open-ok (Generated) - OpenOk(OpenOk), - /// flow (Generated) - Flow(Flow), - /// flow-ok (Generated) - FlowOk(FlowOk), - /// close (Generated) - Close(Close), - /// close-ok (Generated) - CloseOk(CloseOk), - } - - /// open (Generated) - #[derive(Clone, Debug, Default, PartialEq)] - pub struct Open {} - - impl Open { - /// Get the AMQP class id for open (Generated) - pub fn get_amqp_class_id(&self) -> Identifier { - 20 - } - - /// Get the AMQP method id for open (Generated) - pub fn get_amqp_method_id(&self) -> Identifier { - 10 - } - } - - /// Parse open (Generated) - pub fn parse_open<I: ParsableInput>(i: I) -> ParserResult<I, Open> { - let (i, _) = parse_short_string(i)?; - Ok((i, Open {})) + /// Parse reject (Generated) + pub fn parse_reject<I: ParsableInput>(i: I) -> ParserResult<I, Reject> { + let (i, delivery_tag) = parse_long_long_uint(i)?; + let (i, flags) = parse_flags(i, &["requeue"])?; + Ok(( + i, + Reject { + delivery_tag, + requeue: flags.get_flag("requeue").unwrap_or(false), + }, + )) } - /// Serialize open (Generated) - pub fn gen_open<'a, W: Write + BackToTheBuffer + 'a>( - _method: &'a Open, + /// Serialize reject (Generated) + pub fn gen_reject<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Reject, ) -> impl SerializeFn<W> + 'a { move |mut input| { - input = gen_id(10)(input)?; - input = gen_short_string("")(input)?; + let mut flags = AMQPFlags::default(); + flags.add_flag("requeue".to_string(), method.requeue); + input = gen_id(90)(input)?; + input = gen_long_long_uint(method.delivery_tag)(input)?; + input = gen_flags(&flags)(input)?; Ok(input) } } - /// open-ok (Generated) + /// recover-async (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct OpenOk {} + pub struct RecoverAsync { + /// requeue (Generated) + pub requeue: Boolean, + } - impl OpenOk { - /// Get the AMQP class id for open-ok (Generated) + impl RecoverAsync { + /// Get the AMQP class id for recover-async (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 20 + 60 } - /// Get the AMQP method id for open-ok (Generated) + /// Get the AMQP method id for recover-async (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 11 + 100 } } - /// Parse open-ok (Generated) - pub fn parse_open_ok<I: ParsableInput>(i: I) -> ParserResult<I, OpenOk> { - let (i, _) = parse_long_string(i)?; - Ok((i, OpenOk {})) + /// Parse recover-async (Generated) + pub fn parse_recover_async<I: ParsableInput>(i: I) -> ParserResult<I, RecoverAsync> { + let (i, flags) = parse_flags(i, &["requeue"])?; + Ok(( + i, + RecoverAsync { + requeue: flags.get_flag("requeue").unwrap_or(false), + }, + )) } - /// Serialize open-ok (Generated) - pub fn gen_open_ok<'a, W: Write + BackToTheBuffer + 'a>( - _method: &'a OpenOk, + /// Serialize recover-async (Generated) + pub fn gen_recover_async<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a RecoverAsync, ) -> impl SerializeFn<W> + 'a { move |mut input| { - input = gen_id(11)(input)?; - input = gen_long_string(b"")(input)?; + let mut flags = AMQPFlags::default(); + flags.add_flag("requeue".to_string(), method.requeue); + input = gen_id(100)(input)?; + input = gen_flags(&flags)(input)?; Ok(input) } } - /// flow (Generated) + /// recover (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct Flow { - /// active (Generated) - pub active: Boolean, + pub struct Recover { + /// requeue (Generated) + pub requeue: Boolean, } - impl Flow { - /// Get the AMQP class id for flow (Generated) + impl Recover { + /// Get the AMQP class id for recover (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 20 + 60 } - /// Get the AMQP method id for flow (Generated) + /// Get the AMQP method id for recover (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 20 + 110 } } - /// Parse flow (Generated) - pub fn parse_flow<I: ParsableInput>(i: I) -> ParserResult<I, Flow> { - let (i, flags) = parse_flags(i, &["active"])?; + /// Parse recover (Generated) + pub fn parse_recover<I: ParsableInput>(i: I) -> ParserResult<I, Recover> { + let (i, flags) = parse_flags(i, &["requeue"])?; Ok(( i, - Flow { - active: flags.get_flag("active").unwrap_or(false), + Recover { + requeue: flags.get_flag("requeue").unwrap_or(false), }, )) } - /// Serialize flow (Generated) - pub fn gen_flow<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a Flow, + /// Serialize recover (Generated) + pub fn gen_recover<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Recover, ) -> impl SerializeFn<W> + 'a { move |mut input| { let mut flags = AMQPFlags::default(); - flags.add_flag("active".to_string(), method.active); - input = gen_id(20)(input)?; + flags.add_flag("requeue".to_string(), method.requeue); + input = gen_id(110)(input)?; input = gen_flags(&flags)(input)?; Ok(input) } } - /// flow-ok (Generated) + /// recover-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct FlowOk { - /// active (Generated) - pub active: Boolean, - } + pub struct RecoverOk {} - impl FlowOk { - /// Get the AMQP class id for flow-ok (Generated) + impl RecoverOk { + /// Get the AMQP class id for recover-ok (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 20 + 60 } - /// Get the AMQP method id for flow-ok (Generated) + /// Get the AMQP method id for recover-ok (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 21 + 111 } } - /// Parse flow-ok (Generated) - pub fn parse_flow_ok<I: ParsableInput>(i: I) -> ParserResult<I, FlowOk> { - let (i, flags) = parse_flags(i, &["active"])?; - Ok(( - i, - FlowOk { - active: flags.get_flag("active").unwrap_or(false), - }, - )) + /// Parse recover-ok (Generated) + pub fn parse_recover_ok<I: ParsableInput>(i: I) -> ParserResult<I, RecoverOk> { + Ok((i, RecoverOk {})) } - /// Serialize flow-ok (Generated) - pub fn gen_flow_ok<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a FlowOk, + /// Serialize recover-ok (Generated) + pub fn gen_recover_ok<'a, W: Write + BackToTheBuffer + 'a>( + _: &'a RecoverOk, ) -> impl SerializeFn<W> + 'a { move |mut input| { - let mut flags = AMQPFlags::default(); - flags.add_flag("active".to_string(), method.active); - input = gen_id(21)(input)?; - input = gen_flags(&flags)(input)?; + input = gen_id(111)(input)?; Ok(input) } } - /// close (Generated) + /// nack (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct Close { - /// reply-code (Generated) - pub reply_code: ShortUInt, - /// reply-text (Generated) - pub reply_text: ShortString, - /// class-id (Generated) - pub class_id: ShortUInt, - /// method-id (Generated) - pub method_id: ShortUInt, + pub struct Nack { + /// delivery-tag (Generated) + pub delivery_tag: LongLongUInt, + /// multiple (Generated) + pub multiple: Boolean, + /// requeue (Generated) + pub requeue: Boolean, } - impl Close { - /// Get the AMQP class id for close (Generated) + impl Nack { + /// Get the AMQP class id for nack (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 20 + 60 } - /// Get the AMQP method id for close (Generated) + /// Get the AMQP method id for nack (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 40 + 120 } } - /// Parse close (Generated) - pub fn parse_close<I: ParsableInput>(i: I) -> ParserResult<I, Close> { - let (i, reply_code) = parse_short_uint(i)?; - let (i, reply_text) = parse_short_string(i)?; - let (i, class_id) = parse_short_uint(i)?; - let (i, method_id) = parse_short_uint(i)?; + /// Parse nack (Generated) + pub fn parse_nack<I: ParsableInput>(i: I) -> ParserResult<I, Nack> { + let (i, delivery_tag) = parse_long_long_uint(i)?; + let (i, flags) = parse_flags(i, &["multiple", "requeue"])?; Ok(( i, - Close { - reply_code, - reply_text, - class_id, - method_id, + Nack { + delivery_tag, + multiple: flags.get_flag("multiple").unwrap_or(false), + requeue: flags.get_flag("requeue").unwrap_or(false), }, )) } - /// Serialize close (Generated) - pub fn gen_close<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a Close, + /// Serialize nack (Generated) + pub fn gen_nack<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Nack, ) -> impl SerializeFn<W> + 'a { move |mut input| { - input = gen_id(40)(input)?; - input = gen_short_uint(method.reply_code)(input)?; - input = gen_short_string(method.reply_text.as_str())(input)?; - input = gen_short_uint(method.class_id)(input)?; - input = gen_short_uint(method.method_id)(input)?; + let mut flags = AMQPFlags::default(); + flags.add_flag("multiple".to_string(), method.multiple); + flags.add_flag("requeue".to_string(), method.requeue); + input = gen_id(120)(input)?; + input = gen_long_long_uint(method.delivery_tag)(input)?; + input = gen_flags(&flags)(input)?; Ok(input) } } - /// close-ok (Generated) + /// basic properties (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct CloseOk {} + pub struct AMQPProperties { + content_type: Option<ShortString>, + content_encoding: Option<ShortString>, + headers: Option<FieldTable>, + delivery_mode: Option<ShortShortUInt>, + priority: Option<ShortShortUInt>, + correlation_id: Option<ShortString>, + reply_to: Option<ShortString>, + expiration: Option<ShortString>, + message_id: Option<ShortString>, + timestamp: Option<Timestamp>, + kind: Option<ShortString>, + user_id: Option<ShortString>, + app_id: Option<ShortString>, + cluster_id: Option<ShortString>, + } - impl CloseOk { - /// Get the AMQP class id for close-ok (Generated) - pub fn get_amqp_class_id(&self) -> Identifier { - 20 + impl AMQPProperties { + /// Set content-type (Generated) + pub fn with_content_type(mut self, value: ShortString) -> AMQPProperties { + self.content_type = Some(value); + self } - - /// Get the AMQP method id for close-ok (Generated) - pub fn get_amqp_method_id(&self) -> Identifier { - 41 + /// Set content-encoding (Generated) + pub fn with_content_encoding(mut self, value: ShortString) -> AMQPProperties { + self.content_encoding = Some(value); + self } - } - - /// Parse close-ok (Generated) - pub fn parse_close_ok<I: ParsableInput>(i: I) -> ParserResult<I, CloseOk> { - Ok((i, CloseOk {})) - } - - /// Serialize close-ok (Generated) - pub fn gen_close_ok<'a, W: Write + BackToTheBuffer + 'a>( - _: &'a CloseOk, - ) -> impl SerializeFn<W> + 'a { - move |mut input| { - input = gen_id(41)(input)?; - Ok(input) + /// Set headers (Generated) + pub fn with_headers(mut self, value: FieldTable) -> AMQPProperties { + self.headers = Some(value); + self } - } -} -/// access (generated) -pub mod access { - use super::*; - - /// Parse access (Generated) - pub fn parse_access<I: ParsableInput>(i: I) -> ParserResult<I, access::AMQPMethod> { - context( - "parse_access", - map_opt( - flat_map(parse_id, |id| { - move |i| match id { - 10 => context( - "parse_request", - map(map(parse_request, AMQPMethod::Request), Some), - )(i), - 11 => context( - "parse_request_ok", - map(map(parse_request_ok, AMQPMethod::RequestOk), Some), - )(i), - _ => Ok((i, None)), - } - }), - std::convert::identity, - ), - )(i) - } - - /// Serialize access (Generated) - pub fn gen_access<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a AMQPMethod, - ) -> impl SerializeFn<W> + 'a { - cookie_factory::sequence::pair(gen_id(30), move |input| match *method { - AMQPMethod::Request(ref request) => gen_request(request)(input), - AMQPMethod::RequestOk(ref request_ok) => gen_request_ok(request_ok)(input), - }) - } - - /// The available methods in access - #[derive(Clone, Debug, PartialEq)] - pub enum AMQPMethod { - /// request (Generated) - Request(Request), - /// request-ok (Generated) - RequestOk(RequestOk), - } - - /// request (Generated) - #[derive(Clone, Debug, Default, PartialEq)] - pub struct Request { - /// realm (Generated) - pub realm: ShortString, - /// exclusive (Generated) - pub exclusive: Boolean, - /// passive (Generated) - pub passive: Boolean, - /// active (Generated) - pub active: Boolean, - /// write (Generated) - pub write: Boolean, - /// read (Generated) - pub read: Boolean, - } - - impl Request { - /// Get the AMQP class id for request (Generated) - pub fn get_amqp_class_id(&self) -> Identifier { - 30 + /// Set delivery-mode (Generated) + pub fn with_delivery_mode(mut self, value: ShortShortUInt) -> AMQPProperties { + self.delivery_mode = Some(value); + self } - - /// Get the AMQP method id for request (Generated) - pub fn get_amqp_method_id(&self) -> Identifier { - 10 + /// Set priority (Generated) + pub fn with_priority(mut self, value: ShortShortUInt) -> AMQPProperties { + self.priority = Some(value); + self } - } - - /// Parse request (Generated) - pub fn parse_request<I: ParsableInput>(i: I) -> ParserResult<I, Request> { - let (i, realm) = parse_short_string(i)?; - let (i, flags) = parse_flags(i, &["exclusive", "passive", "active", "write", "read"])?; - Ok(( - i, - Request { - realm, - exclusive: flags.get_flag("exclusive").unwrap_or(false), - passive: flags.get_flag("passive").unwrap_or(false), - active: flags.get_flag("active").unwrap_or(false), - write: flags.get_flag("write").unwrap_or(false), - read: flags.get_flag("read").unwrap_or(false), - }, - )) - } - - /// Serialize request (Generated) - pub fn gen_request<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a Request, - ) -> impl SerializeFn<W> + 'a { - move |mut input| { - let mut flags = AMQPFlags::default(); - flags.add_flag("exclusive".to_string(), method.exclusive); - flags.add_flag("passive".to_string(), method.passive); - flags.add_flag("active".to_string(), method.active); - flags.add_flag("write".to_string(), method.write); - flags.add_flag("read".to_string(), method.read); - input = gen_id(10)(input)?; - input = gen_short_string(method.realm.as_str())(input)?; - input = gen_flags(&flags)(input)?; - Ok(input) + /// Set correlation-id (Generated) + pub fn with_correlation_id(mut self, value: ShortString) -> AMQPProperties { + self.correlation_id = Some(value); + self } - } - /// request-ok (Generated) - #[derive(Clone, Debug, Default, PartialEq)] - pub struct RequestOk {} - - impl RequestOk { - /// Get the AMQP class id for request-ok (Generated) - pub fn get_amqp_class_id(&self) -> Identifier { - 30 + /// Set reply-to (Generated) + pub fn with_reply_to(mut self, value: ShortString) -> AMQPProperties { + self.reply_to = Some(value); + self } - - /// Get the AMQP method id for request-ok (Generated) - pub fn get_amqp_method_id(&self) -> Identifier { - 11 + /// Set expiration (Generated) + pub fn with_expiration(mut self, value: ShortString) -> AMQPProperties { + self.expiration = Some(value); + self } - } - - /// Parse request-ok (Generated) - pub fn parse_request_ok<I: ParsableInput>(i: I) -> ParserResult<I, RequestOk> { - let (i, _) = parse_short_uint(i)?; - Ok((i, RequestOk {})) - } - - /// Serialize request-ok (Generated) - pub fn gen_request_ok<'a, W: Write + BackToTheBuffer + 'a>( - _method: &'a RequestOk, - ) -> impl SerializeFn<W> + 'a { - move |mut input| { - input = gen_id(11)(input)?; - input = gen_short_uint(1)(input)?; - Ok(input) + /// Set message-id (Generated) + pub fn with_message_id(mut self, value: ShortString) -> AMQPProperties { + self.message_id = Some(value); + self } - } -} -/// exchange (generated) -pub mod exchange { - use super::*; - - /// Parse exchange (Generated) - pub fn parse_exchange<I: ParsableInput>(i: I) -> ParserResult<I, exchange::AMQPMethod> { - context( - "parse_exchange", - map_opt( - flat_map(parse_id, |id| { - move |i| match id { - 10 => context( - "parse_declare", - map(map(parse_declare, AMQPMethod::Declare), Some), - )(i), - 11 => context( - "parse_declare_ok", - map(map(parse_declare_ok, AMQPMethod::DeclareOk), Some), - )(i), - 20 => context( - "parse_delete", - map(map(parse_delete, AMQPMethod::Delete), Some), - )(i), - 21 => context( - "parse_delete_ok", - map(map(parse_delete_ok, AMQPMethod::DeleteOk), Some), - )(i), - 30 => { - context("parse_bind", map(map(parse_bind, AMQPMethod::Bind), Some))(i) - } - 31 => context( - "parse_bind_ok", - map(map(parse_bind_ok, AMQPMethod::BindOk), Some), - )(i), - 40 => context( - "parse_unbind", - map(map(parse_unbind, AMQPMethod::Unbind), Some), - )(i), - 51 => context( - "parse_unbind_ok", - map(map(parse_unbind_ok, AMQPMethod::UnbindOk), Some), - )(i), - _ => Ok((i, None)), - } - }), - std::convert::identity, - ), - )(i) - } - - /// Serialize exchange (Generated) - pub fn gen_exchange<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a AMQPMethod, - ) -> impl SerializeFn<W> + 'a { - cookie_factory::sequence::pair(gen_id(40), move |input| match *method { - AMQPMethod::Declare(ref declare) => gen_declare(declare)(input), - AMQPMethod::DeclareOk(ref declare_ok) => gen_declare_ok(declare_ok)(input), - AMQPMethod::Delete(ref delete) => gen_delete(delete)(input), - AMQPMethod::DeleteOk(ref delete_ok) => gen_delete_ok(delete_ok)(input), - AMQPMethod::Bind(ref bind) => gen_bind(bind)(input), - AMQPMethod::BindOk(ref bind_ok) => gen_bind_ok(bind_ok)(input), - AMQPMethod::Unbind(ref unbind) => gen_unbind(unbind)(input), - AMQPMethod::UnbindOk(ref unbind_ok) => gen_unbind_ok(unbind_ok)(input), - }) - } - - /// The available methods in exchange - #[derive(Clone, Debug, PartialEq)] - pub enum AMQPMethod { - /// declare (Generated) - Declare(Declare), - /// declare-ok (Generated) - DeclareOk(DeclareOk), - /// delete (Generated) - Delete(Delete), - /// delete-ok (Generated) - DeleteOk(DeleteOk), - /// bind (Generated) - Bind(Bind), - /// bind-ok (Generated) - BindOk(BindOk), - /// unbind (Generated) - Unbind(Unbind), - /// unbind-ok (Generated) - UnbindOk(UnbindOk), - } - - /// declare (Generated) - #[derive(Clone, Debug, Default, PartialEq)] - pub struct Declare { - /// exchange (Generated) - pub exchange: ShortString, - /// type (Generated) - pub kind: ShortString, - /// passive (Generated) - pub passive: Boolean, - /// durable (Generated) - pub durable: Boolean, - /// auto-delete (Generated) - pub auto_delete: Boolean, - /// internal (Generated) - pub internal: Boolean, - /// nowait (Generated) - pub nowait: Boolean, - /// arguments (Generated) - pub arguments: FieldTable, - } - - impl Declare { - /// Get the AMQP class id for declare (Generated) - pub fn get_amqp_class_id(&self) -> Identifier { - 40 + /// Set timestamp (Generated) + pub fn with_timestamp(mut self, value: Timestamp) -> AMQPProperties { + self.timestamp = Some(value); + self } - - /// Get the AMQP method id for declare (Generated) - pub fn get_amqp_method_id(&self) -> Identifier { - 10 + /// Set type (Generated) + pub fn with_kind(mut self, value: ShortString) -> AMQPProperties { + self.kind = Some(value); + self } - } - - /// Parse declare (Generated) - pub fn parse_declare<I: ParsableInput>(i: I) -> ParserResult<I, Declare> { - let (i, _) = parse_short_uint(i)?; - let (i, exchange) = parse_short_string(i)?; - let (i, kind) = parse_short_string(i)?; - let (i, flags) = parse_flags( - i, - &["passive", "durable", "auto-delete", "internal", "nowait"], - )?; - let (i, arguments) = parse_field_table(i)?; - Ok(( - i, - Declare { - exchange, - kind, - passive: flags.get_flag("passive").unwrap_or(false), - durable: flags.get_flag("durable").unwrap_or(false), - auto_delete: flags.get_flag("auto_delete").unwrap_or(false), - internal: flags.get_flag("internal").unwrap_or(false), - nowait: flags.get_flag("nowait").unwrap_or(false), - arguments, - }, - )) - } - - /// Serialize declare (Generated) - pub fn gen_declare<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a Declare, - ) -> impl SerializeFn<W> + 'a { - move |mut input| { - let mut flags = AMQPFlags::default(); - flags.add_flag("passive".to_string(), method.passive); - flags.add_flag("durable".to_string(), method.durable); - flags.add_flag("auto_delete".to_string(), method.auto_delete); - flags.add_flag("internal".to_string(), method.internal); - flags.add_flag("nowait".to_string(), method.nowait); - input = gen_id(10)(input)?; - input = gen_short_uint(0)(input)?; - input = gen_short_string(method.exchange.as_str())(input)?; - input = gen_short_string(method.kind.as_str())(input)?; - input = gen_flags(&flags)(input)?; - input = gen_field_table(&method.arguments)(input)?; - Ok(input) + /// Set user-id (Generated) + pub fn with_user_id(mut self, value: ShortString) -> AMQPProperties { + self.user_id = Some(value); + self + } + /// Set app-id (Generated) + pub fn with_app_id(mut self, value: ShortString) -> AMQPProperties { + self.app_id = Some(value); + self + } + /// Set cluster-id (Generated) + pub fn with_cluster_id(mut self, value: ShortString) -> AMQPProperties { + self.cluster_id = Some(value); + self + } + /// Get content-type (Generated) + pub fn content_type(&self) -> &Option<ShortString> { + &self.content_type + } + /// Get content-encoding (Generated) + pub fn content_encoding(&self) -> &Option<ShortString> { + &self.content_encoding + } + /// Get headers (Generated) + pub fn headers(&self) -> &Option<FieldTable> { + &self.headers + } + /// Get delivery-mode (Generated) + pub fn delivery_mode(&self) -> &Option<ShortShortUInt> { + &self.delivery_mode } - } - /// declare-ok (Generated) - #[derive(Clone, Debug, Default, PartialEq)] - pub struct DeclareOk {} - - impl DeclareOk { - /// Get the AMQP class id for declare-ok (Generated) - pub fn get_amqp_class_id(&self) -> Identifier { - 40 + /// Get priority (Generated) + pub fn priority(&self) -> &Option<ShortShortUInt> { + &self.priority } - - /// Get the AMQP method id for declare-ok (Generated) - pub fn get_amqp_method_id(&self) -> Identifier { - 11 + /// Get correlation-id (Generated) + pub fn correlation_id(&self) -> &Option<ShortString> { + &self.correlation_id } - } - - /// Parse declare-ok (Generated) - pub fn parse_declare_ok<I: ParsableInput>(i: I) -> ParserResult<I, DeclareOk> { - Ok((i, DeclareOk {})) - } - - /// Serialize declare-ok (Generated) - pub fn gen_declare_ok<'a, W: Write + BackToTheBuffer + 'a>( - _: &'a DeclareOk, - ) -> impl SerializeFn<W> + 'a { - move |mut input| { - input = gen_id(11)(input)?; - Ok(input) + /// Get reply-to (Generated) + pub fn reply_to(&self) -> &Option<ShortString> { + &self.reply_to } - } - /// delete (Generated) - #[derive(Clone, Debug, Default, PartialEq)] - pub struct Delete { - /// exchange (Generated) - pub exchange: ShortString, - /// if-unused (Generated) - pub if_unused: Boolean, - /// nowait (Generated) - pub nowait: Boolean, - } - - impl Delete { - /// Get the AMQP class id for delete (Generated) - pub fn get_amqp_class_id(&self) -> Identifier { - 40 + /// Get expiration (Generated) + pub fn expiration(&self) -> &Option<ShortString> { + &self.expiration } - - /// Get the AMQP method id for delete (Generated) - pub fn get_amqp_method_id(&self) -> Identifier { - 20 + /// Get message-id (Generated) + pub fn message_id(&self) -> &Option<ShortString> { + &self.message_id } - } - - /// Parse delete (Generated) - pub fn parse_delete<I: ParsableInput>(i: I) -> ParserResult<I, Delete> { - let (i, _) = parse_short_uint(i)?; - let (i, exchange) = parse_short_string(i)?; - let (i, flags) = parse_flags(i, &["if-unused", "nowait"])?; - Ok(( - i, - Delete { - exchange, - if_unused: flags.get_flag("if_unused").unwrap_or(false), - nowait: flags.get_flag("nowait").unwrap_or(false), - }, - )) - } - - /// Serialize delete (Generated) - pub fn gen_delete<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a Delete, - ) -> impl SerializeFn<W> + 'a { - move |mut input| { - let mut flags = AMQPFlags::default(); - flags.add_flag("if_unused".to_string(), method.if_unused); - flags.add_flag("nowait".to_string(), method.nowait); - input = gen_id(20)(input)?; - input = gen_short_uint(0)(input)?; - input = gen_short_string(method.exchange.as_str())(input)?; - input = gen_flags(&flags)(input)?; - Ok(input) + /// Get timestamp (Generated) + pub fn timestamp(&self) -> &Option<Timestamp> { + &self.timestamp } - } - /// delete-ok (Generated) - #[derive(Clone, Debug, Default, PartialEq)] - pub struct DeleteOk {} - - impl DeleteOk { - /// Get the AMQP class id for delete-ok (Generated) - pub fn get_amqp_class_id(&self) -> Identifier { - 40 + /// Get type (Generated) + pub fn kind(&self) -> &Option<ShortString> { + &self.kind } - - /// Get the AMQP method id for delete-ok (Generated) - pub fn get_amqp_method_id(&self) -> Identifier { - 21 + /// Get user-id (Generated) + pub fn user_id(&self) -> &Option<ShortString> { + &self.user_id + } + /// Get app-id (Generated) + pub fn app_id(&self) -> &Option<ShortString> { + &self.app_id + } + /// Get cluster-id (Generated) + pub fn cluster_id(&self) -> &Option<ShortString> { + &self.cluster_id + } + /// Get the bitmask for serialization (Generated) + #[allow(clippy::identity_op)] + pub fn bitmask(&self) -> ShortUInt { + (if self.content_type.is_some() { + 1 << (15 - 0) + } else { + 0 + }) + (if self.content_encoding.is_some() { + 1 << (15 - 1) + } else { + 0 + }) + (if self.headers.is_some() { + 1 << (15 - 2) + } else { + 0 + }) + (if self.delivery_mode.is_some() { + 1 << (15 - 3) + } else { + 0 + }) + (if self.priority.is_some() { + 1 << (15 - 4) + } else { + 0 + }) + (if self.correlation_id.is_some() { + 1 << (15 - 5) + } else { + 0 + }) + (if self.reply_to.is_some() { + 1 << (15 - 6) + } else { + 0 + }) + (if self.expiration.is_some() { + 1 << (15 - 7) + } else { + 0 + }) + (if self.message_id.is_some() { + 1 << (15 - 8) + } else { + 0 + }) + (if self.timestamp.is_some() { + 1 << (15 - 9) + } else { + 0 + }) + (if self.kind.is_some() { + 1 << (15 - 10) + } else { + 0 + }) + (if self.user_id.is_some() { + 1 << (15 - 11) + } else { + 0 + }) + (if self.app_id.is_some() { + 1 << (15 - 12) + } else { + 0 + }) + (if self.cluster_id.is_some() { + 1 << (15 - 13) + } else { + 0 + }) } } - /// Parse delete-ok (Generated) - pub fn parse_delete_ok<I: ParsableInput>(i: I) -> ParserResult<I, DeleteOk> { - Ok((i, DeleteOk {})) + /// Parse basic properties (Generated) + #[allow(clippy::identity_op)] + pub fn parse_properties<I: ParsableInput>(i: I) -> ParserResult<I, AMQPProperties> { + let (i, flags) = parse_short_uint(i)?; + let (i, content_type) = if flags & (1 << (15 - 0)) != 0 { + map(parse_short_string, Some)(i)? + } else { + (i, None) + }; + let (i, content_encoding) = if flags & (1 << (15 - 1)) != 0 { + map(parse_short_string, Some)(i)? + } else { + (i, None) + }; + let (i, headers) = if flags & (1 << (15 - 2)) != 0 { + map(parse_field_table, Some)(i)? + } else { + (i, None) + }; + let (i, delivery_mode) = if flags & (1 << (15 - 3)) != 0 { + map(parse_short_short_uint, Some)(i)? + } else { + (i, None) + }; + let (i, priority) = if flags & (1 << (15 - 4)) != 0 { + map(parse_short_short_uint, Some)(i)? + } else { + (i, None) + }; + let (i, correlation_id) = if flags & (1 << (15 - 5)) != 0 { + map(parse_short_string, Some)(i)? + } else { + (i, None) + }; + let (i, reply_to) = if flags & (1 << (15 - 6)) != 0 { + map(parse_short_string, Some)(i)? + } else { + (i, None) + }; + let (i, expiration) = if flags & (1 << (15 - 7)) != 0 { + map(parse_short_string, Some)(i)? + } else { + (i, None) + }; + let (i, message_id) = if flags & (1 << (15 - 8)) != 0 { + map(parse_short_string, Some)(i)? + } else { + (i, None) + }; + let (i, timestamp) = if flags & (1 << (15 - 9)) != 0 { + map(parse_timestamp, Some)(i)? + } else { + (i, None) + }; + let (i, kind) = if flags & (1 << (15 - 10)) != 0 { + map(parse_short_string, Some)(i)? + } else { + (i, None) + }; + let (i, user_id) = if flags & (1 << (15 - 11)) != 0 { + map(parse_short_string, Some)(i)? + } else { + (i, None) + }; + let (i, app_id) = if flags & (1 << (15 - 12)) != 0 { + map(parse_short_string, Some)(i)? + } else { + (i, None) + }; + let (i, cluster_id) = if flags & (1 << (15 - 13)) != 0 { + map(parse_short_string, Some)(i)? + } else { + (i, None) + }; + Ok(( + i, + AMQPProperties { + content_type, + content_encoding, + headers, + delivery_mode, + priority, + correlation_id, + reply_to, + expiration, + message_id, + timestamp, + kind, + user_id, + app_id, + cluster_id, + }, + )) } - /// Serialize delete-ok (Generated) - pub fn gen_delete_ok<'a, W: Write + BackToTheBuffer + 'a>( - _: &'a DeleteOk, + /// Serialize basic properties (Generated) + pub fn gen_properties<'a, W: Write + BackToTheBuffer + 'a>( + props: &'a AMQPProperties, ) -> impl SerializeFn<W> + 'a { - move |mut input| { - input = gen_id(21)(input)?; + cookie_factory::sequence::pair(gen_short_uint(props.bitmask()), move |mut input| { + if let Some(prop) = props.content_type.as_ref() { + input = gen_short_string(prop.as_str())(input)?; + } + if let Some(prop) = props.content_encoding.as_ref() { + input = gen_short_string(prop.as_str())(input)?; + } + if let Some(prop) = props.headers.as_ref() { + input = gen_field_table(prop)(input)?; + } + if let Some(prop) = props.delivery_mode { + input = gen_short_short_uint(prop)(input)?; + } + if let Some(prop) = props.priority { + input = gen_short_short_uint(prop)(input)?; + } + if let Some(prop) = props.correlation_id.as_ref() { + input = gen_short_string(prop.as_str())(input)?; + } + if let Some(prop) = props.reply_to.as_ref() { + input = gen_short_string(prop.as_str())(input)?; + } + if let Some(prop) = props.expiration.as_ref() { + input = gen_short_string(prop.as_str())(input)?; + } + if let Some(prop) = props.message_id.as_ref() { + input = gen_short_string(prop.as_str())(input)?; + } + if let Some(prop) = props.timestamp { + input = gen_timestamp(prop)(input)?; + } + if let Some(prop) = props.kind.as_ref() { + input = gen_short_string(prop.as_str())(input)?; + } + if let Some(prop) = props.user_id.as_ref() { + input = gen_short_string(prop.as_str())(input)?; + } + if let Some(prop) = props.app_id.as_ref() { + input = gen_short_string(prop.as_str())(input)?; + } + if let Some(prop) = props.cluster_id.as_ref() { + input = gen_short_string(prop.as_str())(input)?; + } Ok(input) - } - } - /// bind (Generated) - #[derive(Clone, Debug, Default, PartialEq)] - pub struct Bind { - /// destination (Generated) - pub destination: ShortString, - /// source (Generated) - pub source: ShortString, - /// routing-key (Generated) - pub routing_key: ShortString, - /// nowait (Generated) - pub nowait: Boolean, - /// arguments (Generated) - pub arguments: FieldTable, + }) } +} +/// connection (generated) +pub mod connection { + use super::*; - impl Bind { - /// Get the AMQP class id for bind (Generated) - pub fn get_amqp_class_id(&self) -> Identifier { - 40 - } - - /// Get the AMQP method id for bind (Generated) - pub fn get_amqp_method_id(&self) -> Identifier { - 30 - } + /// Parse connection (Generated) + pub fn parse_connection<I: ParsableInput>(i: I) -> ParserResult<I, connection::AMQPMethod> { + context( + "parse_connection", + map_opt( + flat_map(parse_id, |id| { + move |i| match id { + 10 => context( + "parse_start", + map(map(parse_start, AMQPMethod::Start), Some), + )(i), + 11 => context( + "parse_start_ok", + map(map(parse_start_ok, AMQPMethod::StartOk), Some), + )(i), + 20 => context( + "parse_secure", + map(map(parse_secure, AMQPMethod::Secure), Some), + )(i), + 21 => context( + "parse_secure_ok", + map(map(parse_secure_ok, AMQPMethod::SecureOk), Some), + )(i), + 30 => { + context("parse_tune", map(map(parse_tune, AMQPMethod::Tune), Some))(i) + } + 31 => context( + "parse_tune_ok", + map(map(parse_tune_ok, AMQPMethod::TuneOk), Some), + )(i), + 40 => { + context("parse_open", map(map(parse_open, AMQPMethod::Open), Some))(i) + } + 41 => context( + "parse_open_ok", + map(map(parse_open_ok, AMQPMethod::OpenOk), Some), + )(i), + 50 => context( + "parse_close", + map(map(parse_close, AMQPMethod::Close), Some), + )(i), + 51 => context( + "parse_close_ok", + map(map(parse_close_ok, AMQPMethod::CloseOk), Some), + )(i), + 60 => context( + "parse_blocked", + map(map(parse_blocked, AMQPMethod::Blocked), Some), + )(i), + 61 => context( + "parse_unblocked", + map(map(parse_unblocked, AMQPMethod::Unblocked), Some), + )(i), + 70 => context( + "parse_update_secret", + map(map(parse_update_secret, AMQPMethod::UpdateSecret), Some), + )(i), + 71 => context( + "parse_update_secret_ok", + map( + map(parse_update_secret_ok, AMQPMethod::UpdateSecretOk), + Some, + ), + )(i), + _ => Ok((i, None)), + } + }), + std::convert::identity, + ), + )(i) } - /// Parse bind (Generated) - pub fn parse_bind<I: ParsableInput>(i: I) -> ParserResult<I, Bind> { - let (i, _) = parse_short_uint(i)?; - let (i, destination) = parse_short_string(i)?; - let (i, source) = parse_short_string(i)?; - let (i, routing_key) = parse_short_string(i)?; - let (i, flags) = parse_flags(i, &["nowait"])?; - let (i, arguments) = parse_field_table(i)?; - Ok(( - i, - Bind { - destination, - source, - routing_key, - nowait: flags.get_flag("nowait").unwrap_or(false), - arguments, - }, - )) + /// Serialize connection (Generated) + pub fn gen_connection<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a AMQPMethod, + ) -> impl SerializeFn<W> + 'a { + cookie_factory::sequence::pair(gen_id(10), move |input| match *method { + AMQPMethod::Start(ref start) => gen_start(start)(input), + AMQPMethod::StartOk(ref start_ok) => gen_start_ok(start_ok)(input), + AMQPMethod::Secure(ref secure) => gen_secure(secure)(input), + AMQPMethod::SecureOk(ref secure_ok) => gen_secure_ok(secure_ok)(input), + AMQPMethod::Tune(ref tune) => gen_tune(tune)(input), + AMQPMethod::TuneOk(ref tune_ok) => gen_tune_ok(tune_ok)(input), + AMQPMethod::Open(ref open) => gen_open(open)(input), + AMQPMethod::OpenOk(ref open_ok) => gen_open_ok(open_ok)(input), + AMQPMethod::Close(ref close) => gen_close(close)(input), + AMQPMethod::CloseOk(ref close_ok) => gen_close_ok(close_ok)(input), + AMQPMethod::Blocked(ref blocked) => gen_blocked(blocked)(input), + AMQPMethod::Unblocked(ref unblocked) => gen_unblocked(unblocked)(input), + AMQPMethod::UpdateSecret(ref update_secret) => gen_update_secret(update_secret)(input), + AMQPMethod::UpdateSecretOk(ref update_secret_ok) => { + gen_update_secret_ok(update_secret_ok)(input) + } + }) } - /// Serialize bind (Generated) - pub fn gen_bind<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a Bind, - ) -> impl SerializeFn<W> + 'a { - move |mut input| { - let mut flags = AMQPFlags::default(); - flags.add_flag("nowait".to_string(), method.nowait); - input = gen_id(30)(input)?; - input = gen_short_uint(0)(input)?; - input = gen_short_string(method.destination.as_str())(input)?; - input = gen_short_string(method.source.as_str())(input)?; - input = gen_short_string(method.routing_key.as_str())(input)?; - input = gen_flags(&flags)(input)?; - input = gen_field_table(&method.arguments)(input)?; - Ok(input) - } + /// The available methods in connection + #[derive(Clone, Debug, PartialEq)] + pub enum AMQPMethod { + /// start (Generated) + Start(Start), + /// start-ok (Generated) + StartOk(StartOk), + /// secure (Generated) + Secure(Secure), + /// secure-ok (Generated) + SecureOk(SecureOk), + /// tune (Generated) + Tune(Tune), + /// tune-ok (Generated) + TuneOk(TuneOk), + /// open (Generated) + Open(Open), + /// open-ok (Generated) + OpenOk(OpenOk), + /// close (Generated) + Close(Close), + /// close-ok (Generated) + CloseOk(CloseOk), + /// blocked (Generated) + Blocked(Blocked), + /// unblocked (Generated) + Unblocked(Unblocked), + /// update-secret (Generated) + UpdateSecret(UpdateSecret), + /// update-secret-ok (Generated) + UpdateSecretOk(UpdateSecretOk), } - /// bind-ok (Generated) + + /// start (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct BindOk {} + pub struct Start { + /// version-major (Generated) + pub version_major: ShortShortUInt, + /// version-minor (Generated) + pub version_minor: ShortShortUInt, + /// server-properties (Generated) + pub server_properties: FieldTable, + /// mechanisms (Generated) + pub mechanisms: LongString, + /// locales (Generated) + pub locales: LongString, + } - impl BindOk { - /// Get the AMQP class id for bind-ok (Generated) + impl Start { + /// Get the AMQP class id for start (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 40 + 10 } - /// Get the AMQP method id for bind-ok (Generated) + /// Get the AMQP method id for start (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 31 + 10 } } - /// Parse bind-ok (Generated) - pub fn parse_bind_ok<I: ParsableInput>(i: I) -> ParserResult<I, BindOk> { - Ok((i, BindOk {})) + /// Parse start (Generated) + pub fn parse_start<I: ParsableInput>(i: I) -> ParserResult<I, Start> { + let (i, version_major) = parse_short_short_uint(i)?; + let (i, version_minor) = parse_short_short_uint(i)?; + let (i, server_properties) = parse_field_table(i)?; + let (i, mechanisms) = parse_long_string(i)?; + let (i, locales) = parse_long_string(i)?; + Ok(( + i, + Start { + version_major, + version_minor, + server_properties, + mechanisms, + locales, + }, + )) } - /// Serialize bind-ok (Generated) - pub fn gen_bind_ok<'a, W: Write + BackToTheBuffer + 'a>( - _: &'a BindOk, + /// Serialize start (Generated) + pub fn gen_start<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Start, ) -> impl SerializeFn<W> + 'a { move |mut input| { - input = gen_id(31)(input)?; + input = gen_id(10)(input)?; + input = gen_short_short_uint(method.version_major)(input)?; + input = gen_short_short_uint(method.version_minor)(input)?; + input = gen_field_table(&method.server_properties)(input)?; + input = gen_long_string(method.mechanisms.as_bytes())(input)?; + input = gen_long_string(method.locales.as_bytes())(input)?; Ok(input) } } - /// unbind (Generated) + /// start-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct Unbind { - /// destination (Generated) - pub destination: ShortString, - /// source (Generated) - pub source: ShortString, - /// routing-key (Generated) - pub routing_key: ShortString, - /// nowait (Generated) - pub nowait: Boolean, - /// arguments (Generated) - pub arguments: FieldTable, + pub struct StartOk { + /// client-properties (Generated) + pub client_properties: FieldTable, + /// mechanism (Generated) + pub mechanism: ShortString, + /// response (Generated) + pub response: LongString, + /// locale (Generated) + pub locale: ShortString, } - impl Unbind { - /// Get the AMQP class id for unbind (Generated) + impl StartOk { + /// Get the AMQP class id for start-ok (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 40 + 10 } - /// Get the AMQP method id for unbind (Generated) + /// Get the AMQP method id for start-ok (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 40 + 11 } } - /// Parse unbind (Generated) - pub fn parse_unbind<I: ParsableInput>(i: I) -> ParserResult<I, Unbind> { - let (i, _) = parse_short_uint(i)?; - let (i, destination) = parse_short_string(i)?; - let (i, source) = parse_short_string(i)?; - let (i, routing_key) = parse_short_string(i)?; - let (i, flags) = parse_flags(i, &["nowait"])?; - let (i, arguments) = parse_field_table(i)?; + /// Parse start-ok (Generated) + pub fn parse_start_ok<I: ParsableInput>(i: I) -> ParserResult<I, StartOk> { + let (i, client_properties) = parse_field_table(i)?; + let (i, mechanism) = parse_short_string(i)?; + let (i, response) = parse_long_string(i)?; + let (i, locale) = parse_short_string(i)?; Ok(( i, - Unbind { - destination, - source, - routing_key, - nowait: flags.get_flag("nowait").unwrap_or(false), - arguments, + StartOk { + client_properties, + mechanism, + response, + locale, }, )) } - /// Serialize unbind (Generated) - pub fn gen_unbind<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a Unbind, + /// Serialize start-ok (Generated) + pub fn gen_start_ok<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a StartOk, ) -> impl SerializeFn<W> + 'a { move |mut input| { - let mut flags = AMQPFlags::default(); - flags.add_flag("nowait".to_string(), method.nowait); - input = gen_id(40)(input)?; - input = gen_short_uint(0)(input)?; - input = gen_short_string(method.destination.as_str())(input)?; - input = gen_short_string(method.source.as_str())(input)?; - input = gen_short_string(method.routing_key.as_str())(input)?; - input = gen_flags(&flags)(input)?; - input = gen_field_table(&method.arguments)(input)?; + input = gen_id(11)(input)?; + input = gen_field_table(&method.client_properties)(input)?; + input = gen_short_string(method.mechanism.as_str())(input)?; + input = gen_long_string(method.response.as_bytes())(input)?; + input = gen_short_string(method.locale.as_str())(input)?; Ok(input) } } - /// unbind-ok (Generated) + /// secure (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct UnbindOk {} + pub struct Secure { + /// challenge (Generated) + pub challenge: LongString, + } - impl UnbindOk { - /// Get the AMQP class id for unbind-ok (Generated) + impl Secure { + /// Get the AMQP class id for secure (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 40 + 10 } - /// Get the AMQP method id for unbind-ok (Generated) + /// Get the AMQP method id for secure (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 51 + 20 } } - /// Parse unbind-ok (Generated) - pub fn parse_unbind_ok<I: ParsableInput>(i: I) -> ParserResult<I, UnbindOk> { - Ok((i, UnbindOk {})) + /// Parse secure (Generated) + pub fn parse_secure<I: ParsableInput>(i: I) -> ParserResult<I, Secure> { + let (i, challenge) = parse_long_string(i)?; + Ok((i, Secure { challenge })) } - /// Serialize unbind-ok (Generated) - pub fn gen_unbind_ok<'a, W: Write + BackToTheBuffer + 'a>( - _: &'a UnbindOk, + /// Serialize secure (Generated) + pub fn gen_secure<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Secure, ) -> impl SerializeFn<W> + 'a { move |mut input| { - input = gen_id(51)(input)?; + input = gen_id(20)(input)?; + input = gen_long_string(method.challenge.as_bytes())(input)?; Ok(input) } } -} -/// queue (generated) -pub mod queue { - use super::*; - - /// Parse queue (Generated) - pub fn parse_queue<I: ParsableInput>(i: I) -> ParserResult<I, queue::AMQPMethod> { - context( - "parse_queue", - map_opt( - flat_map(parse_id, |id| { - move |i| match id { - 10 => context( - "parse_declare", - map(map(parse_declare, AMQPMethod::Declare), Some), - )(i), - 11 => context( - "parse_declare_ok", - map(map(parse_declare_ok, AMQPMethod::DeclareOk), Some), - )(i), - 20 => { - context("parse_bind", map(map(parse_bind, AMQPMethod::Bind), Some))(i) - } - 21 => context( - "parse_bind_ok", - map(map(parse_bind_ok, AMQPMethod::BindOk), Some), - )(i), - 30 => context( - "parse_purge", - map(map(parse_purge, AMQPMethod::Purge), Some), - )(i), - 31 => context( - "parse_purge_ok", - map(map(parse_purge_ok, AMQPMethod::PurgeOk), Some), - )(i), - 40 => context( - "parse_delete", - map(map(parse_delete, AMQPMethod::Delete), Some), - )(i), - 41 => context( - "parse_delete_ok", - map(map(parse_delete_ok, AMQPMethod::DeleteOk), Some), - )(i), - 50 => context( - "parse_unbind", - map(map(parse_unbind, AMQPMethod::Unbind), Some), - )(i), - 51 => context( - "parse_unbind_ok", - map(map(parse_unbind_ok, AMQPMethod::UnbindOk), Some), - )(i), - _ => Ok((i, None)), - } - }), - std::convert::identity, - ), - )(i) + /// secure-ok (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct SecureOk { + /// response (Generated) + pub response: LongString, } - /// Serialize queue (Generated) - pub fn gen_queue<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a AMQPMethod, - ) -> impl SerializeFn<W> + 'a { - cookie_factory::sequence::pair(gen_id(50), move |input| match *method { - AMQPMethod::Declare(ref declare) => gen_declare(declare)(input), - AMQPMethod::DeclareOk(ref declare_ok) => gen_declare_ok(declare_ok)(input), - AMQPMethod::Bind(ref bind) => gen_bind(bind)(input), - AMQPMethod::BindOk(ref bind_ok) => gen_bind_ok(bind_ok)(input), - AMQPMethod::Purge(ref purge) => gen_purge(purge)(input), - AMQPMethod::PurgeOk(ref purge_ok) => gen_purge_ok(purge_ok)(input), - AMQPMethod::Delete(ref delete) => gen_delete(delete)(input), - AMQPMethod::DeleteOk(ref delete_ok) => gen_delete_ok(delete_ok)(input), - AMQPMethod::Unbind(ref unbind) => gen_unbind(unbind)(input), - AMQPMethod::UnbindOk(ref unbind_ok) => gen_unbind_ok(unbind_ok)(input), - }) + impl SecureOk { + /// Get the AMQP class id for secure-ok (Generated) + pub fn get_amqp_class_id(&self) -> Identifier { + 10 + } + + /// Get the AMQP method id for secure-ok (Generated) + pub fn get_amqp_method_id(&self) -> Identifier { + 21 + } } - /// The available methods in queue - #[derive(Clone, Debug, PartialEq)] - pub enum AMQPMethod { - /// declare (Generated) - Declare(Declare), - /// declare-ok (Generated) - DeclareOk(DeclareOk), - /// bind (Generated) - Bind(Bind), - /// bind-ok (Generated) - BindOk(BindOk), - /// purge (Generated) - Purge(Purge), - /// purge-ok (Generated) - PurgeOk(PurgeOk), - /// delete (Generated) - Delete(Delete), - /// delete-ok (Generated) - DeleteOk(DeleteOk), - /// unbind (Generated) - Unbind(Unbind), - /// unbind-ok (Generated) - UnbindOk(UnbindOk), + /// Parse secure-ok (Generated) + pub fn parse_secure_ok<I: ParsableInput>(i: I) -> ParserResult<I, SecureOk> { + let (i, response) = parse_long_string(i)?; + Ok((i, SecureOk { response })) } - /// declare (Generated) + /// Serialize secure-ok (Generated) + pub fn gen_secure_ok<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a SecureOk, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(21)(input)?; + input = gen_long_string(method.response.as_bytes())(input)?; + Ok(input) + } + } + /// tune (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct Declare { - /// queue (Generated) - pub queue: ShortString, - /// passive (Generated) - pub passive: Boolean, - /// durable (Generated) - pub durable: Boolean, - /// exclusive (Generated) - pub exclusive: Boolean, - /// auto-delete (Generated) - pub auto_delete: Boolean, - /// nowait (Generated) - pub nowait: Boolean, - /// arguments (Generated) - pub arguments: FieldTable, + pub struct Tune { + /// channel-max (Generated) + pub channel_max: ShortUInt, + /// frame-max (Generated) + pub frame_max: LongUInt, + /// heartbeat (Generated) + pub heartbeat: ShortUInt, } - impl Declare { - /// Get the AMQP class id for declare (Generated) + impl Tune { + /// Get the AMQP class id for tune (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 50 + 10 } - /// Get the AMQP method id for declare (Generated) + /// Get the AMQP method id for tune (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 10 + 30 } } - /// Parse declare (Generated) - pub fn parse_declare<I: ParsableInput>(i: I) -> ParserResult<I, Declare> { - let (i, _) = parse_short_uint(i)?; - let (i, queue) = parse_short_string(i)?; - let (i, flags) = parse_flags( - i, - &["passive", "durable", "exclusive", "auto-delete", "nowait"], - )?; - let (i, arguments) = parse_field_table(i)?; + /// Parse tune (Generated) + pub fn parse_tune<I: ParsableInput>(i: I) -> ParserResult<I, Tune> { + let (i, channel_max) = parse_short_uint(i)?; + let (i, frame_max) = parse_long_uint(i)?; + let (i, heartbeat) = parse_short_uint(i)?; Ok(( i, - Declare { - queue, - passive: flags.get_flag("passive").unwrap_or(false), - durable: flags.get_flag("durable").unwrap_or(false), - exclusive: flags.get_flag("exclusive").unwrap_or(false), - auto_delete: flags.get_flag("auto_delete").unwrap_or(false), - nowait: flags.get_flag("nowait").unwrap_or(false), - arguments, + Tune { + channel_max, + frame_max, + heartbeat, }, )) } - /// Serialize declare (Generated) - pub fn gen_declare<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a Declare, + /// Serialize tune (Generated) + pub fn gen_tune<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Tune, ) -> impl SerializeFn<W> + 'a { move |mut input| { - let mut flags = AMQPFlags::default(); - flags.add_flag("passive".to_string(), method.passive); - flags.add_flag("durable".to_string(), method.durable); - flags.add_flag("exclusive".to_string(), method.exclusive); - flags.add_flag("auto_delete".to_string(), method.auto_delete); - flags.add_flag("nowait".to_string(), method.nowait); - input = gen_id(10)(input)?; - input = gen_short_uint(0)(input)?; - input = gen_short_string(method.queue.as_str())(input)?; - input = gen_flags(&flags)(input)?; - input = gen_field_table(&method.arguments)(input)?; + input = gen_id(30)(input)?; + input = gen_short_uint(method.channel_max)(input)?; + input = gen_long_uint(method.frame_max)(input)?; + input = gen_short_uint(method.heartbeat)(input)?; Ok(input) } } - /// declare-ok (Generated) + /// tune-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct DeclareOk { - /// queue (Generated) - pub queue: ShortString, - /// message-count (Generated) - pub message_count: LongUInt, - /// consumer-count (Generated) - pub consumer_count: LongUInt, + pub struct TuneOk { + /// channel-max (Generated) + pub channel_max: ShortUInt, + /// frame-max (Generated) + pub frame_max: LongUInt, + /// heartbeat (Generated) + pub heartbeat: ShortUInt, } - impl DeclareOk { - /// Get the AMQP class id for declare-ok (Generated) + impl TuneOk { + /// Get the AMQP class id for tune-ok (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 50 + 10 } - /// Get the AMQP method id for declare-ok (Generated) + /// Get the AMQP method id for tune-ok (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 11 + 31 } } - /// Parse declare-ok (Generated) - pub fn parse_declare_ok<I: ParsableInput>(i: I) -> ParserResult<I, DeclareOk> { - let (i, queue) = parse_short_string(i)?; - let (i, message_count) = parse_long_uint(i)?; - let (i, consumer_count) = parse_long_uint(i)?; + /// Parse tune-ok (Generated) + pub fn parse_tune_ok<I: ParsableInput>(i: I) -> ParserResult<I, TuneOk> { + let (i, channel_max) = parse_short_uint(i)?; + let (i, frame_max) = parse_long_uint(i)?; + let (i, heartbeat) = parse_short_uint(i)?; Ok(( i, - DeclareOk { - queue, - message_count, - consumer_count, + TuneOk { + channel_max, + frame_max, + heartbeat, }, )) } - /// Serialize declare-ok (Generated) - pub fn gen_declare_ok<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a DeclareOk, + /// Serialize tune-ok (Generated) + pub fn gen_tune_ok<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a TuneOk, ) -> impl SerializeFn<W> + 'a { move |mut input| { - input = gen_id(11)(input)?; - input = gen_short_string(method.queue.as_str())(input)?; - input = gen_long_uint(method.message_count)(input)?; - input = gen_long_uint(method.consumer_count)(input)?; + input = gen_id(31)(input)?; + input = gen_short_uint(method.channel_max)(input)?; + input = gen_long_uint(method.frame_max)(input)?; + input = gen_short_uint(method.heartbeat)(input)?; Ok(input) } } - /// bind (Generated) + /// open (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct Bind { - /// queue (Generated) - pub queue: ShortString, - /// exchange (Generated) - pub exchange: ShortString, - /// routing-key (Generated) - pub routing_key: ShortString, - /// nowait (Generated) - pub nowait: Boolean, - /// arguments (Generated) - pub arguments: FieldTable, + pub struct Open { + /// virtual-host (Generated) + pub virtual_host: ShortString, } - impl Bind { - /// Get the AMQP class id for bind (Generated) + impl Open { + /// Get the AMQP class id for open (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 50 + 10 } - /// Get the AMQP method id for bind (Generated) + /// Get the AMQP method id for open (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 20 + 40 } } - /// Parse bind (Generated) - pub fn parse_bind<I: ParsableInput>(i: I) -> ParserResult<I, Bind> { - let (i, _) = parse_short_uint(i)?; - let (i, queue) = parse_short_string(i)?; - let (i, exchange) = parse_short_string(i)?; - let (i, routing_key) = parse_short_string(i)?; - let (i, flags) = parse_flags(i, &["nowait"])?; - let (i, arguments) = parse_field_table(i)?; - Ok(( - i, - Bind { - queue, - exchange, - routing_key, - nowait: flags.get_flag("nowait").unwrap_or(false), - arguments, - }, - )) + /// Parse open (Generated) + pub fn parse_open<I: ParsableInput>(i: I) -> ParserResult<I, Open> { + let (i, virtual_host) = parse_short_string(i)?; + let (i, _) = parse_short_string(i)?; + let (i, _) = parse_flags(i, &["insist"])?; + Ok((i, Open { virtual_host })) } - /// Serialize bind (Generated) - pub fn gen_bind<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a Bind, + /// Serialize open (Generated) + pub fn gen_open<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Open, ) -> impl SerializeFn<W> + 'a { move |mut input| { let mut flags = AMQPFlags::default(); - flags.add_flag("nowait".to_string(), method.nowait); - input = gen_id(20)(input)?; - input = gen_short_uint(0)(input)?; - input = gen_short_string(method.queue.as_str())(input)?; - input = gen_short_string(method.exchange.as_str())(input)?; - input = gen_short_string(method.routing_key.as_str())(input)?; + flags.add_flag("insist".to_string(), false); + input = gen_id(40)(input)?; + input = gen_short_string(method.virtual_host.as_str())(input)?; + input = gen_short_string("")(input)?; input = gen_flags(&flags)(input)?; - input = gen_field_table(&method.arguments)(input)?; Ok(input) } } - /// bind-ok (Generated) + /// open-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct BindOk {} + pub struct OpenOk {} - impl BindOk { - /// Get the AMQP class id for bind-ok (Generated) + impl OpenOk { + /// Get the AMQP class id for open-ok (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 50 + 10 } - /// Get the AMQP method id for bind-ok (Generated) + /// Get the AMQP method id for open-ok (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 21 + 41 } } - /// Parse bind-ok (Generated) - pub fn parse_bind_ok<I: ParsableInput>(i: I) -> ParserResult<I, BindOk> { - Ok((i, BindOk {})) + /// Parse open-ok (Generated) + pub fn parse_open_ok<I: ParsableInput>(i: I) -> ParserResult<I, OpenOk> { + let (i, _) = parse_short_string(i)?; + Ok((i, OpenOk {})) } - /// Serialize bind-ok (Generated) - pub fn gen_bind_ok<'a, W: Write + BackToTheBuffer + 'a>( - _: &'a BindOk, + /// Serialize open-ok (Generated) + pub fn gen_open_ok<'a, W: Write + BackToTheBuffer + 'a>( + _method: &'a OpenOk, ) -> impl SerializeFn<W> + 'a { move |mut input| { - input = gen_id(21)(input)?; + input = gen_id(41)(input)?; + input = gen_short_string("")(input)?; Ok(input) } } - /// purge (Generated) + /// close (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct Purge { - /// queue (Generated) - pub queue: ShortString, - /// nowait (Generated) - pub nowait: Boolean, + pub struct Close { + /// reply-code (Generated) + pub reply_code: ShortUInt, + /// reply-text (Generated) + pub reply_text: ShortString, + /// class-id (Generated) + pub class_id: ShortUInt, + /// method-id (Generated) + pub method_id: ShortUInt, } - impl Purge { - /// Get the AMQP class id for purge (Generated) + impl Close { + /// Get the AMQP class id for close (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 50 + 10 } - /// Get the AMQP method id for purge (Generated) + /// Get the AMQP method id for close (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 30 + 50 } } - /// Parse purge (Generated) - pub fn parse_purge<I: ParsableInput>(i: I) -> ParserResult<I, Purge> { - let (i, _) = parse_short_uint(i)?; - let (i, queue) = parse_short_string(i)?; - let (i, flags) = parse_flags(i, &["nowait"])?; + /// Parse close (Generated) + pub fn parse_close<I: ParsableInput>(i: I) -> ParserResult<I, Close> { + let (i, reply_code) = parse_short_uint(i)?; + let (i, reply_text) = parse_short_string(i)?; + let (i, class_id) = parse_short_uint(i)?; + let (i, method_id) = parse_short_uint(i)?; Ok(( i, - Purge { - queue, - nowait: flags.get_flag("nowait").unwrap_or(false), + Close { + reply_code, + reply_text, + class_id, + method_id, }, )) } - /// Serialize purge (Generated) - pub fn gen_purge<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a Purge, + /// Serialize close (Generated) + pub fn gen_close<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Close, ) -> impl SerializeFn<W> + 'a { move |mut input| { - let mut flags = AMQPFlags::default(); - flags.add_flag("nowait".to_string(), method.nowait); - input = gen_id(30)(input)?; - input = gen_short_uint(0)(input)?; - input = gen_short_string(method.queue.as_str())(input)?; - input = gen_flags(&flags)(input)?; + input = gen_id(50)(input)?; + input = gen_short_uint(method.reply_code)(input)?; + input = gen_short_string(method.reply_text.as_str())(input)?; + input = gen_short_uint(method.class_id)(input)?; + input = gen_short_uint(method.method_id)(input)?; Ok(input) } } - /// purge-ok (Generated) + /// close-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct PurgeOk { - /// message-count (Generated) - pub message_count: LongUInt, - } + pub struct CloseOk {} - impl PurgeOk { - /// Get the AMQP class id for purge-ok (Generated) + impl CloseOk { + /// Get the AMQP class id for close-ok (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 50 + 10 } - /// Get the AMQP method id for purge-ok (Generated) + /// Get the AMQP method id for close-ok (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 31 + 51 } } - /// Parse purge-ok (Generated) - pub fn parse_purge_ok<I: ParsableInput>(i: I) -> ParserResult<I, PurgeOk> { - let (i, message_count) = parse_long_uint(i)?; - Ok((i, PurgeOk { message_count })) + /// Parse close-ok (Generated) + pub fn parse_close_ok<I: ParsableInput>(i: I) -> ParserResult<I, CloseOk> { + Ok((i, CloseOk {})) } - /// Serialize purge-ok (Generated) - pub fn gen_purge_ok<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a PurgeOk, + /// Serialize close-ok (Generated) + pub fn gen_close_ok<'a, W: Write + BackToTheBuffer + 'a>( + _: &'a CloseOk, ) -> impl SerializeFn<W> + 'a { move |mut input| { - input = gen_id(31)(input)?; - input = gen_long_uint(method.message_count)(input)?; + input = gen_id(51)(input)?; Ok(input) } } - /// delete (Generated) + /// blocked (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct Delete { - /// queue (Generated) - pub queue: ShortString, - /// if-unused (Generated) - pub if_unused: Boolean, - /// if-empty (Generated) - pub if_empty: Boolean, - /// nowait (Generated) - pub nowait: Boolean, + pub struct Blocked { + /// reason (Generated) + pub reason: ShortString, } - impl Delete { - /// Get the AMQP class id for delete (Generated) + impl Blocked { + /// Get the AMQP class id for blocked (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 50 + 10 } - /// Get the AMQP method id for delete (Generated) + /// Get the AMQP method id for blocked (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 40 + 60 } } - /// Parse delete (Generated) - pub fn parse_delete<I: ParsableInput>(i: I) -> ParserResult<I, Delete> { - let (i, _) = parse_short_uint(i)?; - let (i, queue) = parse_short_string(i)?; - let (i, flags) = parse_flags(i, &["if-unused", "if-empty", "nowait"])?; - Ok(( - i, - Delete { - queue, - if_unused: flags.get_flag("if_unused").unwrap_or(false), - if_empty: flags.get_flag("if_empty").unwrap_or(false), - nowait: flags.get_flag("nowait").unwrap_or(false), - }, - )) + /// Parse blocked (Generated) + pub fn parse_blocked<I: ParsableInput>(i: I) -> ParserResult<I, Blocked> { + let (i, reason) = parse_short_string(i)?; + Ok((i, Blocked { reason })) } - /// Serialize delete (Generated) - pub fn gen_delete<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a Delete, + /// Serialize blocked (Generated) + pub fn gen_blocked<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Blocked, ) -> impl SerializeFn<W> + 'a { move |mut input| { - let mut flags = AMQPFlags::default(); - flags.add_flag("if_unused".to_string(), method.if_unused); - flags.add_flag("if_empty".to_string(), method.if_empty); - flags.add_flag("nowait".to_string(), method.nowait); - input = gen_id(40)(input)?; - input = gen_short_uint(0)(input)?; - input = gen_short_string(method.queue.as_str())(input)?; - input = gen_flags(&flags)(input)?; + input = gen_id(60)(input)?; + input = gen_short_string(method.reason.as_str())(input)?; Ok(input) } } - /// delete-ok (Generated) + /// unblocked (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct DeleteOk { - /// message-count (Generated) - pub message_count: LongUInt, - } + pub struct Unblocked {} - impl DeleteOk { - /// Get the AMQP class id for delete-ok (Generated) + impl Unblocked { + /// Get the AMQP class id for unblocked (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 50 + 10 } - /// Get the AMQP method id for delete-ok (Generated) + /// Get the AMQP method id for unblocked (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 41 + 61 } } - /// Parse delete-ok (Generated) - pub fn parse_delete_ok<I: ParsableInput>(i: I) -> ParserResult<I, DeleteOk> { - let (i, message_count) = parse_long_uint(i)?; - Ok((i, DeleteOk { message_count })) + /// Parse unblocked (Generated) + pub fn parse_unblocked<I: ParsableInput>(i: I) -> ParserResult<I, Unblocked> { + Ok((i, Unblocked {})) } - /// Serialize delete-ok (Generated) - pub fn gen_delete_ok<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a DeleteOk, + /// Serialize unblocked (Generated) + pub fn gen_unblocked<'a, W: Write + BackToTheBuffer + 'a>( + _: &'a Unblocked, ) -> impl SerializeFn<W> + 'a { move |mut input| { - input = gen_id(41)(input)?; - input = gen_long_uint(method.message_count)(input)?; + input = gen_id(61)(input)?; Ok(input) } } - /// unbind (Generated) + /// update-secret (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct Unbind { - /// queue (Generated) - pub queue: ShortString, - /// exchange (Generated) - pub exchange: ShortString, - /// routing-key (Generated) - pub routing_key: ShortString, - /// arguments (Generated) - pub arguments: FieldTable, + pub struct UpdateSecret { + /// new-secret (Generated) + pub new_secret: LongString, + /// reason (Generated) + pub reason: ShortString, } - impl Unbind { - /// Get the AMQP class id for unbind (Generated) + impl UpdateSecret { + /// Get the AMQP class id for update-secret (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 50 - } - - /// Get the AMQP method id for unbind (Generated) - pub fn get_amqp_method_id(&self) -> Identifier { - 50 + 10 } - } - /// Parse unbind (Generated) - pub fn parse_unbind<I: ParsableInput>(i: I) -> ParserResult<I, Unbind> { - let (i, _) = parse_short_uint(i)?; - let (i, queue) = parse_short_string(i)?; - let (i, exchange) = parse_short_string(i)?; - let (i, routing_key) = parse_short_string(i)?; - let (i, arguments) = parse_field_table(i)?; - Ok(( - i, - Unbind { - queue, - exchange, - routing_key, - arguments, - }, - )) + /// Get the AMQP method id for update-secret (Generated) + pub fn get_amqp_method_id(&self) -> Identifier { + 70 + } } - /// Serialize unbind (Generated) - pub fn gen_unbind<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a Unbind, + /// Parse update-secret (Generated) + pub fn parse_update_secret<I: ParsableInput>(i: I) -> ParserResult<I, UpdateSecret> { + let (i, new_secret) = parse_long_string(i)?; + let (i, reason) = parse_short_string(i)?; + Ok((i, UpdateSecret { new_secret, reason })) + } + + /// Serialize update-secret (Generated) + pub fn gen_update_secret<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a UpdateSecret, ) -> impl SerializeFn<W> + 'a { move |mut input| { - input = gen_id(50)(input)?; - input = gen_short_uint(0)(input)?; - input = gen_short_string(method.queue.as_str())(input)?; - input = gen_short_string(method.exchange.as_str())(input)?; - input = gen_short_string(method.routing_key.as_str())(input)?; - input = gen_field_table(&method.arguments)(input)?; + input = gen_id(70)(input)?; + input = gen_long_string(method.new_secret.as_bytes())(input)?; + input = gen_short_string(method.reason.as_str())(input)?; Ok(input) } } - /// unbind-ok (Generated) + /// update-secret-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct UnbindOk {} + pub struct UpdateSecretOk {} - impl UnbindOk { - /// Get the AMQP class id for unbind-ok (Generated) + impl UpdateSecretOk { + /// Get the AMQP class id for update-secret-ok (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 50 + 10 } - /// Get the AMQP method id for unbind-ok (Generated) + /// Get the AMQP method id for update-secret-ok (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 51 + 71 } } - /// Parse unbind-ok (Generated) - pub fn parse_unbind_ok<I: ParsableInput>(i: I) -> ParserResult<I, UnbindOk> { - Ok((i, UnbindOk {})) + /// Parse update-secret-ok (Generated) + pub fn parse_update_secret_ok<I: ParsableInput>(i: I) -> ParserResult<I, UpdateSecretOk> { + Ok((i, UpdateSecretOk {})) } - /// Serialize unbind-ok (Generated) - pub fn gen_unbind_ok<'a, W: Write + BackToTheBuffer + 'a>( - _: &'a UnbindOk, + /// Serialize update-secret-ok (Generated) + pub fn gen_update_secret_ok<'a, W: Write + BackToTheBuffer + 'a>( + _: &'a UpdateSecretOk, ) -> impl SerializeFn<W> + 'a { move |mut input| { - input = gen_id(51)(input)?; + input = gen_id(71)(input)?; Ok(input) } } } -/// basic (generated) -pub mod basic { +/// channel (generated) +pub mod channel { use super::*; - /// Parse basic (Generated) - pub fn parse_basic<I: ParsableInput>(i: I) -> ParserResult<I, basic::AMQPMethod> { + /// Parse channel (Generated) + pub fn parse_channel<I: ParsableInput>(i: I) -> ParserResult<I, channel::AMQPMethod> { context( - "parse_basic", + "parse_channel", map_opt( flat_map(parse_id, |id| { move |i| match id { - 10 => context("parse_qos", map(map(parse_qos, AMQPMethod::Qos), Some))(i), + 10 => { + context("parse_open", map(map(parse_open, AMQPMethod::Open), Some))(i) + } 11 => context( - "parse_qos_ok", - map(map(parse_qos_ok, AMQPMethod::QosOk), Some), - )(i), - 20 => context( - "parse_consume", - map(map(parse_consume, AMQPMethod::Consume), Some), + "parse_open_ok", + map(map(parse_open_ok, AMQPMethod::OpenOk), Some), )(i), + 20 => { + context("parse_flow", map(map(parse_flow, AMQPMethod::Flow), Some))(i) + } 21 => context( - "parse_consume_ok", - map(map(parse_consume_ok, AMQPMethod::ConsumeOk), Some), - )(i), - 30 => context( - "parse_cancel", - map(map(parse_cancel, AMQPMethod::Cancel), Some), - )(i), - 31 => context( - "parse_cancel_ok", - map(map(parse_cancel_ok, AMQPMethod::CancelOk), Some), + "parse_flow_ok", + map(map(parse_flow_ok, AMQPMethod::FlowOk), Some), )(i), 40 => context( - "parse_publish", - map(map(parse_publish, AMQPMethod::Publish), Some), - )(i), - 50 => context( - "parse_return", - map(map(parse_return, AMQPMethod::Return), Some), - )(i), - 60 => context( - "parse_deliver", - map(map(parse_deliver, AMQPMethod::Deliver), Some), - )(i), - 70 => context("parse_get", map(map(parse_get, AMQPMethod::Get), Some))(i), - 71 => context( - "parse_get_ok", - map(map(parse_get_ok, AMQPMethod::GetOk), Some), - )(i), - 72 => context( - "parse_get_empty", - map(map(parse_get_empty, AMQPMethod::GetEmpty), Some), - )(i), - 80 => context("parse_ack", map(map(parse_ack, AMQPMethod::Ack), Some))(i), - 90 => context( - "parse_reject", - map(map(parse_reject, AMQPMethod::Reject), Some), - )(i), - 100 => context( - "parse_recover_async", - map(map(parse_recover_async, AMQPMethod::RecoverAsync), Some), - )(i), - 110 => context( - "parse_recover", - map(map(parse_recover, AMQPMethod::Recover), Some), + "parse_close", + map(map(parse_close, AMQPMethod::Close), Some), )(i), - 111 => context( - "parse_recover_ok", - map(map(parse_recover_ok, AMQPMethod::RecoverOk), Some), + 41 => context( + "parse_close_ok", + map(map(parse_close_ok, AMQPMethod::CloseOk), Some), )(i), - 120 => { - context("parse_nack", map(map(parse_nack, AMQPMethod::Nack), Some))(i) - } _ => Ok((i, None)), } }), @@ -2654,1270 +2464,1460 @@ pub mod basic { )(i) } - /// Serialize basic (Generated) - pub fn gen_basic<'a, W: Write + BackToTheBuffer + 'a>( + /// Serialize channel (Generated) + pub fn gen_channel<'a, W: Write + BackToTheBuffer + 'a>( method: &'a AMQPMethod, ) -> impl SerializeFn<W> + 'a { - cookie_factory::sequence::pair(gen_id(60), move |input| match *method { - AMQPMethod::Qos(ref qos) => gen_qos(qos)(input), - AMQPMethod::QosOk(ref qos_ok) => gen_qos_ok(qos_ok)(input), - AMQPMethod::Consume(ref consume) => gen_consume(consume)(input), - AMQPMethod::ConsumeOk(ref consume_ok) => gen_consume_ok(consume_ok)(input), - AMQPMethod::Cancel(ref cancel) => gen_cancel(cancel)(input), - AMQPMethod::CancelOk(ref cancel_ok) => gen_cancel_ok(cancel_ok)(input), - AMQPMethod::Publish(ref publish) => gen_publish(publish)(input), - AMQPMethod::Return(ref r#return) => gen_return(r#return)(input), - AMQPMethod::Deliver(ref deliver) => gen_deliver(deliver)(input), - AMQPMethod::Get(ref get) => gen_get(get)(input), - AMQPMethod::GetOk(ref get_ok) => gen_get_ok(get_ok)(input), - AMQPMethod::GetEmpty(ref get_empty) => gen_get_empty(get_empty)(input), - AMQPMethod::Ack(ref ack) => gen_ack(ack)(input), - AMQPMethod::Reject(ref reject) => gen_reject(reject)(input), - AMQPMethod::RecoverAsync(ref recover_async) => gen_recover_async(recover_async)(input), - AMQPMethod::Recover(ref recover) => gen_recover(recover)(input), - AMQPMethod::RecoverOk(ref recover_ok) => gen_recover_ok(recover_ok)(input), - AMQPMethod::Nack(ref nack) => gen_nack(nack)(input), + cookie_factory::sequence::pair(gen_id(20), move |input| match *method { + AMQPMethod::Open(ref open) => gen_open(open)(input), + AMQPMethod::OpenOk(ref open_ok) => gen_open_ok(open_ok)(input), + AMQPMethod::Flow(ref flow) => gen_flow(flow)(input), + AMQPMethod::FlowOk(ref flow_ok) => gen_flow_ok(flow_ok)(input), + AMQPMethod::Close(ref close) => gen_close(close)(input), + AMQPMethod::CloseOk(ref close_ok) => gen_close_ok(close_ok)(input), }) } - /// The available methods in basic - #[derive(Clone, Debug, PartialEq)] - pub enum AMQPMethod { - /// qos (Generated) - Qos(Qos), - /// qos-ok (Generated) - QosOk(QosOk), - /// consume (Generated) - Consume(Consume), - /// consume-ok (Generated) - ConsumeOk(ConsumeOk), - /// cancel (Generated) - Cancel(Cancel), - /// cancel-ok (Generated) - CancelOk(CancelOk), - /// publish (Generated) - Publish(Publish), - /// return (Generated) - Return(Return), - /// deliver (Generated) - Deliver(Deliver), - /// get (Generated) - Get(Get), - /// get-ok (Generated) - GetOk(GetOk), - /// get-empty (Generated) - GetEmpty(GetEmpty), - /// ack (Generated) - Ack(Ack), - /// reject (Generated) - Reject(Reject), - /// recover-async (Generated) - RecoverAsync(RecoverAsync), - /// recover (Generated) - Recover(Recover), - /// recover-ok (Generated) - RecoverOk(RecoverOk), - /// nack (Generated) - Nack(Nack), + /// The available methods in channel + #[derive(Clone, Debug, PartialEq)] + pub enum AMQPMethod { + /// open (Generated) + Open(Open), + /// open-ok (Generated) + OpenOk(OpenOk), + /// flow (Generated) + Flow(Flow), + /// flow-ok (Generated) + FlowOk(FlowOk), + /// close (Generated) + Close(Close), + /// close-ok (Generated) + CloseOk(CloseOk), + } + + /// open (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Open {} + + impl Open { + /// Get the AMQP class id for open (Generated) + pub fn get_amqp_class_id(&self) -> Identifier { + 20 + } + + /// Get the AMQP method id for open (Generated) + pub fn get_amqp_method_id(&self) -> Identifier { + 10 + } + } + + /// Parse open (Generated) + pub fn parse_open<I: ParsableInput>(i: I) -> ParserResult<I, Open> { + let (i, _) = parse_short_string(i)?; + Ok((i, Open {})) + } + + /// Serialize open (Generated) + pub fn gen_open<'a, W: Write + BackToTheBuffer + 'a>( + _method: &'a Open, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(10)(input)?; + input = gen_short_string("")(input)?; + Ok(input) + } + } + /// open-ok (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct OpenOk {} + + impl OpenOk { + /// Get the AMQP class id for open-ok (Generated) + pub fn get_amqp_class_id(&self) -> Identifier { + 20 + } + + /// Get the AMQP method id for open-ok (Generated) + pub fn get_amqp_method_id(&self) -> Identifier { + 11 + } + } + + /// Parse open-ok (Generated) + pub fn parse_open_ok<I: ParsableInput>(i: I) -> ParserResult<I, OpenOk> { + let (i, _) = parse_long_string(i)?; + Ok((i, OpenOk {})) + } + + /// Serialize open-ok (Generated) + pub fn gen_open_ok<'a, W: Write + BackToTheBuffer + 'a>( + _method: &'a OpenOk, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(11)(input)?; + input = gen_long_string(b"")(input)?; + Ok(input) + } + } + /// flow (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Flow { + /// active (Generated) + pub active: Boolean, + } + + impl Flow { + /// Get the AMQP class id for flow (Generated) + pub fn get_amqp_class_id(&self) -> Identifier { + 20 + } + + /// Get the AMQP method id for flow (Generated) + pub fn get_amqp_method_id(&self) -> Identifier { + 20 + } + } + + /// Parse flow (Generated) + pub fn parse_flow<I: ParsableInput>(i: I) -> ParserResult<I, Flow> { + let (i, flags) = parse_flags(i, &["active"])?; + Ok(( + i, + Flow { + active: flags.get_flag("active").unwrap_or(false), + }, + )) } - /// qos (Generated) + /// Serialize flow (Generated) + pub fn gen_flow<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Flow, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + let mut flags = AMQPFlags::default(); + flags.add_flag("active".to_string(), method.active); + input = gen_id(20)(input)?; + input = gen_flags(&flags)(input)?; + Ok(input) + } + } + /// flow-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct Qos { - /// prefetch-count (Generated) - pub prefetch_count: ShortUInt, - /// global (Generated) - pub global: Boolean, + pub struct FlowOk { + /// active (Generated) + pub active: Boolean, } - impl Qos { - /// Get the AMQP class id for qos (Generated) + impl FlowOk { + /// Get the AMQP class id for flow-ok (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 60 + 20 } - /// Get the AMQP method id for qos (Generated) + /// Get the AMQP method id for flow-ok (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 10 + 21 } } - /// Parse qos (Generated) - pub fn parse_qos<I: ParsableInput>(i: I) -> ParserResult<I, Qos> { - let (i, _) = parse_long_uint(i)?; - let (i, prefetch_count) = parse_short_uint(i)?; - let (i, flags) = parse_flags(i, &["global"])?; + /// Parse flow-ok (Generated) + pub fn parse_flow_ok<I: ParsableInput>(i: I) -> ParserResult<I, FlowOk> { + let (i, flags) = parse_flags(i, &["active"])?; Ok(( i, - Qos { - prefetch_count, - global: flags.get_flag("global").unwrap_or(false), + FlowOk { + active: flags.get_flag("active").unwrap_or(false), }, )) } - /// Serialize qos (Generated) - pub fn gen_qos<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a Qos, + /// Serialize flow-ok (Generated) + pub fn gen_flow_ok<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a FlowOk, ) -> impl SerializeFn<W> + 'a { move |mut input| { let mut flags = AMQPFlags::default(); - flags.add_flag("global".to_string(), method.global); - input = gen_id(10)(input)?; - input = gen_long_uint(0)(input)?; - input = gen_short_uint(method.prefetch_count)(input)?; + flags.add_flag("active".to_string(), method.active); + input = gen_id(21)(input)?; input = gen_flags(&flags)(input)?; Ok(input) } } - /// qos-ok (Generated) + /// close (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct QosOk {} + pub struct Close { + /// reply-code (Generated) + pub reply_code: ShortUInt, + /// reply-text (Generated) + pub reply_text: ShortString, + /// class-id (Generated) + pub class_id: ShortUInt, + /// method-id (Generated) + pub method_id: ShortUInt, + } - impl QosOk { - /// Get the AMQP class id for qos-ok (Generated) + impl Close { + /// Get the AMQP class id for close (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 60 + 20 } - /// Get the AMQP method id for qos-ok (Generated) + /// Get the AMQP method id for close (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 11 + 40 } } - /// Parse qos-ok (Generated) - pub fn parse_qos_ok<I: ParsableInput>(i: I) -> ParserResult<I, QosOk> { - Ok((i, QosOk {})) + /// Parse close (Generated) + pub fn parse_close<I: ParsableInput>(i: I) -> ParserResult<I, Close> { + let (i, reply_code) = parse_short_uint(i)?; + let (i, reply_text) = parse_short_string(i)?; + let (i, class_id) = parse_short_uint(i)?; + let (i, method_id) = parse_short_uint(i)?; + Ok(( + i, + Close { + reply_code, + reply_text, + class_id, + method_id, + }, + )) } - /// Serialize qos-ok (Generated) - pub fn gen_qos_ok<'a, W: Write + BackToTheBuffer + 'a>( - _: &'a QosOk, + /// Serialize close (Generated) + pub fn gen_close<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Close, ) -> impl SerializeFn<W> + 'a { move |mut input| { - input = gen_id(11)(input)?; + input = gen_id(40)(input)?; + input = gen_short_uint(method.reply_code)(input)?; + input = gen_short_string(method.reply_text.as_str())(input)?; + input = gen_short_uint(method.class_id)(input)?; + input = gen_short_uint(method.method_id)(input)?; Ok(input) } } - /// consume (Generated) + /// close-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct Consume { - /// queue (Generated) - pub queue: ShortString, - /// consumer-tag (Generated) - pub consumer_tag: ShortString, - /// no-local (Generated) - pub no_local: Boolean, - /// no-ack (Generated) - pub no_ack: Boolean, + pub struct CloseOk {} + + impl CloseOk { + /// Get the AMQP class id for close-ok (Generated) + pub fn get_amqp_class_id(&self) -> Identifier { + 20 + } + + /// Get the AMQP method id for close-ok (Generated) + pub fn get_amqp_method_id(&self) -> Identifier { + 41 + } + } + + /// Parse close-ok (Generated) + pub fn parse_close_ok<I: ParsableInput>(i: I) -> ParserResult<I, CloseOk> { + Ok((i, CloseOk {})) + } + + /// Serialize close-ok (Generated) + pub fn gen_close_ok<'a, W: Write + BackToTheBuffer + 'a>( + _: &'a CloseOk, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(41)(input)?; + Ok(input) + } + } +} +/// access (generated) +pub mod access { + use super::*; + + /// Parse access (Generated) + pub fn parse_access<I: ParsableInput>(i: I) -> ParserResult<I, access::AMQPMethod> { + context( + "parse_access", + map_opt( + flat_map(parse_id, |id| { + move |i| match id { + 10 => context( + "parse_request", + map(map(parse_request, AMQPMethod::Request), Some), + )(i), + 11 => context( + "parse_request_ok", + map(map(parse_request_ok, AMQPMethod::RequestOk), Some), + )(i), + _ => Ok((i, None)), + } + }), + std::convert::identity, + ), + )(i) + } + + /// Serialize access (Generated) + pub fn gen_access<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a AMQPMethod, + ) -> impl SerializeFn<W> + 'a { + cookie_factory::sequence::pair(gen_id(30), move |input| match *method { + AMQPMethod::Request(ref request) => gen_request(request)(input), + AMQPMethod::RequestOk(ref request_ok) => gen_request_ok(request_ok)(input), + }) + } + + /// The available methods in access + #[derive(Clone, Debug, PartialEq)] + pub enum AMQPMethod { + /// request (Generated) + Request(Request), + /// request-ok (Generated) + RequestOk(RequestOk), + } + + /// request (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Request { + /// realm (Generated) + pub realm: ShortString, /// exclusive (Generated) pub exclusive: Boolean, - /// nowait (Generated) - pub nowait: Boolean, - /// arguments (Generated) - pub arguments: FieldTable, + /// passive (Generated) + pub passive: Boolean, + /// active (Generated) + pub active: Boolean, + /// write (Generated) + pub write: Boolean, + /// read (Generated) + pub read: Boolean, } - impl Consume { - /// Get the AMQP class id for consume (Generated) + impl Request { + /// Get the AMQP class id for request (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 60 + 30 } - /// Get the AMQP method id for consume (Generated) + /// Get the AMQP method id for request (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 20 + 10 } } - /// Parse consume (Generated) - pub fn parse_consume<I: ParsableInput>(i: I) -> ParserResult<I, Consume> { - let (i, _) = parse_short_uint(i)?; - let (i, queue) = parse_short_string(i)?; - let (i, consumer_tag) = parse_short_string(i)?; - let (i, flags) = parse_flags(i, &["no-local", "no-ack", "exclusive", "nowait"])?; - let (i, arguments) = parse_field_table(i)?; + /// Parse request (Generated) + pub fn parse_request<I: ParsableInput>(i: I) -> ParserResult<I, Request> { + let (i, realm) = parse_short_string(i)?; + let (i, flags) = parse_flags(i, &["exclusive", "passive", "active", "write", "read"])?; Ok(( i, - Consume { - queue, - consumer_tag, - no_local: flags.get_flag("no_local").unwrap_or(false), - no_ack: flags.get_flag("no_ack").unwrap_or(false), + Request { + realm, exclusive: flags.get_flag("exclusive").unwrap_or(false), - nowait: flags.get_flag("nowait").unwrap_or(false), - arguments, + passive: flags.get_flag("passive").unwrap_or(false), + active: flags.get_flag("active").unwrap_or(false), + write: flags.get_flag("write").unwrap_or(false), + read: flags.get_flag("read").unwrap_or(false), }, )) } - /// Serialize consume (Generated) - pub fn gen_consume<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a Consume, + /// Serialize request (Generated) + pub fn gen_request<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Request, ) -> impl SerializeFn<W> + 'a { move |mut input| { let mut flags = AMQPFlags::default(); - flags.add_flag("no_local".to_string(), method.no_local); - flags.add_flag("no_ack".to_string(), method.no_ack); flags.add_flag("exclusive".to_string(), method.exclusive); - flags.add_flag("nowait".to_string(), method.nowait); - input = gen_id(20)(input)?; - input = gen_short_uint(0)(input)?; - input = gen_short_string(method.queue.as_str())(input)?; - input = gen_short_string(method.consumer_tag.as_str())(input)?; + flags.add_flag("passive".to_string(), method.passive); + flags.add_flag("active".to_string(), method.active); + flags.add_flag("write".to_string(), method.write); + flags.add_flag("read".to_string(), method.read); + input = gen_id(10)(input)?; + input = gen_short_string(method.realm.as_str())(input)?; input = gen_flags(&flags)(input)?; - input = gen_field_table(&method.arguments)(input)?; Ok(input) } } - /// consume-ok (Generated) + /// request-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct ConsumeOk { - /// consumer-tag (Generated) - pub consumer_tag: ShortString, - } + pub struct RequestOk {} - impl ConsumeOk { - /// Get the AMQP class id for consume-ok (Generated) + impl RequestOk { + /// Get the AMQP class id for request-ok (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 60 + 30 } - /// Get the AMQP method id for consume-ok (Generated) + /// Get the AMQP method id for request-ok (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 21 + 11 } } - /// Parse consume-ok (Generated) - pub fn parse_consume_ok<I: ParsableInput>(i: I) -> ParserResult<I, ConsumeOk> { - let (i, consumer_tag) = parse_short_string(i)?; - Ok((i, ConsumeOk { consumer_tag })) + /// Parse request-ok (Generated) + pub fn parse_request_ok<I: ParsableInput>(i: I) -> ParserResult<I, RequestOk> { + let (i, _) = parse_short_uint(i)?; + Ok((i, RequestOk {})) } - /// Serialize consume-ok (Generated) - pub fn gen_consume_ok<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a ConsumeOk, + /// Serialize request-ok (Generated) + pub fn gen_request_ok<'a, W: Write + BackToTheBuffer + 'a>( + _method: &'a RequestOk, ) -> impl SerializeFn<W> + 'a { move |mut input| { - input = gen_id(21)(input)?; - input = gen_short_string(method.consumer_tag.as_str())(input)?; + input = gen_id(11)(input)?; + input = gen_short_uint(1)(input)?; Ok(input) } } - /// cancel (Generated) +} +/// exchange (generated) +pub mod exchange { + use super::*; + + /// Parse exchange (Generated) + pub fn parse_exchange<I: ParsableInput>(i: I) -> ParserResult<I, exchange::AMQPMethod> { + context( + "parse_exchange", + map_opt( + flat_map(parse_id, |id| { + move |i| match id { + 10 => context( + "parse_declare", + map(map(parse_declare, AMQPMethod::Declare), Some), + )(i), + 11 => context( + "parse_declare_ok", + map(map(parse_declare_ok, AMQPMethod::DeclareOk), Some), + )(i), + 20 => context( + "parse_delete", + map(map(parse_delete, AMQPMethod::Delete), Some), + )(i), + 21 => context( + "parse_delete_ok", + map(map(parse_delete_ok, AMQPMethod::DeleteOk), Some), + )(i), + 30 => { + context("parse_bind", map(map(parse_bind, AMQPMethod::Bind), Some))(i) + } + 31 => context( + "parse_bind_ok", + map(map(parse_bind_ok, AMQPMethod::BindOk), Some), + )(i), + 40 => context( + "parse_unbind", + map(map(parse_unbind, AMQPMethod::Unbind), Some), + )(i), + 51 => context( + "parse_unbind_ok", + map(map(parse_unbind_ok, AMQPMethod::UnbindOk), Some), + )(i), + _ => Ok((i, None)), + } + }), + std::convert::identity, + ), + )(i) + } + + /// Serialize exchange (Generated) + pub fn gen_exchange<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a AMQPMethod, + ) -> impl SerializeFn<W> + 'a { + cookie_factory::sequence::pair(gen_id(40), move |input| match *method { + AMQPMethod::Declare(ref declare) => gen_declare(declare)(input), + AMQPMethod::DeclareOk(ref declare_ok) => gen_declare_ok(declare_ok)(input), + AMQPMethod::Delete(ref delete) => gen_delete(delete)(input), + AMQPMethod::DeleteOk(ref delete_ok) => gen_delete_ok(delete_ok)(input), + AMQPMethod::Bind(ref bind) => gen_bind(bind)(input), + AMQPMethod::BindOk(ref bind_ok) => gen_bind_ok(bind_ok)(input), + AMQPMethod::Unbind(ref unbind) => gen_unbind(unbind)(input), + AMQPMethod::UnbindOk(ref unbind_ok) => gen_unbind_ok(unbind_ok)(input), + }) + } + + /// The available methods in exchange + #[derive(Clone, Debug, PartialEq)] + pub enum AMQPMethod { + /// declare (Generated) + Declare(Declare), + /// declare-ok (Generated) + DeclareOk(DeclareOk), + /// delete (Generated) + Delete(Delete), + /// delete-ok (Generated) + DeleteOk(DeleteOk), + /// bind (Generated) + Bind(Bind), + /// bind-ok (Generated) + BindOk(BindOk), + /// unbind (Generated) + Unbind(Unbind), + /// unbind-ok (Generated) + UnbindOk(UnbindOk), + } + + /// declare (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct Cancel { - /// consumer-tag (Generated) - pub consumer_tag: ShortString, + pub struct Declare { + /// exchange (Generated) + pub exchange: ShortString, + /// type (Generated) + pub kind: ShortString, + /// passive (Generated) + pub passive: Boolean, + /// durable (Generated) + pub durable: Boolean, + /// auto-delete (Generated) + pub auto_delete: Boolean, + /// internal (Generated) + pub internal: Boolean, /// nowait (Generated) pub nowait: Boolean, + /// arguments (Generated) + pub arguments: FieldTable, } - impl Cancel { - /// Get the AMQP class id for cancel (Generated) + impl Declare { + /// Get the AMQP class id for declare (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 60 + 40 } - /// Get the AMQP method id for cancel (Generated) + /// Get the AMQP method id for declare (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 30 + 10 } } - /// Parse cancel (Generated) - pub fn parse_cancel<I: ParsableInput>(i: I) -> ParserResult<I, Cancel> { - let (i, consumer_tag) = parse_short_string(i)?; - let (i, flags) = parse_flags(i, &["nowait"])?; + /// Parse declare (Generated) + pub fn parse_declare<I: ParsableInput>(i: I) -> ParserResult<I, Declare> { + let (i, _) = parse_short_uint(i)?; + let (i, exchange) = parse_short_string(i)?; + let (i, kind) = parse_short_string(i)?; + let (i, flags) = parse_flags( + i, + &["passive", "durable", "auto-delete", "internal", "nowait"], + )?; + let (i, arguments) = parse_field_table(i)?; Ok(( i, - Cancel { - consumer_tag, + Declare { + exchange, + kind, + passive: flags.get_flag("passive").unwrap_or(false), + durable: flags.get_flag("durable").unwrap_or(false), + auto_delete: flags.get_flag("auto_delete").unwrap_or(false), + internal: flags.get_flag("internal").unwrap_or(false), nowait: flags.get_flag("nowait").unwrap_or(false), + arguments, }, )) } - /// Serialize cancel (Generated) - pub fn gen_cancel<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a Cancel, + /// Serialize declare (Generated) + pub fn gen_declare<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Declare, ) -> impl SerializeFn<W> + 'a { move |mut input| { let mut flags = AMQPFlags::default(); + flags.add_flag("passive".to_string(), method.passive); + flags.add_flag("durable".to_string(), method.durable); + flags.add_flag("auto_delete".to_string(), method.auto_delete); + flags.add_flag("internal".to_string(), method.internal); flags.add_flag("nowait".to_string(), method.nowait); - input = gen_id(30)(input)?; - input = gen_short_string(method.consumer_tag.as_str())(input)?; + input = gen_id(10)(input)?; + input = gen_short_uint(0)(input)?; + input = gen_short_string(method.exchange.as_str())(input)?; + input = gen_short_string(method.kind.as_str())(input)?; input = gen_flags(&flags)(input)?; + input = gen_field_table(&method.arguments)(input)?; Ok(input) } } - /// cancel-ok (Generated) + /// declare-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct CancelOk { - /// consumer-tag (Generated) - pub consumer_tag: ShortString, - } + pub struct DeclareOk {} - impl CancelOk { - /// Get the AMQP class id for cancel-ok (Generated) + impl DeclareOk { + /// Get the AMQP class id for declare-ok (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 60 + 40 } - /// Get the AMQP method id for cancel-ok (Generated) + /// Get the AMQP method id for declare-ok (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 31 + 11 } } - /// Parse cancel-ok (Generated) - pub fn parse_cancel_ok<I: ParsableInput>(i: I) -> ParserResult<I, CancelOk> { - let (i, consumer_tag) = parse_short_string(i)?; - Ok((i, CancelOk { consumer_tag })) + /// Parse declare-ok (Generated) + pub fn parse_declare_ok<I: ParsableInput>(i: I) -> ParserResult<I, DeclareOk> { + Ok((i, DeclareOk {})) } - /// Serialize cancel-ok (Generated) - pub fn gen_cancel_ok<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a CancelOk, + /// Serialize declare-ok (Generated) + pub fn gen_declare_ok<'a, W: Write + BackToTheBuffer + 'a>( + _: &'a DeclareOk, ) -> impl SerializeFn<W> + 'a { move |mut input| { - input = gen_id(31)(input)?; - input = gen_short_string(method.consumer_tag.as_str())(input)?; + input = gen_id(11)(input)?; Ok(input) } } - /// publish (Generated) + /// delete (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct Publish { + pub struct Delete { /// exchange (Generated) pub exchange: ShortString, - /// routing-key (Generated) - pub routing_key: ShortString, - /// mandatory (Generated) - pub mandatory: Boolean, - /// immediate (Generated) - pub immediate: Boolean, + /// if-unused (Generated) + pub if_unused: Boolean, + /// nowait (Generated) + pub nowait: Boolean, } - impl Publish { - /// Get the AMQP class id for publish (Generated) + impl Delete { + /// Get the AMQP class id for delete (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 60 + 40 } - /// Get the AMQP method id for publish (Generated) + /// Get the AMQP method id for delete (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 40 + 20 } } - /// Parse publish (Generated) - pub fn parse_publish<I: ParsableInput>(i: I) -> ParserResult<I, Publish> { + /// Parse delete (Generated) + pub fn parse_delete<I: ParsableInput>(i: I) -> ParserResult<I, Delete> { let (i, _) = parse_short_uint(i)?; let (i, exchange) = parse_short_string(i)?; - let (i, routing_key) = parse_short_string(i)?; - let (i, flags) = parse_flags(i, &["mandatory", "immediate"])?; + let (i, flags) = parse_flags(i, &["if-unused", "nowait"])?; Ok(( i, - Publish { + Delete { exchange, - routing_key, - mandatory: flags.get_flag("mandatory").unwrap_or(false), - immediate: flags.get_flag("immediate").unwrap_or(false), + if_unused: flags.get_flag("if_unused").unwrap_or(false), + nowait: flags.get_flag("nowait").unwrap_or(false), }, )) } - /// Serialize publish (Generated) - pub fn gen_publish<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a Publish, + /// Serialize delete (Generated) + pub fn gen_delete<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Delete, ) -> impl SerializeFn<W> + 'a { move |mut input| { let mut flags = AMQPFlags::default(); - flags.add_flag("mandatory".to_string(), method.mandatory); - flags.add_flag("immediate".to_string(), method.immediate); - input = gen_id(40)(input)?; + flags.add_flag("if_unused".to_string(), method.if_unused); + flags.add_flag("nowait".to_string(), method.nowait); + input = gen_id(20)(input)?; input = gen_short_uint(0)(input)?; input = gen_short_string(method.exchange.as_str())(input)?; - input = gen_short_string(method.routing_key.as_str())(input)?; input = gen_flags(&flags)(input)?; Ok(input) } } - /// return (Generated) + /// delete-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct Return { - /// reply-code (Generated) - pub reply_code: ShortUInt, - /// reply-text (Generated) - pub reply_text: ShortString, - /// exchange (Generated) - pub exchange: ShortString, - /// routing-key (Generated) - pub routing_key: ShortString, - } + pub struct DeleteOk {} - impl Return { - /// Get the AMQP class id for return (Generated) + impl DeleteOk { + /// Get the AMQP class id for delete-ok (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 60 + 40 } - /// Get the AMQP method id for return (Generated) + /// Get the AMQP method id for delete-ok (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 50 + 21 } } - /// Parse return (Generated) - pub fn parse_return<I: ParsableInput>(i: I) -> ParserResult<I, Return> { - let (i, reply_code) = parse_short_uint(i)?; - let (i, reply_text) = parse_short_string(i)?; - let (i, exchange) = parse_short_string(i)?; - let (i, routing_key) = parse_short_string(i)?; - Ok(( - i, - Return { - reply_code, - reply_text, - exchange, - routing_key, - }, - )) + /// Parse delete-ok (Generated) + pub fn parse_delete_ok<I: ParsableInput>(i: I) -> ParserResult<I, DeleteOk> { + Ok((i, DeleteOk {})) } - /// Serialize return (Generated) - pub fn gen_return<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a Return, + /// Serialize delete-ok (Generated) + pub fn gen_delete_ok<'a, W: Write + BackToTheBuffer + 'a>( + _: &'a DeleteOk, ) -> impl SerializeFn<W> + 'a { move |mut input| { - input = gen_id(50)(input)?; - input = gen_short_uint(method.reply_code)(input)?; - input = gen_short_string(method.reply_text.as_str())(input)?; - input = gen_short_string(method.exchange.as_str())(input)?; - input = gen_short_string(method.routing_key.as_str())(input)?; + input = gen_id(21)(input)?; Ok(input) } } - /// deliver (Generated) + /// bind (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct Deliver { - /// consumer-tag (Generated) - pub consumer_tag: ShortString, - /// delivery-tag (Generated) - pub delivery_tag: LongLongUInt, - /// redelivered (Generated) - pub redelivered: Boolean, - /// exchange (Generated) - pub exchange: ShortString, + pub struct Bind { + /// destination (Generated) + pub destination: ShortString, + /// source (Generated) + pub source: ShortString, /// routing-key (Generated) pub routing_key: ShortString, + /// nowait (Generated) + pub nowait: Boolean, + /// arguments (Generated) + pub arguments: FieldTable, } - impl Deliver { - /// Get the AMQP class id for deliver (Generated) + impl Bind { + /// Get the AMQP class id for bind (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 60 + 40 } - /// Get the AMQP method id for deliver (Generated) + /// Get the AMQP method id for bind (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 60 + 30 } } - /// Parse deliver (Generated) - pub fn parse_deliver<I: ParsableInput>(i: I) -> ParserResult<I, Deliver> { - let (i, consumer_tag) = parse_short_string(i)?; - let (i, delivery_tag) = parse_long_long_uint(i)?; - let (i, flags) = parse_flags(i, &["redelivered"])?; - let (i, exchange) = parse_short_string(i)?; + /// Parse bind (Generated) + pub fn parse_bind<I: ParsableInput>(i: I) -> ParserResult<I, Bind> { + let (i, _) = parse_short_uint(i)?; + let (i, destination) = parse_short_string(i)?; + let (i, source) = parse_short_string(i)?; let (i, routing_key) = parse_short_string(i)?; + let (i, flags) = parse_flags(i, &["nowait"])?; + let (i, arguments) = parse_field_table(i)?; Ok(( i, - Deliver { - consumer_tag, - delivery_tag, - redelivered: flags.get_flag("redelivered").unwrap_or(false), - exchange, + Bind { + destination, + source, routing_key, + nowait: flags.get_flag("nowait").unwrap_or(false), + arguments, }, )) } - /// Serialize deliver (Generated) - pub fn gen_deliver<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a Deliver, + /// Serialize bind (Generated) + pub fn gen_bind<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Bind, ) -> impl SerializeFn<W> + 'a { move |mut input| { let mut flags = AMQPFlags::default(); - flags.add_flag("redelivered".to_string(), method.redelivered); - input = gen_id(60)(input)?; - input = gen_short_string(method.consumer_tag.as_str())(input)?; - input = gen_long_long_uint(method.delivery_tag)(input)?; - input = gen_flags(&flags)(input)?; - input = gen_short_string(method.exchange.as_str())(input)?; + flags.add_flag("nowait".to_string(), method.nowait); + input = gen_id(30)(input)?; + input = gen_short_uint(0)(input)?; + input = gen_short_string(method.destination.as_str())(input)?; + input = gen_short_string(method.source.as_str())(input)?; input = gen_short_string(method.routing_key.as_str())(input)?; + input = gen_flags(&flags)(input)?; + input = gen_field_table(&method.arguments)(input)?; Ok(input) } } - /// get (Generated) + /// bind-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct Get { - /// queue (Generated) - pub queue: ShortString, - /// no-ack (Generated) - pub no_ack: Boolean, + pub struct BindOk {} + + impl BindOk { + /// Get the AMQP class id for bind-ok (Generated) + pub fn get_amqp_class_id(&self) -> Identifier { + 40 + } + + /// Get the AMQP method id for bind-ok (Generated) + pub fn get_amqp_method_id(&self) -> Identifier { + 31 + } + } + + /// Parse bind-ok (Generated) + pub fn parse_bind_ok<I: ParsableInput>(i: I) -> ParserResult<I, BindOk> { + Ok((i, BindOk {})) + } + + /// Serialize bind-ok (Generated) + pub fn gen_bind_ok<'a, W: Write + BackToTheBuffer + 'a>( + _: &'a BindOk, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(31)(input)?; + Ok(input) + } + } + /// unbind (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Unbind { + /// destination (Generated) + pub destination: ShortString, + /// source (Generated) + pub source: ShortString, + /// routing-key (Generated) + pub routing_key: ShortString, + /// nowait (Generated) + pub nowait: Boolean, + /// arguments (Generated) + pub arguments: FieldTable, } - impl Get { - /// Get the AMQP class id for get (Generated) + impl Unbind { + /// Get the AMQP class id for unbind (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 60 + 40 } - /// Get the AMQP method id for get (Generated) + /// Get the AMQP method id for unbind (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 70 + 40 } } - /// Parse get (Generated) - pub fn parse_get<I: ParsableInput>(i: I) -> ParserResult<I, Get> { + /// Parse unbind (Generated) + pub fn parse_unbind<I: ParsableInput>(i: I) -> ParserResult<I, Unbind> { let (i, _) = parse_short_uint(i)?; - let (i, queue) = parse_short_string(i)?; - let (i, flags) = parse_flags(i, &["no-ack"])?; + let (i, destination) = parse_short_string(i)?; + let (i, source) = parse_short_string(i)?; + let (i, routing_key) = parse_short_string(i)?; + let (i, flags) = parse_flags(i, &["nowait"])?; + let (i, arguments) = parse_field_table(i)?; Ok(( i, - Get { - queue, - no_ack: flags.get_flag("no_ack").unwrap_or(false), + Unbind { + destination, + source, + routing_key, + nowait: flags.get_flag("nowait").unwrap_or(false), + arguments, }, )) } - /// Serialize get (Generated) - pub fn gen_get<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a Get, + /// Serialize unbind (Generated) + pub fn gen_unbind<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Unbind, ) -> impl SerializeFn<W> + 'a { move |mut input| { let mut flags = AMQPFlags::default(); - flags.add_flag("no_ack".to_string(), method.no_ack); - input = gen_id(70)(input)?; + flags.add_flag("nowait".to_string(), method.nowait); + input = gen_id(40)(input)?; input = gen_short_uint(0)(input)?; - input = gen_short_string(method.queue.as_str())(input)?; + input = gen_short_string(method.destination.as_str())(input)?; + input = gen_short_string(method.source.as_str())(input)?; + input = gen_short_string(method.routing_key.as_str())(input)?; input = gen_flags(&flags)(input)?; + input = gen_field_table(&method.arguments)(input)?; Ok(input) } } - /// get-ok (Generated) + /// unbind-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct GetOk { - /// delivery-tag (Generated) - pub delivery_tag: LongLongUInt, - /// redelivered (Generated) - pub redelivered: Boolean, - /// exchange (Generated) - pub exchange: ShortString, - /// routing-key (Generated) - pub routing_key: ShortString, - /// message-count (Generated) - pub message_count: LongUInt, - } + pub struct UnbindOk {} - impl GetOk { - /// Get the AMQP class id for get-ok (Generated) + impl UnbindOk { + /// Get the AMQP class id for unbind-ok (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 60 + 40 } - /// Get the AMQP method id for get-ok (Generated) + /// Get the AMQP method id for unbind-ok (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 71 + 51 } } - /// Parse get-ok (Generated) - pub fn parse_get_ok<I: ParsableInput>(i: I) -> ParserResult<I, GetOk> { - let (i, delivery_tag) = parse_long_long_uint(i)?; - let (i, flags) = parse_flags(i, &["redelivered"])?; - let (i, exchange) = parse_short_string(i)?; - let (i, routing_key) = parse_short_string(i)?; - let (i, message_count) = parse_long_uint(i)?; - Ok(( - i, - GetOk { - delivery_tag, - redelivered: flags.get_flag("redelivered").unwrap_or(false), - exchange, - routing_key, - message_count, - }, - )) + /// Parse unbind-ok (Generated) + pub fn parse_unbind_ok<I: ParsableInput>(i: I) -> ParserResult<I, UnbindOk> { + Ok((i, UnbindOk {})) } - /// Serialize get-ok (Generated) - pub fn gen_get_ok<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a GetOk, + /// Serialize unbind-ok (Generated) + pub fn gen_unbind_ok<'a, W: Write + BackToTheBuffer + 'a>( + _: &'a UnbindOk, ) -> impl SerializeFn<W> + 'a { move |mut input| { - let mut flags = AMQPFlags::default(); - flags.add_flag("redelivered".to_string(), method.redelivered); - input = gen_id(71)(input)?; - input = gen_long_long_uint(method.delivery_tag)(input)?; - input = gen_flags(&flags)(input)?; - input = gen_short_string(method.exchange.as_str())(input)?; - input = gen_short_string(method.routing_key.as_str())(input)?; - input = gen_long_uint(method.message_count)(input)?; + input = gen_id(51)(input)?; Ok(input) } } - /// get-empty (Generated) +} +/// queue (generated) +pub mod queue { + use super::*; + + /// Parse queue (Generated) + pub fn parse_queue<I: ParsableInput>(i: I) -> ParserResult<I, queue::AMQPMethod> { + context( + "parse_queue", + map_opt( + flat_map(parse_id, |id| { + move |i| match id { + 10 => context( + "parse_declare", + map(map(parse_declare, AMQPMethod::Declare), Some), + )(i), + 11 => context( + "parse_declare_ok", + map(map(parse_declare_ok, AMQPMethod::DeclareOk), Some), + )(i), + 20 => { + context("parse_bind", map(map(parse_bind, AMQPMethod::Bind), Some))(i) + } + 21 => context( + "parse_bind_ok", + map(map(parse_bind_ok, AMQPMethod::BindOk), Some), + )(i), + 30 => context( + "parse_purge", + map(map(parse_purge, AMQPMethod::Purge), Some), + )(i), + 31 => context( + "parse_purge_ok", + map(map(parse_purge_ok, AMQPMethod::PurgeOk), Some), + )(i), + 40 => context( + "parse_delete", + map(map(parse_delete, AMQPMethod::Delete), Some), + )(i), + 41 => context( + "parse_delete_ok", + map(map(parse_delete_ok, AMQPMethod::DeleteOk), Some), + )(i), + 50 => context( + "parse_unbind", + map(map(parse_unbind, AMQPMethod::Unbind), Some), + )(i), + 51 => context( + "parse_unbind_ok", + map(map(parse_unbind_ok, AMQPMethod::UnbindOk), Some), + )(i), + _ => Ok((i, None)), + } + }), + std::convert::identity, + ), + )(i) + } + + /// Serialize queue (Generated) + pub fn gen_queue<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a AMQPMethod, + ) -> impl SerializeFn<W> + 'a { + cookie_factory::sequence::pair(gen_id(50), move |input| match *method { + AMQPMethod::Declare(ref declare) => gen_declare(declare)(input), + AMQPMethod::DeclareOk(ref declare_ok) => gen_declare_ok(declare_ok)(input), + AMQPMethod::Bind(ref bind) => gen_bind(bind)(input), + AMQPMethod::BindOk(ref bind_ok) => gen_bind_ok(bind_ok)(input), + AMQPMethod::Purge(ref purge) => gen_purge(purge)(input), + AMQPMethod::PurgeOk(ref purge_ok) => gen_purge_ok(purge_ok)(input), + AMQPMethod::Delete(ref delete) => gen_delete(delete)(input), + AMQPMethod::DeleteOk(ref delete_ok) => gen_delete_ok(delete_ok)(input), + AMQPMethod::Unbind(ref unbind) => gen_unbind(unbind)(input), + AMQPMethod::UnbindOk(ref unbind_ok) => gen_unbind_ok(unbind_ok)(input), + }) + } + + /// The available methods in queue + #[derive(Clone, Debug, PartialEq)] + pub enum AMQPMethod { + /// declare (Generated) + Declare(Declare), + /// declare-ok (Generated) + DeclareOk(DeclareOk), + /// bind (Generated) + Bind(Bind), + /// bind-ok (Generated) + BindOk(BindOk), + /// purge (Generated) + Purge(Purge), + /// purge-ok (Generated) + PurgeOk(PurgeOk), + /// delete (Generated) + Delete(Delete), + /// delete-ok (Generated) + DeleteOk(DeleteOk), + /// unbind (Generated) + Unbind(Unbind), + /// unbind-ok (Generated) + UnbindOk(UnbindOk), + } + + /// declare (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct GetEmpty {} + pub struct Declare { + /// queue (Generated) + pub queue: ShortString, + /// passive (Generated) + pub passive: Boolean, + /// durable (Generated) + pub durable: Boolean, + /// exclusive (Generated) + pub exclusive: Boolean, + /// auto-delete (Generated) + pub auto_delete: Boolean, + /// nowait (Generated) + pub nowait: Boolean, + /// arguments (Generated) + pub arguments: FieldTable, + } - impl GetEmpty { - /// Get the AMQP class id for get-empty (Generated) + impl Declare { + /// Get the AMQP class id for declare (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 60 + 50 } - /// Get the AMQP method id for get-empty (Generated) + /// Get the AMQP method id for declare (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 72 + 10 } } - /// Parse get-empty (Generated) - pub fn parse_get_empty<I: ParsableInput>(i: I) -> ParserResult<I, GetEmpty> { - let (i, _) = parse_short_string(i)?; - Ok((i, GetEmpty {})) + /// Parse declare (Generated) + pub fn parse_declare<I: ParsableInput>(i: I) -> ParserResult<I, Declare> { + let (i, _) = parse_short_uint(i)?; + let (i, queue) = parse_short_string(i)?; + let (i, flags) = parse_flags( + i, + &["passive", "durable", "exclusive", "auto-delete", "nowait"], + )?; + let (i, arguments) = parse_field_table(i)?; + Ok(( + i, + Declare { + queue, + passive: flags.get_flag("passive").unwrap_or(false), + durable: flags.get_flag("durable").unwrap_or(false), + exclusive: flags.get_flag("exclusive").unwrap_or(false), + auto_delete: flags.get_flag("auto_delete").unwrap_or(false), + nowait: flags.get_flag("nowait").unwrap_or(false), + arguments, + }, + )) } - /// Serialize get-empty (Generated) - pub fn gen_get_empty<'a, W: Write + BackToTheBuffer + 'a>( - _method: &'a GetEmpty, + /// Serialize declare (Generated) + pub fn gen_declare<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Declare, ) -> impl SerializeFn<W> + 'a { move |mut input| { - input = gen_id(72)(input)?; - input = gen_short_string("")(input)?; + let mut flags = AMQPFlags::default(); + flags.add_flag("passive".to_string(), method.passive); + flags.add_flag("durable".to_string(), method.durable); + flags.add_flag("exclusive".to_string(), method.exclusive); + flags.add_flag("auto_delete".to_string(), method.auto_delete); + flags.add_flag("nowait".to_string(), method.nowait); + input = gen_id(10)(input)?; + input = gen_short_uint(0)(input)?; + input = gen_short_string(method.queue.as_str())(input)?; + input = gen_flags(&flags)(input)?; + input = gen_field_table(&method.arguments)(input)?; Ok(input) } } - /// ack (Generated) + /// declare-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct Ack { - /// delivery-tag (Generated) - pub delivery_tag: LongLongUInt, - /// multiple (Generated) - pub multiple: Boolean, + pub struct DeclareOk { + /// queue (Generated) + pub queue: ShortString, + /// message-count (Generated) + pub message_count: LongUInt, + /// consumer-count (Generated) + pub consumer_count: LongUInt, } - impl Ack { - /// Get the AMQP class id for ack (Generated) + impl DeclareOk { + /// Get the AMQP class id for declare-ok (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 60 + 50 } - /// Get the AMQP method id for ack (Generated) + /// Get the AMQP method id for declare-ok (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 80 + 11 } } - /// Parse ack (Generated) - pub fn parse_ack<I: ParsableInput>(i: I) -> ParserResult<I, Ack> { - let (i, delivery_tag) = parse_long_long_uint(i)?; - let (i, flags) = parse_flags(i, &["multiple"])?; + /// Parse declare-ok (Generated) + pub fn parse_declare_ok<I: ParsableInput>(i: I) -> ParserResult<I, DeclareOk> { + let (i, queue) = parse_short_string(i)?; + let (i, message_count) = parse_long_uint(i)?; + let (i, consumer_count) = parse_long_uint(i)?; Ok(( i, - Ack { - delivery_tag, - multiple: flags.get_flag("multiple").unwrap_or(false), + DeclareOk { + queue, + message_count, + consumer_count, }, )) } - /// Serialize ack (Generated) - pub fn gen_ack<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a Ack, + /// Serialize declare-ok (Generated) + pub fn gen_declare_ok<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a DeclareOk, ) -> impl SerializeFn<W> + 'a { move |mut input| { - let mut flags = AMQPFlags::default(); - flags.add_flag("multiple".to_string(), method.multiple); - input = gen_id(80)(input)?; - input = gen_long_long_uint(method.delivery_tag)(input)?; - input = gen_flags(&flags)(input)?; + input = gen_id(11)(input)?; + input = gen_short_string(method.queue.as_str())(input)?; + input = gen_long_uint(method.message_count)(input)?; + input = gen_long_uint(method.consumer_count)(input)?; Ok(input) } } - /// reject (Generated) + /// bind (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct Reject { - /// delivery-tag (Generated) - pub delivery_tag: LongLongUInt, - /// requeue (Generated) - pub requeue: Boolean, + pub struct Bind { + /// queue (Generated) + pub queue: ShortString, + /// exchange (Generated) + pub exchange: ShortString, + /// routing-key (Generated) + pub routing_key: ShortString, + /// nowait (Generated) + pub nowait: Boolean, + /// arguments (Generated) + pub arguments: FieldTable, } - impl Reject { - /// Get the AMQP class id for reject (Generated) + impl Bind { + /// Get the AMQP class id for bind (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 60 + 50 } - /// Get the AMQP method id for reject (Generated) + /// Get the AMQP method id for bind (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 90 + 20 } } - /// Parse reject (Generated) - pub fn parse_reject<I: ParsableInput>(i: I) -> ParserResult<I, Reject> { - let (i, delivery_tag) = parse_long_long_uint(i)?; - let (i, flags) = parse_flags(i, &["requeue"])?; + /// Parse bind (Generated) + pub fn parse_bind<I: ParsableInput>(i: I) -> ParserResult<I, Bind> { + let (i, _) = parse_short_uint(i)?; + let (i, queue) = parse_short_string(i)?; + let (i, exchange) = parse_short_string(i)?; + let (i, routing_key) = parse_short_string(i)?; + let (i, flags) = parse_flags(i, &["nowait"])?; + let (i, arguments) = parse_field_table(i)?; Ok(( i, - Reject { - delivery_tag, - requeue: flags.get_flag("requeue").unwrap_or(false), + Bind { + queue, + exchange, + routing_key, + nowait: flags.get_flag("nowait").unwrap_or(false), + arguments, }, )) } - /// Serialize reject (Generated) - pub fn gen_reject<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a Reject, + /// Serialize bind (Generated) + pub fn gen_bind<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Bind, ) -> impl SerializeFn<W> + 'a { move |mut input| { let mut flags = AMQPFlags::default(); - flags.add_flag("requeue".to_string(), method.requeue); - input = gen_id(90)(input)?; - input = gen_long_long_uint(method.delivery_tag)(input)?; + flags.add_flag("nowait".to_string(), method.nowait); + input = gen_id(20)(input)?; + input = gen_short_uint(0)(input)?; + input = gen_short_string(method.queue.as_str())(input)?; + input = gen_short_string(method.exchange.as_str())(input)?; + input = gen_short_string(method.routing_key.as_str())(input)?; input = gen_flags(&flags)(input)?; + input = gen_field_table(&method.arguments)(input)?; Ok(input) } } - /// recover-async (Generated) + /// bind-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct RecoverAsync { - /// requeue (Generated) - pub requeue: Boolean, - } + pub struct BindOk {} - impl RecoverAsync { - /// Get the AMQP class id for recover-async (Generated) + impl BindOk { + /// Get the AMQP class id for bind-ok (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 60 + 50 } - /// Get the AMQP method id for recover-async (Generated) + /// Get the AMQP method id for bind-ok (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 100 + 21 } } - /// Parse recover-async (Generated) - pub fn parse_recover_async<I: ParsableInput>(i: I) -> ParserResult<I, RecoverAsync> { - let (i, flags) = parse_flags(i, &["requeue"])?; - Ok(( - i, - RecoverAsync { - requeue: flags.get_flag("requeue").unwrap_or(false), - }, - )) + /// Parse bind-ok (Generated) + pub fn parse_bind_ok<I: ParsableInput>(i: I) -> ParserResult<I, BindOk> { + Ok((i, BindOk {})) } - /// Serialize recover-async (Generated) - pub fn gen_recover_async<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a RecoverAsync, + /// Serialize bind-ok (Generated) + pub fn gen_bind_ok<'a, W: Write + BackToTheBuffer + 'a>( + _: &'a BindOk, ) -> impl SerializeFn<W> + 'a { move |mut input| { - let mut flags = AMQPFlags::default(); - flags.add_flag("requeue".to_string(), method.requeue); - input = gen_id(100)(input)?; - input = gen_flags(&flags)(input)?; + input = gen_id(21)(input)?; Ok(input) } } - /// recover (Generated) + /// purge (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct Recover { - /// requeue (Generated) - pub requeue: Boolean, + pub struct Purge { + /// queue (Generated) + pub queue: ShortString, + /// nowait (Generated) + pub nowait: Boolean, } - impl Recover { - /// Get the AMQP class id for recover (Generated) + impl Purge { + /// Get the AMQP class id for purge (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 60 + 50 } - /// Get the AMQP method id for recover (Generated) + /// Get the AMQP method id for purge (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 110 + 30 } } - /// Parse recover (Generated) - pub fn parse_recover<I: ParsableInput>(i: I) -> ParserResult<I, Recover> { - let (i, flags) = parse_flags(i, &["requeue"])?; + /// Parse purge (Generated) + pub fn parse_purge<I: ParsableInput>(i: I) -> ParserResult<I, Purge> { + let (i, _) = parse_short_uint(i)?; + let (i, queue) = parse_short_string(i)?; + let (i, flags) = parse_flags(i, &["nowait"])?; Ok(( i, - Recover { - requeue: flags.get_flag("requeue").unwrap_or(false), + Purge { + queue, + nowait: flags.get_flag("nowait").unwrap_or(false), }, )) } - /// Serialize recover (Generated) - pub fn gen_recover<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a Recover, + /// Serialize purge (Generated) + pub fn gen_purge<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Purge, ) -> impl SerializeFn<W> + 'a { move |mut input| { let mut flags = AMQPFlags::default(); - flags.add_flag("requeue".to_string(), method.requeue); - input = gen_id(110)(input)?; + flags.add_flag("nowait".to_string(), method.nowait); + input = gen_id(30)(input)?; + input = gen_short_uint(0)(input)?; + input = gen_short_string(method.queue.as_str())(input)?; input = gen_flags(&flags)(input)?; Ok(input) } } - /// recover-ok (Generated) + /// purge-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct RecoverOk {} + pub struct PurgeOk { + /// message-count (Generated) + pub message_count: LongUInt, + } - impl RecoverOk { - /// Get the AMQP class id for recover-ok (Generated) + impl PurgeOk { + /// Get the AMQP class id for purge-ok (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 60 + 50 } - /// Get the AMQP method id for recover-ok (Generated) + /// Get the AMQP method id for purge-ok (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 111 + 31 } } - /// Parse recover-ok (Generated) - pub fn parse_recover_ok<I: ParsableInput>(i: I) -> ParserResult<I, RecoverOk> { - Ok((i, RecoverOk {})) + /// Parse purge-ok (Generated) + pub fn parse_purge_ok<I: ParsableInput>(i: I) -> ParserResult<I, PurgeOk> { + let (i, message_count) = parse_long_uint(i)?; + Ok((i, PurgeOk { message_count })) } - /// Serialize recover-ok (Generated) - pub fn gen_recover_ok<'a, W: Write + BackToTheBuffer + 'a>( - _: &'a RecoverOk, + /// Serialize purge-ok (Generated) + pub fn gen_purge_ok<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a PurgeOk, ) -> impl SerializeFn<W> + 'a { move |mut input| { - input = gen_id(111)(input)?; + input = gen_id(31)(input)?; + input = gen_long_uint(method.message_count)(input)?; Ok(input) } } - /// nack (Generated) + /// delete (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct Nack { - /// delivery-tag (Generated) - pub delivery_tag: LongLongUInt, - /// multiple (Generated) - pub multiple: Boolean, - /// requeue (Generated) - pub requeue: Boolean, + pub struct Delete { + /// queue (Generated) + pub queue: ShortString, + /// if-unused (Generated) + pub if_unused: Boolean, + /// if-empty (Generated) + pub if_empty: Boolean, + /// nowait (Generated) + pub nowait: Boolean, } - impl Nack { - /// Get the AMQP class id for nack (Generated) + impl Delete { + /// Get the AMQP class id for delete (Generated) pub fn get_amqp_class_id(&self) -> Identifier { - 60 + 50 } - /// Get the AMQP method id for nack (Generated) + /// Get the AMQP method id for delete (Generated) pub fn get_amqp_method_id(&self) -> Identifier { - 120 + 40 } } - /// Parse nack (Generated) - pub fn parse_nack<I: ParsableInput>(i: I) -> ParserResult<I, Nack> { - let (i, delivery_tag) = parse_long_long_uint(i)?; - let (i, flags) = parse_flags(i, &["multiple", "requeue"])?; + /// Parse delete (Generated) + pub fn parse_delete<I: ParsableInput>(i: I) -> ParserResult<I, Delete> { + let (i, _) = parse_short_uint(i)?; + let (i, queue) = parse_short_string(i)?; + let (i, flags) = parse_flags(i, &["if-unused", "if-empty", "nowait"])?; Ok(( i, - Nack { - delivery_tag, - multiple: flags.get_flag("multiple").unwrap_or(false), - requeue: flags.get_flag("requeue").unwrap_or(false), + Delete { + queue, + if_unused: flags.get_flag("if_unused").unwrap_or(false), + if_empty: flags.get_flag("if_empty").unwrap_or(false), + nowait: flags.get_flag("nowait").unwrap_or(false), }, )) } - /// Serialize nack (Generated) - pub fn gen_nack<'a, W: Write + BackToTheBuffer + 'a>( - method: &'a Nack, + /// Serialize delete (Generated) + pub fn gen_delete<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Delete, ) -> impl SerializeFn<W> + 'a { move |mut input| { let mut flags = AMQPFlags::default(); - flags.add_flag("multiple".to_string(), method.multiple); - flags.add_flag("requeue".to_string(), method.requeue); - input = gen_id(120)(input)?; - input = gen_long_long_uint(method.delivery_tag)(input)?; + flags.add_flag("if_unused".to_string(), method.if_unused); + flags.add_flag("if_empty".to_string(), method.if_empty); + flags.add_flag("nowait".to_string(), method.nowait); + input = gen_id(40)(input)?; + input = gen_short_uint(0)(input)?; + input = gen_short_string(method.queue.as_str())(input)?; input = gen_flags(&flags)(input)?; Ok(input) } } - /// basic properties (Generated) + /// delete-ok (Generated) #[derive(Clone, Debug, Default, PartialEq)] - pub struct AMQPProperties { - content_type: Option<ShortString>, - content_encoding: Option<ShortString>, - headers: Option<FieldTable>, - delivery_mode: Option<ShortShortUInt>, - priority: Option<ShortShortUInt>, - correlation_id: Option<ShortString>, - reply_to: Option<ShortString>, - expiration: Option<ShortString>, - message_id: Option<ShortString>, - timestamp: Option<Timestamp>, - kind: Option<ShortString>, - user_id: Option<ShortString>, - app_id: Option<ShortString>, - cluster_id: Option<ShortString>, + pub struct DeleteOk { + /// message-count (Generated) + pub message_count: LongUInt, } - impl AMQPProperties { - /// Set content-type (Generated) - pub fn with_content_type(mut self, value: ShortString) -> AMQPProperties { - self.content_type = Some(value); - self - } - /// Set content-encoding (Generated) - pub fn with_content_encoding(mut self, value: ShortString) -> AMQPProperties { - self.content_encoding = Some(value); - self - } - /// Set headers (Generated) - pub fn with_headers(mut self, value: FieldTable) -> AMQPProperties { - self.headers = Some(value); - self - } - /// Set delivery-mode (Generated) - pub fn with_delivery_mode(mut self, value: ShortShortUInt) -> AMQPProperties { - self.delivery_mode = Some(value); - self - } - /// Set priority (Generated) - pub fn with_priority(mut self, value: ShortShortUInt) -> AMQPProperties { - self.priority = Some(value); - self - } - /// Set correlation-id (Generated) - pub fn with_correlation_id(mut self, value: ShortString) -> AMQPProperties { - self.correlation_id = Some(value); - self - } - /// Set reply-to (Generated) - pub fn with_reply_to(mut self, value: ShortString) -> AMQPProperties { - self.reply_to = Some(value); - self - } - /// Set expiration (Generated) - pub fn with_expiration(mut self, value: ShortString) -> AMQPProperties { - self.expiration = Some(value); - self - } - /// Set message-id (Generated) - pub fn with_message_id(mut self, value: ShortString) -> AMQPProperties { - self.message_id = Some(value); - self - } - /// Set timestamp (Generated) - pub fn with_timestamp(mut self, value: Timestamp) -> AMQPProperties { - self.timestamp = Some(value); - self - } - /// Set type (Generated) - pub fn with_kind(mut self, value: ShortString) -> AMQPProperties { - self.kind = Some(value); - self - } - /// Set user-id (Generated) - pub fn with_user_id(mut self, value: ShortString) -> AMQPProperties { - self.user_id = Some(value); - self - } - /// Set app-id (Generated) - pub fn with_app_id(mut self, value: ShortString) -> AMQPProperties { - self.app_id = Some(value); - self - } - /// Set cluster-id (Generated) - pub fn with_cluster_id(mut self, value: ShortString) -> AMQPProperties { - self.cluster_id = Some(value); - self - } - /// Get content-type (Generated) - pub fn content_type(&self) -> &Option<ShortString> { - &self.content_type - } - /// Get content-encoding (Generated) - pub fn content_encoding(&self) -> &Option<ShortString> { - &self.content_encoding - } - /// Get headers (Generated) - pub fn headers(&self) -> &Option<FieldTable> { - &self.headers - } - /// Get delivery-mode (Generated) - pub fn delivery_mode(&self) -> &Option<ShortShortUInt> { - &self.delivery_mode - } - /// Get priority (Generated) - pub fn priority(&self) -> &Option<ShortShortUInt> { - &self.priority - } - /// Get correlation-id (Generated) - pub fn correlation_id(&self) -> &Option<ShortString> { - &self.correlation_id - } - /// Get reply-to (Generated) - pub fn reply_to(&self) -> &Option<ShortString> { - &self.reply_to - } - /// Get expiration (Generated) - pub fn expiration(&self) -> &Option<ShortString> { - &self.expiration - } - /// Get message-id (Generated) - pub fn message_id(&self) -> &Option<ShortString> { - &self.message_id - } - /// Get timestamp (Generated) - pub fn timestamp(&self) -> &Option<Timestamp> { - &self.timestamp - } - /// Get type (Generated) - pub fn kind(&self) -> &Option<ShortString> { - &self.kind + impl DeleteOk { + /// Get the AMQP class id for delete-ok (Generated) + pub fn get_amqp_class_id(&self) -> Identifier { + 50 } - /// Get user-id (Generated) - pub fn user_id(&self) -> &Option<ShortString> { - &self.user_id + + /// Get the AMQP method id for delete-ok (Generated) + pub fn get_amqp_method_id(&self) -> Identifier { + 41 } - /// Get app-id (Generated) - pub fn app_id(&self) -> &Option<ShortString> { - &self.app_id + } + + /// Parse delete-ok (Generated) + pub fn parse_delete_ok<I: ParsableInput>(i: I) -> ParserResult<I, DeleteOk> { + let (i, message_count) = parse_long_uint(i)?; + Ok((i, DeleteOk { message_count })) + } + + /// Serialize delete-ok (Generated) + pub fn gen_delete_ok<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a DeleteOk, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(41)(input)?; + input = gen_long_uint(method.message_count)(input)?; + Ok(input) } - /// Get cluster-id (Generated) - pub fn cluster_id(&self) -> &Option<ShortString> { - &self.cluster_id + } + /// unbind (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct Unbind { + /// queue (Generated) + pub queue: ShortString, + /// exchange (Generated) + pub exchange: ShortString, + /// routing-key (Generated) + pub routing_key: ShortString, + /// arguments (Generated) + pub arguments: FieldTable, + } + + impl Unbind { + /// Get the AMQP class id for unbind (Generated) + pub fn get_amqp_class_id(&self) -> Identifier { + 50 } - /// Get the bitmask for serialization (Generated) - #[allow(clippy::identity_op)] - pub fn bitmask(&self) -> ShortUInt { - (if self.content_type.is_some() { - 1 << (15 - 0) - } else { - 0 - }) + (if self.content_encoding.is_some() { - 1 << (15 - 1) - } else { - 0 - }) + (if self.headers.is_some() { - 1 << (15 - 2) - } else { - 0 - }) + (if self.delivery_mode.is_some() { - 1 << (15 - 3) - } else { - 0 - }) + (if self.priority.is_some() { - 1 << (15 - 4) - } else { - 0 - }) + (if self.correlation_id.is_some() { - 1 << (15 - 5) - } else { - 0 - }) + (if self.reply_to.is_some() { - 1 << (15 - 6) - } else { - 0 - }) + (if self.expiration.is_some() { - 1 << (15 - 7) - } else { - 0 - }) + (if self.message_id.is_some() { - 1 << (15 - 8) - } else { - 0 - }) + (if self.timestamp.is_some() { - 1 << (15 - 9) - } else { - 0 - }) + (if self.kind.is_some() { - 1 << (15 - 10) - } else { - 0 - }) + (if self.user_id.is_some() { - 1 << (15 - 11) - } else { - 0 - }) + (if self.app_id.is_some() { - 1 << (15 - 12) - } else { - 0 - }) + (if self.cluster_id.is_some() { - 1 << (15 - 13) - } else { - 0 - }) + + /// Get the AMQP method id for unbind (Generated) + pub fn get_amqp_method_id(&self) -> Identifier { + 50 } } - /// Parse basic properties (Generated) - #[allow(clippy::identity_op)] - pub fn parse_properties<I: ParsableInput>(i: I) -> ParserResult<I, AMQPProperties> { - let (i, flags) = parse_short_uint(i)?; - let (i, content_type) = if flags & (1 << (15 - 0)) != 0 { - map(parse_short_string, Some)(i)? - } else { - (i, None) - }; - let (i, content_encoding) = if flags & (1 << (15 - 1)) != 0 { - map(parse_short_string, Some)(i)? - } else { - (i, None) - }; - let (i, headers) = if flags & (1 << (15 - 2)) != 0 { - map(parse_field_table, Some)(i)? - } else { - (i, None) - }; - let (i, delivery_mode) = if flags & (1 << (15 - 3)) != 0 { - map(parse_short_short_uint, Some)(i)? - } else { - (i, None) - }; - let (i, priority) = if flags & (1 << (15 - 4)) != 0 { - map(parse_short_short_uint, Some)(i)? - } else { - (i, None) - }; - let (i, correlation_id) = if flags & (1 << (15 - 5)) != 0 { - map(parse_short_string, Some)(i)? - } else { - (i, None) - }; - let (i, reply_to) = if flags & (1 << (15 - 6)) != 0 { - map(parse_short_string, Some)(i)? - } else { - (i, None) - }; - let (i, expiration) = if flags & (1 << (15 - 7)) != 0 { - map(parse_short_string, Some)(i)? - } else { - (i, None) - }; - let (i, message_id) = if flags & (1 << (15 - 8)) != 0 { - map(parse_short_string, Some)(i)? - } else { - (i, None) - }; - let (i, timestamp) = if flags & (1 << (15 - 9)) != 0 { - map(parse_timestamp, Some)(i)? - } else { - (i, None) - }; - let (i, kind) = if flags & (1 << (15 - 10)) != 0 { - map(parse_short_string, Some)(i)? - } else { - (i, None) - }; - let (i, user_id) = if flags & (1 << (15 - 11)) != 0 { - map(parse_short_string, Some)(i)? - } else { - (i, None) - }; - let (i, app_id) = if flags & (1 << (15 - 12)) != 0 { - map(parse_short_string, Some)(i)? - } else { - (i, None) - }; - let (i, cluster_id) = if flags & (1 << (15 - 13)) != 0 { - map(parse_short_string, Some)(i)? - } else { - (i, None) - }; + /// Parse unbind (Generated) + pub fn parse_unbind<I: ParsableInput>(i: I) -> ParserResult<I, Unbind> { + let (i, _) = parse_short_uint(i)?; + let (i, queue) = parse_short_string(i)?; + let (i, exchange) = parse_short_string(i)?; + let (i, routing_key) = parse_short_string(i)?; + let (i, arguments) = parse_field_table(i)?; Ok(( i, - AMQPProperties { - content_type, - content_encoding, - headers, - delivery_mode, - priority, - correlation_id, - reply_to, - expiration, - message_id, - timestamp, - kind, - user_id, - app_id, - cluster_id, + Unbind { + queue, + exchange, + routing_key, + arguments, }, )) } - /// Serialize basic properties (Generated) - pub fn gen_properties<'a, W: Write + BackToTheBuffer + 'a>( - props: &'a AMQPProperties, + /// Serialize unbind (Generated) + pub fn gen_unbind<'a, W: Write + BackToTheBuffer + 'a>( + method: &'a Unbind, ) -> impl SerializeFn<W> + 'a { - cookie_factory::sequence::pair(gen_short_uint(props.bitmask()), move |mut input| { - if let Some(prop) = props.content_type.as_ref() { - input = gen_short_string(prop.as_str())(input)?; - } - if let Some(prop) = props.content_encoding.as_ref() { - input = gen_short_string(prop.as_str())(input)?; - } - if let Some(prop) = props.headers.as_ref() { - input = gen_field_table(prop)(input)?; - } - if let Some(prop) = props.delivery_mode { - input = gen_short_short_uint(prop)(input)?; - } - if let Some(prop) = props.priority { - input = gen_short_short_uint(prop)(input)?; - } - if let Some(prop) = props.correlation_id.as_ref() { - input = gen_short_string(prop.as_str())(input)?; - } - if let Some(prop) = props.reply_to.as_ref() { - input = gen_short_string(prop.as_str())(input)?; - } - if let Some(prop) = props.expiration.as_ref() { - input = gen_short_string(prop.as_str())(input)?; - } - if let Some(prop) = props.message_id.as_ref() { - input = gen_short_string(prop.as_str())(input)?; - } - if let Some(prop) = props.timestamp { - input = gen_timestamp(prop)(input)?; - } - if let Some(prop) = props.kind.as_ref() { - input = gen_short_string(prop.as_str())(input)?; - } - if let Some(prop) = props.user_id.as_ref() { - input = gen_short_string(prop.as_str())(input)?; - } - if let Some(prop) = props.app_id.as_ref() { - input = gen_short_string(prop.as_str())(input)?; - } - if let Some(prop) = props.cluster_id.as_ref() { - input = gen_short_string(prop.as_str())(input)?; - } + move |mut input| { + input = gen_id(50)(input)?; + input = gen_short_uint(0)(input)?; + input = gen_short_string(method.queue.as_str())(input)?; + input = gen_short_string(method.exchange.as_str())(input)?; + input = gen_short_string(method.routing_key.as_str())(input)?; + input = gen_field_table(&method.arguments)(input)?; Ok(input) - }) + } + } + /// unbind-ok (Generated) + #[derive(Clone, Debug, Default, PartialEq)] + pub struct UnbindOk {} + + impl UnbindOk { + /// Get the AMQP class id for unbind-ok (Generated) + pub fn get_amqp_class_id(&self) -> Identifier { + 50 + } + + /// Get the AMQP method id for unbind-ok (Generated) + pub fn get_amqp_method_id(&self) -> Identifier { + 51 + } + } + + /// Parse unbind-ok (Generated) + pub fn parse_unbind_ok<I: ParsableInput>(i: I) -> ParserResult<I, UnbindOk> { + Ok((i, UnbindOk {})) + } + + /// Serialize unbind-ok (Generated) + pub fn gen_unbind_ok<'a, W: Write + BackToTheBuffer + 'a>( + _: &'a UnbindOk, + ) -> impl SerializeFn<W> + 'a { + move |mut input| { + input = gen_id(51)(input)?; + Ok(input) + } } } /// tx (generated) diff --git a/update-specs.sh b/update-specs.sh index 16c88a8a..5a53339b 100755 --- a/update-specs.sh +++ b/update-specs.sh @@ -2,7 +2,7 @@ main() { cd codegen/specs - curl -O https://raw.githubusercontent.com/rabbitmq/rabbitmq-codegen/master/amqp-rabbitmq-0.9.1.json + curl -O https://raw.githubusercontent.com/rabbitmq/rabbitmq-server/master/deps/rabbitmq_codegen/amqp-rabbitmq-0.9.1.json } main "${@}" From b0e291194adca64e57c49a8c0ade1cb84d2bdb61 Mon Sep 17 00:00:00 2001 From: Marco Cameriero <me@marcocameriero.net> Date: Thu, 24 Feb 2022 17:05:39 +0100 Subject: [PATCH 085/133] Make generated `AMQPProperties` type serializable with serde (#31) * Make generated AMQPProperties type serializable with serde. * `use serde` to shorten derives. --- protocol/Cargo.toml | 4 ++++ protocol/src/generated.rs | 2 +- protocol/src/protocol.rs | 1 + protocol/templates/protocol.rs | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index 2e132748..a0b3be65 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -53,5 +53,9 @@ features = ["std"] version = "^7.0" features = ["std"] +[dependencies.serde] +version = "^1.0" +features = ["derive"] + [badges] maintenance = { status = "actively-developed" } diff --git a/protocol/src/generated.rs b/protocol/src/generated.rs index c9caee1e..7ca916b0 100644 --- a/protocol/src/generated.rs +++ b/protocol/src/generated.rs @@ -1358,7 +1358,7 @@ pub mod basic { } } /// basic properties (Generated) - #[derive(Clone, Debug, Default, PartialEq)] + #[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] pub struct AMQPProperties { content_type: Option<ShortString>, content_encoding: Option<ShortString>, diff --git a/protocol/src/protocol.rs b/protocol/src/protocol.rs index d5f60b49..14eafa37 100644 --- a/protocol/src/protocol.rs +++ b/protocol/src/protocol.rs @@ -8,6 +8,7 @@ use nom::{ combinator::{flat_map, map, map_opt}, error::context, }; +use serde::{Deserialize, Serialize}; use std::{convert::TryFrom, error, fmt, io::Write}; #[cfg(feature = "codegen")] diff --git a/protocol/templates/protocol.rs b/protocol/templates/protocol.rs index 3c6fecbe..8081ad14 100644 --- a/protocol/templates/protocol.rs +++ b/protocol/templates/protocol.rs @@ -292,7 +292,7 @@ pub mod {{snake class.name}} { {{/each ~}} {{#if class.properties ~}} /// {{class.name}} properties (Generated) - #[derive(Clone, Debug, Default, PartialEq)] + #[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] pub struct AMQPProperties { {{#each class.properties as |property| ~}} {{snake property.name}}: Option<{{property.type}}>, From a3e69f2ddfcf5252df09cafcaa91dc157e886e0e Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Thu, 24 Feb 2022 15:24:50 +0100 Subject: [PATCH 086/133] v7.0.1 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/Cargo.toml | 4 ++-- codegen/src/lib.rs | 2 +- protocol/Cargo.toml | 10 +++++----- protocol/src/lib.rs | 2 +- tcp/Cargo.toml | 4 ++-- tcp/src/lib.rs | 2 +- types/Cargo.toml | 2 +- types/src/lib.rs | 2 +- uri/Cargo.toml | 4 ++-- uri/src/lib.rs | 2 +- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index ba7f171c..0cc10925 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "7.0.0" # remember to update html_root_url +version = "7.0.1" # remember to update html_root_url edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" @@ -19,7 +19,7 @@ handlebars = "^4.0" serde_json = "^1.0" [dependencies.amq-protocol-types] -version = "=7.0.0" +version = "=7.0.1" path = "../types" [dependencies.serde] diff --git a/codegen/src/lib.rs b/codegen/src/lib.rs index a7772c69..759237f4 100644 --- a/codegen/src/lib.rs +++ b/codegen/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/7.0.0/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/7.0.1/")] //! # AMQP code generation utilities //! diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index a0b3be65..ca90890e 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "7.0.0" # remember to update html_root_url +version = "7.0.1" # remember to update html_root_url edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" @@ -28,21 +28,21 @@ vendored-openssl = ["amq-protocol-tcp/vendored-openssl"] verbose-errors = ["amq-protocol-types/verbose-errors"] [build-dependencies.amq-protocol-codegen] -version = "=7.0.0" +version = "=7.0.1" path = "../codegen" optional = true [dependencies.amq-protocol-tcp] -version = "=7.0.0" +version = "=7.0.1" default-features = false path = "../tcp" [dependencies.amq-protocol-types] -version = "=7.0.0" +version = "=7.0.1" path = "../types" [dependencies.amq-protocol-uri] -version = "=7.0.0" +version = "=7.0.1" path = "../uri" [dependencies.cookie-factory] diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs index f49e1ce4..99cb24c0 100644 --- a/protocol/src/lib.rs +++ b/protocol/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol/7.0.0/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol/7.0.1/")] //! # AMQP manipulation library //! diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index bc6798d5..6c154746 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "7.0.0" # remember to update html_root_url +version = "7.0.1" # remember to update html_root_url edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" @@ -25,7 +25,7 @@ rustls-connector = ["tcp-stream/rustls-connector"] vendored-openssl = ["tcp-stream/vendored-openssl"] [dependencies.amq-protocol-uri] -version = "=7.0.0" +version = "=7.0.1" path = "../uri" [dependencies.tcp-stream] diff --git a/tcp/src/lib.rs b/tcp/src/lib.rs index 2944a59a..2e428977 100644 --- a/tcp/src/lib.rs +++ b/tcp/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/7.0.0/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/7.0.1/")] //! # AMQP URI TCP connection handling //! diff --git a/types/Cargo.toml b/types/Cargo.toml index 7d07d33e..0a9c13c6 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "7.0.0" # remember to update html_root_url +version = "7.0.1" # remember to update html_root_url edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/types/src/lib.rs b/types/src/lib.rs index 701765db..dcaf2200 100644 --- a/types/src/lib.rs +++ b/types/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-types/7.0.0/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-types/7.0.1/")] //! # AMQP types manipulation library //! diff --git a/uri/Cargo.toml b/uri/Cargo.toml index e4200e75..86fc912f 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "7.0.0" # remember to update html_root_url +version = "7.0.1" # remember to update html_root_url edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" @@ -15,7 +15,7 @@ rust-version = "1.56.0" name = "amq_protocol_uri" [dependencies.amq-protocol-types] -version = "=7.0.0" +version = "=7.0.1" path = "../types" [dependencies] diff --git a/uri/src/lib.rs b/uri/src/lib.rs index 6cbab696..551b13e5 100644 --- a/uri/src/lib.rs +++ b/uri/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/7.0.0/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/7.0.1/")] //! # AMQP URI manipulation library //! From 86fe82937c920c36345f23116a49baa23a0604bc Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Fri, 24 Mar 2023 11:54:25 +0100 Subject: [PATCH 087/133] test CI every week Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- .github/workflows/build-and-test.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index 2f45f55d..aa4ebbfb 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -2,9 +2,9 @@ name: Build and test on: push: - branches: - - main pull_request: + schedule: + - cron: "0 12 * * 1" jobs: build_and_test: From 475fef17761979a9fceb02b4ba5bbad4690648f1 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Sun, 16 Apr 2023 21:45:54 +0200 Subject: [PATCH 088/133] upate MSRV to 1.57 for rustls Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- .github/workflows/build-and-test.yaml | 2 +- codegen/Cargo.toml | 2 +- protocol/Cargo.toml | 2 +- tcp/Cargo.toml | 2 +- types/Cargo.toml | 2 +- uri/Cargo.toml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index aa4ebbfb..45b0ede6 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -13,7 +13,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - rust: [nightly, beta, stable, 1.56.0] + rust: [nightly, beta, stable, 1.57.0] steps: - uses: actions/checkout@v2 diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 0cc10925..0c6dbd45 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -9,7 +9,7 @@ documentation = "https://docs.rs/amq-protocol-codegen" keywords = ["amqp","rabbitmq","protocol"] categories = ["api-bindings","network-programming"] license = "BSD-2-Clause" -rust-version = "1.56.0" +rust-version = "1.57.0" [lib] name = "amq_protocol_codegen" diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index ca90890e..a399d51d 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -10,7 +10,7 @@ keywords = ["amqp","rabbitmq","protocol","nom"] categories = ["api-bindings","network-programming"] license = "BSD-2-Clause" build = "build.rs" -rust-version = "1.56.0" +rust-version = "1.57.0" [lib] name = "amq_protocol" diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index 6c154746..aed2ec23 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -9,7 +9,7 @@ documentation = "https://docs.rs/amq-protocol-tcp" keywords = ["amqp","rabbitmq","protocol"] categories = ["api-bindings","network-programming"] license = "BSD-2-Clause" -rust-version = "1.56.0" +rust-version = "1.57.0" [lib] name = "amq_protocol_tcp" diff --git a/types/Cargo.toml b/types/Cargo.toml index 0a9c13c6..4a754770 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -9,7 +9,7 @@ documentation = "https://docs.rs/amq-protocol-types" keywords = ["amqp","rabbitmq","protocol","nom"] categories = ["api-bindings","network-programming"] license = "BSD-2-Clause" -rust-version = "1.56.0" +rust-version = "1.57.0" [lib] name = "amq_protocol_types" diff --git a/uri/Cargo.toml b/uri/Cargo.toml index 86fc912f..c9bc272c 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -9,7 +9,7 @@ documentation = "https://docs.rs/amq-protocol-uri" keywords = ["amqp","rabbitmq","protocol"] categories = ["api-bindings","network-programming"] license = "BSD-2-Clause" -rust-version = "1.56.0" +rust-version = "1.57.0" [lib] name = "amq_protocol_uri" From c2d59c0d0a3b54d72278b0e25cfb5c674c6a8927 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Sun, 16 Apr 2023 21:48:01 +0200 Subject: [PATCH 089/133] upate MSRV to 1.63 for openssl-src Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- .github/workflows/build-and-test.yaml | 2 +- codegen/Cargo.toml | 2 +- protocol/Cargo.toml | 2 +- tcp/Cargo.toml | 2 +- types/Cargo.toml | 2 +- uri/Cargo.toml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index 45b0ede6..08e63ab6 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -13,7 +13,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - rust: [nightly, beta, stable, 1.57.0] + rust: [nightly, beta, stable, 1.63.0] steps: - uses: actions/checkout@v2 diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 0c6dbd45..11076a58 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -9,7 +9,7 @@ documentation = "https://docs.rs/amq-protocol-codegen" keywords = ["amqp","rabbitmq","protocol"] categories = ["api-bindings","network-programming"] license = "BSD-2-Clause" -rust-version = "1.57.0" +rust-version = "1.63.0" [lib] name = "amq_protocol_codegen" diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index a399d51d..c9ed20a9 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -10,7 +10,7 @@ keywords = ["amqp","rabbitmq","protocol","nom"] categories = ["api-bindings","network-programming"] license = "BSD-2-Clause" build = "build.rs" -rust-version = "1.57.0" +rust-version = "1.63.0" [lib] name = "amq_protocol" diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index aed2ec23..da1ef8e0 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -9,7 +9,7 @@ documentation = "https://docs.rs/amq-protocol-tcp" keywords = ["amqp","rabbitmq","protocol"] categories = ["api-bindings","network-programming"] license = "BSD-2-Clause" -rust-version = "1.57.0" +rust-version = "1.63.0" [lib] name = "amq_protocol_tcp" diff --git a/types/Cargo.toml b/types/Cargo.toml index 4a754770..c2be8fce 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -9,7 +9,7 @@ documentation = "https://docs.rs/amq-protocol-types" keywords = ["amqp","rabbitmq","protocol","nom"] categories = ["api-bindings","network-programming"] license = "BSD-2-Clause" -rust-version = "1.57.0" +rust-version = "1.63.0" [lib] name = "amq_protocol_types" diff --git a/uri/Cargo.toml b/uri/Cargo.toml index c9bc272c..83151726 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -9,7 +9,7 @@ documentation = "https://docs.rs/amq-protocol-uri" keywords = ["amqp","rabbitmq","protocol"] categories = ["api-bindings","network-programming"] license = "BSD-2-Clause" -rust-version = "1.57.0" +rust-version = "1.63.0" [lib] name = "amq_protocol_uri" From 9344bf1e51dd79e8bed801c08979cc923777359c Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Mon, 17 Apr 2023 14:13:40 +0200 Subject: [PATCH 090/133] update tcp-stream Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- tcp/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index da1ef8e0..9be10721 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -29,7 +29,7 @@ version = "=7.0.1" path = "../uri" [dependencies.tcp-stream] -version = "^0.24" +version = "^0.25" default-features = false [dependencies.tracing] From 609d1885df536ddd394b8ed92de44cbc15e79fca Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Sun, 30 Apr 2023 10:46:31 +0200 Subject: [PATCH 091/133] v7.1.0 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/Cargo.toml | 4 ++-- codegen/src/lib.rs | 2 +- protocol/Cargo.toml | 10 +++++----- protocol/src/lib.rs | 2 +- tcp/Cargo.toml | 4 ++-- tcp/src/lib.rs | 2 +- types/Cargo.toml | 2 +- types/src/lib.rs | 2 +- uri/Cargo.toml | 4 ++-- uri/src/lib.rs | 2 +- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 11076a58..e5e24675 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "7.0.1" # remember to update html_root_url +version = "7.1.0" # remember to update html_root_url edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" @@ -19,7 +19,7 @@ handlebars = "^4.0" serde_json = "^1.0" [dependencies.amq-protocol-types] -version = "=7.0.1" +version = "=7.1.0" path = "../types" [dependencies.serde] diff --git a/codegen/src/lib.rs b/codegen/src/lib.rs index 759237f4..f2a85d58 100644 --- a/codegen/src/lib.rs +++ b/codegen/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/7.0.1/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/7.1.0/")] //! # AMQP code generation utilities //! diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index c9ed20a9..60194fe6 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "7.0.1" # remember to update html_root_url +version = "7.1.0" # remember to update html_root_url edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" @@ -28,21 +28,21 @@ vendored-openssl = ["amq-protocol-tcp/vendored-openssl"] verbose-errors = ["amq-protocol-types/verbose-errors"] [build-dependencies.amq-protocol-codegen] -version = "=7.0.1" +version = "=7.1.0" path = "../codegen" optional = true [dependencies.amq-protocol-tcp] -version = "=7.0.1" +version = "=7.1.0" default-features = false path = "../tcp" [dependencies.amq-protocol-types] -version = "=7.0.1" +version = "=7.1.0" path = "../types" [dependencies.amq-protocol-uri] -version = "=7.0.1" +version = "=7.1.0" path = "../uri" [dependencies.cookie-factory] diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs index 99cb24c0..be12f290 100644 --- a/protocol/src/lib.rs +++ b/protocol/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol/7.0.1/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol/7.1.0/")] //! # AMQP manipulation library //! diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index 9be10721..76b418a1 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "7.0.1" # remember to update html_root_url +version = "7.1.0" # remember to update html_root_url edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" @@ -25,7 +25,7 @@ rustls-connector = ["tcp-stream/rustls-connector"] vendored-openssl = ["tcp-stream/vendored-openssl"] [dependencies.amq-protocol-uri] -version = "=7.0.1" +version = "=7.1.0" path = "../uri" [dependencies.tcp-stream] diff --git a/tcp/src/lib.rs b/tcp/src/lib.rs index 2e428977..f9e019da 100644 --- a/tcp/src/lib.rs +++ b/tcp/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/7.0.1/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/7.1.0/")] //! # AMQP URI TCP connection handling //! diff --git a/types/Cargo.toml b/types/Cargo.toml index c2be8fce..59775c18 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "7.0.1" # remember to update html_root_url +version = "7.1.0" # remember to update html_root_url edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/types/src/lib.rs b/types/src/lib.rs index dcaf2200..b2d3e457 100644 --- a/types/src/lib.rs +++ b/types/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-types/7.0.1/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-types/7.1.0/")] //! # AMQP types manipulation library //! diff --git a/uri/Cargo.toml b/uri/Cargo.toml index 83151726..1ae3f7de 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "7.0.1" # remember to update html_root_url +version = "7.1.0" # remember to update html_root_url edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" @@ -15,7 +15,7 @@ rust-version = "1.63.0" name = "amq_protocol_uri" [dependencies.amq-protocol-types] -version = "=7.0.1" +version = "=7.1.0" path = "../types" [dependencies] diff --git a/uri/src/lib.rs b/uri/src/lib.rs index 551b13e5..c2a675b0 100644 --- a/uri/src/lib.rs +++ b/uri/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/7.0.1/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/7.1.0/")] //! # AMQP URI manipulation library //! From 28d68361180882b8851ff9990cb2638fdbd9d8fb Mon Sep 17 00:00:00 2001 From: Roman Gafiyatullin <r.gafiyatullin@me.com> Date: Thu, 18 May 2023 23:51:57 +0300 Subject: [PATCH 092/133] API to construct a `LongString` from `Vec<u8>`. (#33) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `types::LongString` is not guaranteed to be a valid UTF8-string Neither by the standard, nor it is enforced by this implementation. When parsing — just collect the bytes, no need for utf8-lossy --- types/src/parsing.rs | 11 +++-------- types/src/types.rs | 40 +++++++++++++++++++++++++++++++--------- 2 files changed, 34 insertions(+), 17 deletions(-) diff --git a/types/src/parsing.rs b/types/src/parsing.rs index 083485d4..77ea153d 100644 --- a/types/src/parsing.rs +++ b/types/src/parsing.rs @@ -205,10 +205,6 @@ fn make_str<I: nom::InputIter<Item = u8>>(i: I) -> Result<String, std::string::F String::from_utf8(i.iter_elements().collect()) } -fn make_str_lossy<I: nom::InputIter<Item = u8>>(i: I) -> String { - String::from_utf8_lossy(&i.iter_elements().collect::<Vec<_>>()).into_owned() -} - /// Parse a [ShortString](../type.ShortString.html) pub fn parse_short_string<I: ParsableInput>(i: I) -> ParserResult<I, ShortString> { context( @@ -224,10 +220,9 @@ pub fn parse_short_string<I: ParsableInput>(i: I) -> ParserResult<I, ShortString pub fn parse_long_string<I: ParsableInput>(i: I) -> ParserResult<I, LongString> { context( "parse_long_string", - map( - map(flat_map(parse_long_uint, take), make_str_lossy), - LongString::from, - ), + map(flat_map(parse_long_uint, take), |i: I| { + i.iter_elements().collect::<Vec<u8>>().into() + }), )(i) } diff --git a/types/src/types.rs b/types/src/types.rs index cd3e242f..6924a782 100644 --- a/types/src/types.rs +++ b/types/src/types.rs @@ -209,15 +209,12 @@ impl<'a> LongString { } } -impl From<String> for LongString { - fn from(s: String) -> Self { - Self(s.into_bytes()) - } -} - -impl From<&str> for LongString { - fn from(s: &str) -> Self { - s.to_owned().into() +impl<B> From<B> for LongString +where + B: Into<Vec<u8>>, +{ + fn from(bytes: B) -> Self { + Self(bytes.into()) } } @@ -332,4 +329,29 @@ mod test { assert_eq!(AMQPType::Boolean.to_string(), "Boolean"); assert_eq!(AMQPType::Void.to_string(), "Void"); } + + #[test] + fn long_string_ergonomics() { + let str_ref = "string ref"; + let str_owned = "string owned".to_owned(); + let vec = b"bytes".to_vec(); + let array = b"bytes".to_owned(); + let slice = &b"bytes"[..]; + + let from_str_ref: LongString = str_ref.into(); + let from_str_owned: LongString = str_owned.clone().into(); + let from_vec: LongString = vec.clone().into(); + let from_array: LongString = array.into(); + let from_slice: LongString = slice.into(); + + for (left, right) in [ + (str_ref.as_bytes(), from_str_ref.as_bytes()), + (str_owned.as_bytes(), from_str_owned.as_bytes()), + (vec.as_ref(), from_vec.as_bytes()), + (array.as_ref(), from_array.as_bytes()), + (slice, from_slice.as_bytes()), + ] { + assert_eq!(left, right); + } + } } From fda17572fe2d1fc4cee534d747d5ba3188f26365 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Thu, 18 May 2023 22:53:20 +0200 Subject: [PATCH 093/133] v7.1.1 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/Cargo.toml | 4 ++-- codegen/src/lib.rs | 2 +- protocol/Cargo.toml | 10 +++++----- protocol/src/lib.rs | 2 +- tcp/Cargo.toml | 4 ++-- tcp/src/lib.rs | 2 +- types/Cargo.toml | 2 +- types/src/lib.rs | 2 +- uri/Cargo.toml | 4 ++-- uri/src/lib.rs | 2 +- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index e5e24675..7450c2ec 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "7.1.0" # remember to update html_root_url +version = "7.1.1" # remember to update html_root_url edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" @@ -19,7 +19,7 @@ handlebars = "^4.0" serde_json = "^1.0" [dependencies.amq-protocol-types] -version = "=7.1.0" +version = "=7.1.1" path = "../types" [dependencies.serde] diff --git a/codegen/src/lib.rs b/codegen/src/lib.rs index f2a85d58..e934fb5b 100644 --- a/codegen/src/lib.rs +++ b/codegen/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/7.1.0/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/7.1.1/")] //! # AMQP code generation utilities //! diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index 60194fe6..8b890d2f 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "7.1.0" # remember to update html_root_url +version = "7.1.1" # remember to update html_root_url edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" @@ -28,21 +28,21 @@ vendored-openssl = ["amq-protocol-tcp/vendored-openssl"] verbose-errors = ["amq-protocol-types/verbose-errors"] [build-dependencies.amq-protocol-codegen] -version = "=7.1.0" +version = "=7.1.1" path = "../codegen" optional = true [dependencies.amq-protocol-tcp] -version = "=7.1.0" +version = "=7.1.1" default-features = false path = "../tcp" [dependencies.amq-protocol-types] -version = "=7.1.0" +version = "=7.1.1" path = "../types" [dependencies.amq-protocol-uri] -version = "=7.1.0" +version = "=7.1.1" path = "../uri" [dependencies.cookie-factory] diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs index be12f290..5a6d7858 100644 --- a/protocol/src/lib.rs +++ b/protocol/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol/7.1.0/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol/7.1.1/")] //! # AMQP manipulation library //! diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index 76b418a1..009ea444 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "7.1.0" # remember to update html_root_url +version = "7.1.1" # remember to update html_root_url edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" @@ -25,7 +25,7 @@ rustls-connector = ["tcp-stream/rustls-connector"] vendored-openssl = ["tcp-stream/vendored-openssl"] [dependencies.amq-protocol-uri] -version = "=7.1.0" +version = "=7.1.1" path = "../uri" [dependencies.tcp-stream] diff --git a/tcp/src/lib.rs b/tcp/src/lib.rs index f9e019da..cf9b7b43 100644 --- a/tcp/src/lib.rs +++ b/tcp/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/7.1.0/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/7.1.1/")] //! # AMQP URI TCP connection handling //! diff --git a/types/Cargo.toml b/types/Cargo.toml index 59775c18..6bcdc4c0 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "7.1.0" # remember to update html_root_url +version = "7.1.1" # remember to update html_root_url edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/types/src/lib.rs b/types/src/lib.rs index b2d3e457..2a8640c3 100644 --- a/types/src/lib.rs +++ b/types/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-types/7.1.0/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-types/7.1.1/")] //! # AMQP types manipulation library //! diff --git a/uri/Cargo.toml b/uri/Cargo.toml index 1ae3f7de..ea85c471 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "7.1.0" # remember to update html_root_url +version = "7.1.1" # remember to update html_root_url edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" @@ -15,7 +15,7 @@ rust-version = "1.63.0" name = "amq_protocol_uri" [dependencies.amq-protocol-types] -version = "=7.1.0" +version = "=7.1.1" path = "../types" [dependencies] diff --git a/uri/src/lib.rs b/uri/src/lib.rs index c2a675b0..12469f72 100644 --- a/uri/src/lib.rs +++ b/uri/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/7.1.0/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/7.1.1/")] //! # AMQP URI manipulation library //! From 0a859440b4f7bfee0f1963b7b6185f8c6f48981a Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Fri, 19 May 2023 13:51:08 +0200 Subject: [PATCH 094/133] silence clippy warnings Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/src/internal.rs | 6 +++--- codegen/src/templating.rs | 10 ++++------ tcp/Cargo.toml | 2 +- uri/src/lib.rs | 22 ++++++---------------- 4 files changed, 14 insertions(+), 26 deletions(-) diff --git a/codegen/src/internal.rs b/codegen/src/internal.rs index 402062eb..8d1db413 100644 --- a/codegen/src/internal.rs +++ b/codegen/src/internal.rs @@ -361,7 +361,7 @@ impl _AMQPMethod { .unwrap_or_default(); if is_reply && metadata.get("state").is_none() { if let Some(state) = class_md - .and_then(|c| c.get(&self.name.replace("-ok", ""))) + .and_then(|c| c.get(self.name.replace("-ok", ""))) .and_then(|m| m.get("metadata")) .and_then(|m| m.get("state")) { @@ -370,7 +370,7 @@ impl _AMQPMethod { } if is_reply && metadata.get("confirmation").is_none() { if let Some(confirmation) = class_md - .and_then(|c| c.get(&self.name.replace("-ok", ""))) + .and_then(|c| c.get(self.name.replace("-ok", ""))) .and_then(|m| m.get("metadata")) .and_then(|m| m.get("confirmation")) { @@ -411,7 +411,7 @@ impl _AMQPMethod { .unwrap_or(false); let amqp_type = argument.get_type(domains); if amqp_type == AMQPType::Boolean { - let mut flgs = flags.take().unwrap_or_else(Vec::new); + let mut flgs = flags.take().unwrap_or_default(); flgs.push(argument.to_flag_specs(force_default)); flags = Some(flgs); } else { diff --git a/codegen/src/templating.rs b/codegen/src/templating.rs index a1655c20..6574075c 100644 --- a/codegen/src/templating.rs +++ b/codegen/src/templating.rs @@ -78,7 +78,7 @@ impl<'a> HandlebarsAMQPExtension for CodeGenerator<'a> { codegen.set_strict_mode(true); codegen - .register_template_string(template_name, template.to_string()) + .register_template_string(template_name, template) .unwrap_or_else(|e| panic!("Failed to register {} template: {}", template_name, e)); data.insert( var_name.to_string(), @@ -336,9 +336,9 @@ impl HelperDef for EachArgumentHelper { AMQPArgument::Value(_) => ("Value".to_owned(), true), AMQPArgument::Flags(_) => ("Flags".to_owned(), false), }; - block.set_local_var("index", to_json(&index)); + block.set_local_var("index", to_json(index)); block.set_local_var("last", to_json(index == len - 1)); - block.set_local_var("argument_is_value", to_json(&is_value)); + block.set_local_var("argument_is_value", to_json(is_value)); if let Some(p) = array_path { if index == 0 { let mut path = Vec::with_capacity(p.len() + 1); @@ -509,9 +509,7 @@ synchronous: {{method.synchronous}} let mut data = HashMap::new(); let mut codegen = CodeGenerator::default().register_amqp_helpers(); data.insert("protocol".to_string(), specs()); - assert!(codegen - .register_template_string("main", TEMPLATE.to_string()) - .is_ok()); + assert!(codegen.register_template_string("main", TEMPLATE).is_ok()); assert_eq!( codegen.render("main", &data).unwrap(), r#" diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index 009ea444..ab71aef2 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -29,7 +29,7 @@ version = "=7.1.1" path = "../uri" [dependencies.tcp-stream] -version = "^0.25" +version = "^0.26" default-features = false [dependencies.tracing] diff --git a/uri/src/lib.rs b/uri/src/lib.rs index 12469f72..8ff419b1 100644 --- a/uri/src/lib.rs +++ b/uri/src/lib.rs @@ -26,9 +26,10 @@ pub struct AMQPUri { } /// The scheme used by the AMQP connection -#[derive(Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, Default, PartialEq, Eq)] pub enum AMQPScheme { /// Plain AMQP + #[default] AMQP, /// Encrypted AMQP over TLS AMQPS, @@ -85,24 +86,19 @@ pub struct AMQPQueryString { } /// The SASL mechanisms supported by RabbitMQ -#[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] pub enum SASLMechanism { /// This is a legacy mechanism kept for backward compatibility AMQPlain, /// Delegate all authentication to the transport instead of the RabbitMQ server External, /// Default plain login, this should be supported everywhere + #[default] Plain, /// A demo of RabbitMQ SecureOk mechanism, offers the same level of security as Plain RabbitCrDemo, } -impl Default for SASLMechanism { - fn default() -> Self { - SASLMechanism::Plain - } -} - impl fmt::Display for SASLMechanism { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(match self { @@ -151,7 +147,7 @@ fn int_queryparam<T: FromStr<Err = ParseIntError>>( param: &str, ) -> Result<Option<T>, String> { url.query_pairs() - .find(|&(ref key, _)| key == param) + .find(|(key, _)| key == param) .map_or(Ok(None), |(_, ref value)| value.parse::<T>().map(Some)) .map_err(|e: ParseIntError| e.to_string()) } @@ -184,7 +180,7 @@ impl FromStr for AMQPUri { let connection_timeout = int_queryparam(&url, "connection_timeout")?; let auth_mechanism = url .query_pairs() - .find(|&(ref key, _)| key == "auth_mechanism") + .find(|(key, _)| key == "auth_mechanism") .map_or(Ok(None), |(_, ref value)| value.parse().map(Some))?; Ok(AMQPUri { @@ -216,12 +212,6 @@ impl AMQPScheme { } } -impl Default for AMQPScheme { - fn default() -> Self { - AMQPScheme::AMQP - } -} - impl Default for AMQPAuthority { fn default() -> Self { AMQPAuthority { From c021ceb958d899fa573f2fada7ba744f84dd86b4 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Fri, 19 May 2023 13:51:39 +0200 Subject: [PATCH 095/133] v7.1.2 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/Cargo.toml | 4 ++-- codegen/src/lib.rs | 2 +- protocol/Cargo.toml | 10 +++++----- protocol/src/lib.rs | 2 +- tcp/Cargo.toml | 4 ++-- tcp/src/lib.rs | 2 +- types/Cargo.toml | 2 +- types/src/lib.rs | 2 +- uri/Cargo.toml | 4 ++-- uri/src/lib.rs | 2 +- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 7450c2ec..daa0ab81 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "7.1.1" # remember to update html_root_url +version = "7.1.2" # remember to update html_root_url edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" @@ -19,7 +19,7 @@ handlebars = "^4.0" serde_json = "^1.0" [dependencies.amq-protocol-types] -version = "=7.1.1" +version = "=7.1.2" path = "../types" [dependencies.serde] diff --git a/codegen/src/lib.rs b/codegen/src/lib.rs index e934fb5b..4cc3a875 100644 --- a/codegen/src/lib.rs +++ b/codegen/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/7.1.1/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/7.1.2/")] //! # AMQP code generation utilities //! diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index 8b890d2f..cbf9d1fa 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "7.1.1" # remember to update html_root_url +version = "7.1.2" # remember to update html_root_url edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" @@ -28,21 +28,21 @@ vendored-openssl = ["amq-protocol-tcp/vendored-openssl"] verbose-errors = ["amq-protocol-types/verbose-errors"] [build-dependencies.amq-protocol-codegen] -version = "=7.1.1" +version = "=7.1.2" path = "../codegen" optional = true [dependencies.amq-protocol-tcp] -version = "=7.1.1" +version = "=7.1.2" default-features = false path = "../tcp" [dependencies.amq-protocol-types] -version = "=7.1.1" +version = "=7.1.2" path = "../types" [dependencies.amq-protocol-uri] -version = "=7.1.1" +version = "=7.1.2" path = "../uri" [dependencies.cookie-factory] diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs index 5a6d7858..fa45acc6 100644 --- a/protocol/src/lib.rs +++ b/protocol/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol/7.1.1/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol/7.1.2/")] //! # AMQP manipulation library //! diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index ab71aef2..d999330c 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "7.1.1" # remember to update html_root_url +version = "7.1.2" # remember to update html_root_url edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" @@ -25,7 +25,7 @@ rustls-connector = ["tcp-stream/rustls-connector"] vendored-openssl = ["tcp-stream/vendored-openssl"] [dependencies.amq-protocol-uri] -version = "=7.1.1" +version = "=7.1.2" path = "../uri" [dependencies.tcp-stream] diff --git a/tcp/src/lib.rs b/tcp/src/lib.rs index cf9b7b43..7ee233fd 100644 --- a/tcp/src/lib.rs +++ b/tcp/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/7.1.1/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/7.1.2/")] //! # AMQP URI TCP connection handling //! diff --git a/types/Cargo.toml b/types/Cargo.toml index 6bcdc4c0..3de0395d 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "7.1.1" # remember to update html_root_url +version = "7.1.2" # remember to update html_root_url edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/types/src/lib.rs b/types/src/lib.rs index 2a8640c3..53c8305a 100644 --- a/types/src/lib.rs +++ b/types/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-types/7.1.1/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-types/7.1.2/")] //! # AMQP types manipulation library //! diff --git a/uri/Cargo.toml b/uri/Cargo.toml index ea85c471..41508f87 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "7.1.1" # remember to update html_root_url +version = "7.1.2" # remember to update html_root_url edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" @@ -15,7 +15,7 @@ rust-version = "1.63.0" name = "amq_protocol_uri" [dependencies.amq-protocol-types] -version = "=7.1.1" +version = "=7.1.2" path = "../types" [dependencies] diff --git a/uri/src/lib.rs b/uri/src/lib.rs index 8ff419b1..f4d1e1db 100644 --- a/uri/src/lib.rs +++ b/uri/src/lib.rs @@ -1,6 +1,6 @@ #![deny(missing_docs)] #![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/7.1.1/")] +#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/7.1.2/")] //! # AMQP URI manipulation library //! From a93be76ae8f1b7be68af09076c2a9cd3d9cc2df7 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Tue, 2 Jan 2024 17:11:22 +0100 Subject: [PATCH 096/133] udpate tcp-stream --- Cargo.toml | 1 + tcp/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 76c31f7c..60021a11 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,2 +1,3 @@ [workspace] members = [ "codegen", "protocol", "tcp", "types", "uri" ] +resolver = "2" diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index d999330c..97c6586e 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -29,7 +29,7 @@ version = "=7.1.2" path = "../uri" [dependencies.tcp-stream] -version = "^0.26" +version = "^0.27" default-features = false [dependencies.tracing] From 1ae2cdbb8f26c476cbefec3a3b828fe86071df27 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Thu, 14 Dec 2023 09:19:45 +0100 Subject: [PATCH 097/133] update to handlebars 5 --- codegen/Cargo.toml | 2 +- codegen/src/templating.rs | 184 +++++++++++++++++++++++--------------- 2 files changed, 111 insertions(+), 75 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index daa0ab81..938d4de7 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -15,7 +15,7 @@ rust-version = "1.63.0" name = "amq_protocol_codegen" [dependencies] -handlebars = "^4.0" +handlebars = "^5.0" serde_json = "^1.0" [dependencies.amq-protocol-types] diff --git a/codegen/src/templating.rs b/codegen/src/templating.rs index 6574075c..eefb9f86 100644 --- a/codegen/src/templating.rs +++ b/codegen/src/templating.rs @@ -3,7 +3,7 @@ use crate::{specs::*, util::*}; use amq_protocol_types::{AMQPType, AMQPValue}; use handlebars::{ self, to_json, BlockContext, BlockParams, Context, Handlebars, Helper, HelperDef, HelperResult, - JsonValue, Output, RenderContext, RenderError, Renderable, ScopedJson, + JsonValue, Output, RenderContext, RenderError, RenderErrorReason, Renderable, ScopedJson, }; use serde_json::{self, Value}; @@ -105,7 +105,7 @@ pub struct CamelHelper; impl HelperDef for CamelHelper { fn call<'reg: 'rc, 'rc>( &self, - h: &Helper<'reg, 'rc>, + h: &Helper<'rc>, _: &'reg Handlebars<'_>, _: &'rc Context, _: &mut RenderContext<'reg, 'rc>, @@ -113,11 +113,14 @@ impl HelperDef for CamelHelper { ) -> HelperResult { let value = h .param(0) - .ok_or_else(|| RenderError::new("Param not found for helper \"camel\""))?; - let param = value - .value() - .as_str() - .ok_or_else(|| RenderError::new("Non-string param given to helper \"camel\""))?; + .ok_or_else(|| RenderErrorReason::ParamNotFoundForIndex("camel", 0))?; + let param = value.value().as_str().ok_or_else(|| { + RenderErrorReason::ParamTypeMismatchForName( + "camel", + "string".to_string(), + "string".to_string(), + ) + })?; out.write(&camel_case(param))?; Ok(()) } @@ -128,7 +131,7 @@ pub struct SnakeHelper; impl HelperDef for SnakeHelper { fn call<'reg: 'rc, 'rc>( &self, - h: &Helper<'reg, 'rc>, + h: &Helper<'rc>, _: &'reg Handlebars<'_>, _: &'rc Context, _: &mut RenderContext<'reg, 'rc>, @@ -136,15 +139,18 @@ impl HelperDef for SnakeHelper { ) -> HelperResult { let value = h .param(0) - .ok_or_else(|| RenderError::new("First param not found for helper \"snake\""))?; + .ok_or_else(|| RenderErrorReason::ParamNotFoundForIndex("snake", 0))?; let raw = h .param(1) .and_then(|raw| raw.value().as_bool()) .unwrap_or(true); - let param = value - .value() - .as_str() - .ok_or_else(|| RenderError::new("Non-string first param given to helper \"snake\""))?; + let param = value.value().as_str().ok_or_else(|| { + RenderErrorReason::ParamTypeMismatchForName( + "snake", + "string".to_string(), + "string".to_string(), + ) + })?; out.write(&snake_case(param, raw))?; Ok(()) } @@ -155,7 +161,7 @@ pub struct SnakeTypeHelper; impl HelperDef for SnakeTypeHelper { fn call<'reg: 'rc, 'rc>( &self, - h: &Helper<'reg, 'rc>, + h: &Helper<'rc>, _: &'reg Handlebars<'_>, _: &'rc Context, _: &mut RenderContext<'reg, 'rc>, @@ -163,9 +169,14 @@ impl HelperDef for SnakeTypeHelper { ) -> HelperResult { let value = h .param(0) - .ok_or_else(|| RenderError::new("Param not found for helper \"snake_type\""))?; - let param: AMQPType = serde_json::from_value(value.value().clone()) - .map_err(|_| RenderError::new("Param is not an AMQPType for helper \"snake_type\""))?; + .ok_or_else(|| RenderErrorReason::ParamNotFoundForIndex("snake_type", 0))?; + let param: AMQPType = serde_json::from_value(value.value().clone()).map_err(|_| { + RenderErrorReason::ParamTypeMismatchForName( + "snake_type", + "AMQPType".to_string(), + "string".to_string(), + ) + })?; out.write(&snake_case(¶m.to_string(), true))?; Ok(()) } @@ -176,7 +187,7 @@ pub struct SanitizeNameHelper; impl HelperDef for SanitizeNameHelper { fn call<'reg: 'rc, 'rc>( &self, - h: &Helper<'reg, 'rc>, + h: &Helper<'rc>, _: &'reg Handlebars<'_>, _: &'rc Context, _: &mut RenderContext<'reg, 'rc>, @@ -184,9 +195,13 @@ impl HelperDef for SanitizeNameHelper { ) -> HelperResult { let value = h .param(0) - .ok_or_else(|| RenderError::new("Param not found for helper \"sanitize_name\""))?; + .ok_or_else(|| RenderErrorReason::ParamNotFoundForIndex("sanitize_name", 0))?; let param = value.value().as_str().ok_or_else(|| { - RenderError::new("Non-string param given to helper \"sanitize_name\"") + RenderErrorReason::ParamTypeMismatchForName( + "sanitize_name", + "string".to_string(), + "string".to_string(), + ) })?; out.write(¶m.replace('-', "_"))?; Ok(()) @@ -198,7 +213,7 @@ pub struct IncludeMoreHelper; impl HelperDef for IncludeMoreHelper { fn call<'reg: 'rc, 'rc>( &self, - h: &Helper<'reg, 'rc>, + h: &Helper<'rc>, _: &'reg Handlebars<'_>, _: &'rc Context, _: &mut RenderContext<'reg, 'rc>, @@ -206,18 +221,24 @@ impl HelperDef for IncludeMoreHelper { ) -> HelperResult { let amqp_class = h .param(0) - .ok_or_else(|| RenderError::new("Param not found for helper \"include_more\""))?; + .ok_or_else(|| RenderErrorReason::ParamNotFoundForIndex("include_more", 0))?; let amqp_method = h .param(1) - .ok_or_else(|| RenderError::new("Param not found for helper \"include_more\""))?; - let amqp_class = amqp_class - .value() - .as_str() - .ok_or_else(|| RenderError::new("Non-string param given to helper \"include_more\""))?; - let amqp_method = amqp_method - .value() - .as_str() - .ok_or_else(|| RenderError::new("Non-string param given to helper \"include_more\""))?; + .ok_or_else(|| RenderErrorReason::ParamNotFoundForIndex("include_more", 1))?; + let amqp_class = amqp_class.value().as_str().ok_or_else(|| { + RenderErrorReason::ParamTypeMismatchForName( + "include_more", + "string".to_string(), + "class".to_string(), + ) + })?; + let amqp_method = amqp_method.value().as_str().ok_or_else(|| { + RenderErrorReason::ParamTypeMismatchForName( + "include_more", + "string".to_string(), + "method".to_string(), + ) + })?; if let Ok(cargo_manifest_dir) = std::env::var("CARGO_MANIFEST_DIR") { let include = Path::new(&cargo_manifest_dir) .join("templates") @@ -237,16 +258,21 @@ pub struct PassByRefHelper; impl HelperDef for PassByRefHelper { fn call_inner<'reg: 'rc, 'rc>( &self, - h: &Helper<'reg, 'rc>, + h: &Helper<'rc>, _: &'reg Handlebars<'_>, _: &'rc Context, _: &mut RenderContext<'reg, 'rc>, - ) -> Result<ScopedJson<'reg, 'rc>, RenderError> { + ) -> Result<ScopedJson<'rc>, RenderError> { let value = h .param(0) - .ok_or_else(|| RenderError::new("Param not found for helper \"pass_by_ref\""))?; - let param: AMQPType = serde_json::from_value(value.value().clone()) - .map_err(|_| RenderError::new("Param is not an AMQPType for helper \"pass_by_ref\""))?; + .ok_or_else(|| RenderErrorReason::ParamNotFoundForIndex("pass_by_ref", 0))?; + let param: AMQPType = serde_json::from_value(value.value().clone()).map_err(|_| { + RenderErrorReason::ParamTypeMismatchForName( + "pass_by_ref", + "AMQPType".to_string(), + "string".to_string(), + ) + })?; let pass_by_ref = matches!( param, AMQPType::ShortString @@ -264,14 +290,14 @@ pub struct UseStrRefHelper; impl HelperDef for UseStrRefHelper { fn call_inner<'reg: 'rc, 'rc>( &self, - h: &Helper<'reg, 'rc>, + h: &Helper<'rc>, _: &'reg Handlebars<'_>, _: &'rc Context, _: &mut RenderContext<'reg, 'rc>, - ) -> Result<ScopedJson<'reg, 'rc>, RenderError> { + ) -> Result<ScopedJson<'rc>, RenderError> { let value = h .param(0) - .ok_or_else(|| RenderError::new("Param not found for helper \"use_str_ref\""))?; + .ok_or_else(|| RenderErrorReason::ParamNotFoundForIndex("use_str_ref", 0))?; let param = serde_json::from_value::<AMQPType>(value.value().clone()).ok(); let use_str_ref = matches!( param, @@ -286,14 +312,14 @@ pub struct UseBytesRefHelper; impl HelperDef for UseBytesRefHelper { fn call_inner<'reg: 'rc, 'rc>( &self, - h: &Helper<'reg, 'rc>, + h: &Helper<'rc>, _: &'reg Handlebars<'_>, _: &'rc Context, _: &mut RenderContext<'reg, 'rc>, - ) -> Result<ScopedJson<'reg, 'rc>, RenderError> { + ) -> Result<ScopedJson<'rc>, RenderError> { let value = h .param(0) - .ok_or_else(|| RenderError::new("Param not found for helper \"use_bytes_ref\""))?; + .ok_or_else(|| RenderErrorReason::ParamNotFoundForIndex("use_bytes_ref", 0))?; let param = serde_json::from_value::<AMQPType>(value.value().clone()).ok(); let use_bytes_ref = matches!(param, Some(AMQPType::LongString)); Ok(ScopedJson::Derived(JsonValue::from(use_bytes_ref))) @@ -305,7 +331,7 @@ pub struct EachArgumentHelper; impl HelperDef for EachArgumentHelper { fn call<'reg: 'rc, 'rc>( &self, - h: &Helper<'reg, 'rc>, + h: &Helper<'rc>, r: &'reg Handlebars<'_>, ctx: &'rc Context, rc: &mut RenderContext<'reg, 'rc>, @@ -313,7 +339,7 @@ impl HelperDef for EachArgumentHelper { ) -> HelperResult { let value = h .param(0) - .ok_or_else(|| RenderError::new("Param not found for helper \"each_argument\""))?; + .ok_or_else(|| RenderErrorReason::ParamNotFoundForIndex("each_argument", 0))?; if let Some(t) = h.template() { let mut block_context = BlockContext::new(); @@ -322,11 +348,12 @@ impl HelperDef for EachArgumentHelper { } rc.push_block(block_context); let arguments: Vec<AMQPArgument> = serde_json::from_value(value.value().clone()) - .map_err(|err| { - RenderError::new(format!( - "Param is not a Vec<AMQPArgument> for helper \"each_argument\": {}", - err - )) + .map_err(|_| { + RenderErrorReason::ParamTypeMismatchForName( + "each_argument", + "Vec<AMQPArgument>".to_string(), + "arguments".to_string(), + ) })?; let len = arguments.len(); let array_path = value.context_path(); @@ -368,40 +395,49 @@ pub struct AMQPValueRefHelper; impl HelperDef for AMQPValueRefHelper { fn call_inner<'reg: 'rc, 'rc>( &self, - h: &Helper<'reg, 'rc>, + h: &Helper<'rc>, _: &'reg Handlebars<'_>, _: &'rc Context, _: &mut RenderContext<'reg, 'rc>, - ) -> Result<ScopedJson<'reg, 'rc>, RenderError> { + ) -> Result<ScopedJson<'rc>, RenderError> { let arg = h .param(0) - .ok_or_else(|| RenderError::new("First param not found for helper \"amqp_value\""))?; - let param: AMQPValue = serde_json::from_value(arg.value().clone()) - .map_err(|_| RenderError::new("Param is not an AMQPValue for helper \"amqp_value\""))?; - let value = match param { - AMQPValue::Boolean(v) => serde_json::to_value(v)?, - AMQPValue::ShortShortInt(v) => serde_json::to_value(v)?, - AMQPValue::ShortShortUInt(v) => serde_json::to_value(v)?, - AMQPValue::ShortInt(v) => serde_json::to_value(v)?, - AMQPValue::ShortUInt(v) => serde_json::to_value(v)?, - AMQPValue::LongInt(v) => serde_json::to_value(v)?, - AMQPValue::LongUInt(v) => serde_json::to_value(v)?, - AMQPValue::LongLongInt(v) => serde_json::to_value(v)?, - AMQPValue::Float(v) => serde_json::to_value(v)?, - AMQPValue::Double(v) => serde_json::to_value(v)?, - AMQPValue::DecimalValue(v) => serde_json::to_value(v)?, - AMQPValue::ShortString(v) => serde_json::to_value(format!("\"{}\"", v))?, - AMQPValue::LongString(v) => serde_json::to_value(format!("b\"{}\"", v))?, - AMQPValue::FieldArray(v) => serde_json::to_value(v)?, - AMQPValue::Timestamp(v) => serde_json::to_value(v)?, - AMQPValue::FieldTable(v) => serde_json::to_value(v)?, - AMQPValue::ByteArray(v) => serde_json::to_value(v)?, - AMQPValue::Void => JsonValue::Null, - }; + .ok_or_else(|| RenderErrorReason::ParamNotFoundForIndex("amqp_value", 0))?; + let param = serde_json::from_value(arg.value().clone()).map_err(|_| { + RenderErrorReason::ParamTypeMismatchForName( + "amqp_value", + "AMQPValue".to_string(), + "value".to_string(), + ) + })?; + let value = json_value(param).map_err(RenderErrorReason::SerdeError)?; Ok(ScopedJson::Derived(value)) } } +fn json_value(val: AMQPValue) -> serde_json::Result<serde_json::Value> { + match val { + AMQPValue::Boolean(v) => serde_json::to_value(v), + AMQPValue::ShortShortInt(v) => serde_json::to_value(v), + AMQPValue::ShortShortUInt(v) => serde_json::to_value(v), + AMQPValue::ShortInt(v) => serde_json::to_value(v), + AMQPValue::ShortUInt(v) => serde_json::to_value(v), + AMQPValue::LongInt(v) => serde_json::to_value(v), + AMQPValue::LongUInt(v) => serde_json::to_value(v), + AMQPValue::LongLongInt(v) => serde_json::to_value(v), + AMQPValue::Float(v) => serde_json::to_value(v), + AMQPValue::Double(v) => serde_json::to_value(v), + AMQPValue::DecimalValue(v) => serde_json::to_value(v), + AMQPValue::ShortString(v) => serde_json::to_value(format!("\"{}\"", v)), + AMQPValue::LongString(v) => serde_json::to_value(format!("b\"{}\"", v)), + AMQPValue::FieldArray(v) => serde_json::to_value(v), + AMQPValue::Timestamp(v) => serde_json::to_value(v), + AMQPValue::FieldTable(v) => serde_json::to_value(v), + AMQPValue::ByteArray(v) => serde_json::to_value(v), + AMQPValue::Void => Ok(JsonValue::Null), + } +} + #[cfg(test)] mod test { use super::*; From 627f224eef9e41bfe076c121635ad78da189a392 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <ma.perennou@criteo.com> Date: Tue, 23 Apr 2024 10:34:53 +0200 Subject: [PATCH 098/133] disable cookie-factory async feature --- protocol/Cargo.toml | 5 +++-- types/Cargo.toml | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index cbf9d1fa..c05803b6 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -46,8 +46,9 @@ version = "=7.1.2" path = "../uri" [dependencies.cookie-factory] -version = "^0.3" -features = ["std"] +version = "^0.3" +default-features = false +features = ["std"] [dependencies.nom] version = "^7.0" diff --git a/types/Cargo.toml b/types/Cargo.toml index 3de0395d..23c7445b 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -21,8 +21,9 @@ verbose-errors = [] serde_json = "^1.0" [dependencies.cookie-factory] -version = "^0.3" -features = ["std"] +version = "^0.3" +default-features = false +features = ["std"] [dependencies.nom] version = "^7.0" From d1990ed8e58bf9d7f6801baec9225b5d951a9f0b Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <ma.perennou@criteo.com> Date: Tue, 23 Apr 2024 10:35:16 +0200 Subject: [PATCH 099/133] update specs --- codegen/specs/amqp-rabbitmq-0.9.1.json | 2 +- protocol/src/generated.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/codegen/specs/amqp-rabbitmq-0.9.1.json b/codegen/specs/amqp-rabbitmq-0.9.1.json index 43f3cf64..a757c577 100644 --- a/codegen/specs/amqp-rabbitmq-0.9.1.json +++ b/codegen/specs/amqp-rabbitmq-0.9.1.json @@ -5,7 +5,7 @@ "revision": 1, "port": 5672, "copyright": [ - "Copyright (C) 2008-2020 VMware, Inc. or its affiliates.\n", + "Copyright (C) 2007-2024 Broadcom Inc. and its subsidiaries. All rights reserved.\n", "\n", "Permission is hereby granted, free of charge, to any person\n", "obtaining a copy of this file (the \"Software\"), to deal in the\n", diff --git a/protocol/src/generated.rs b/protocol/src/generated.rs index 7ca916b0..35fbd809 100644 --- a/protocol/src/generated.rs +++ b/protocol/src/generated.rs @@ -13,7 +13,7 @@ pub mod metadata { /// The default port of the protocol pub const PORT: LongUInt = 5672; /// The copyright holding the protocol - pub const COPYRIGHT: &str = r#"Copyright (C) 2008-2020 VMware, Inc. or its affiliates. + pub const COPYRIGHT: &str = r#"Copyright (C) 2007-2024 Broadcom Inc. and its subsidiaries. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this file (the "Software"), to deal in the From 9bfd277291fa72f813d42e268e5ab904017ab5c5 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <ma.perennou@criteo.com> Date: Wed, 24 Apr 2024 17:09:50 +0200 Subject: [PATCH 100/133] tcp: update tcp-stream --- tcp/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index 97c6586e..332d163e 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -29,7 +29,7 @@ version = "=7.1.2" path = "../uri" [dependencies.tcp-stream] -version = "^0.27" +version = "^0.28" default-features = false [dependencies.tracing] From ced9f593a21b317319df5b82b8c2c0a335c01f26 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <ma.perennou@criteo.com> Date: Wed, 24 Apr 2024 17:11:34 +0200 Subject: [PATCH 101/133] don't manually define html_root_url --- codegen/Cargo.toml | 2 +- codegen/src/lib.rs | 2 -- protocol/Cargo.toml | 2 +- protocol/src/lib.rs | 2 -- tcp/Cargo.toml | 2 +- tcp/src/lib.rs | 2 -- types/Cargo.toml | 2 +- types/src/lib.rs | 2 -- uri/Cargo.toml | 2 +- uri/src/lib.rs | 2 -- 10 files changed, 5 insertions(+), 15 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 938d4de7..9ddd1d89 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "7.1.2" # remember to update html_root_url +version = "7.1.2" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" diff --git a/codegen/src/lib.rs b/codegen/src/lib.rs index 4cc3a875..d13f1a35 100644 --- a/codegen/src/lib.rs +++ b/codegen/src/lib.rs @@ -1,6 +1,4 @@ #![deny(missing_docs)] -#![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-codegen/7.1.2/")] //! # AMQP code generation utilities //! diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index c05803b6..0b65b5dd 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "7.1.2" # remember to update html_root_url +version = "7.1.2" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs index fa45acc6..2bd2e0bf 100644 --- a/protocol/src/lib.rs +++ b/protocol/src/lib.rs @@ -1,6 +1,4 @@ #![deny(missing_docs)] -#![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol/7.1.2/")] //! # AMQP manipulation library //! diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index 332d163e..845295d3 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "7.1.2" # remember to update html_root_url +version = "7.1.2" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" diff --git a/tcp/src/lib.rs b/tcp/src/lib.rs index 7ee233fd..b8178813 100644 --- a/tcp/src/lib.rs +++ b/tcp/src/lib.rs @@ -1,6 +1,4 @@ #![deny(missing_docs)] -#![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/7.1.2/")] //! # AMQP URI TCP connection handling //! diff --git a/types/Cargo.toml b/types/Cargo.toml index 23c7445b..43b95089 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "7.1.2" # remember to update html_root_url +version = "7.1.2" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/types/src/lib.rs b/types/src/lib.rs index 53c8305a..cefa1bd6 100644 --- a/types/src/lib.rs +++ b/types/src/lib.rs @@ -1,6 +1,4 @@ #![deny(missing_docs)] -#![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-types/7.1.2/")] //! # AMQP types manipulation library //! diff --git a/uri/Cargo.toml b/uri/Cargo.toml index 41508f87..808198f1 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "7.1.2" # remember to update html_root_url +version = "7.1.2" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" diff --git a/uri/src/lib.rs b/uri/src/lib.rs index f4d1e1db..735c7b4a 100644 --- a/uri/src/lib.rs +++ b/uri/src/lib.rs @@ -1,6 +1,4 @@ #![deny(missing_docs)] -#![warn(rust_2018_idioms)] -#![doc(html_root_url = "https://docs.rs/amq-protocol-uri/7.1.2/")] //! # AMQP URI manipulation library //! From 98fa3c53f5e259905af6bb32fa432c3c1a894601 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <ma.perennou@criteo.com> Date: Wed, 24 Apr 2024 17:14:54 +0200 Subject: [PATCH 102/133] silence clippy warnings --- types/src/generation.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/src/generation.rs b/types/src/generation.rs index 463bef00..9c20ae42 100644 --- a/types/src/generation.rs +++ b/types/src/generation.rs @@ -173,9 +173,9 @@ pub fn gen_byte_array<'a, W: Write + 'a>(a: &'a ByteArray) -> impl SerializeFn<W /// Generate the [AMQPFlags](../type.AMQPFlags.html) in the given buffer (x) pub fn gen_flags<'a, W: Write + 'a>(f: &'a AMQPFlags) -> impl SerializeFn<W> + 'a { move |x| { - f.get_bytes().iter().fold(Ok(x), |acc: GenResult<W>, b| { - acc.and_then(|x| gen_short_short_uint(*b)(x)) - }) + f.get_bytes() + .iter() + .try_fold(x, |acc, b| gen_short_short_uint(*b)(acc)) } } From f90cfe2f5796fb3ec45cc7b99293bda329cabe13 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <ma.perennou@criteo.com> Date: Wed, 24 Apr 2024 17:15:37 +0200 Subject: [PATCH 103/133] v7.2.0 --- codegen/Cargo.toml | 4 ++-- protocol/Cargo.toml | 10 +++++----- tcp/Cargo.toml | 4 ++-- types/Cargo.toml | 2 +- uri/Cargo.toml | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 9ddd1d89..a1dacbf7 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "7.1.2" +version = "7.2.0" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" @@ -19,7 +19,7 @@ handlebars = "^5.0" serde_json = "^1.0" [dependencies.amq-protocol-types] -version = "=7.1.2" +version = "=7.2.0" path = "../types" [dependencies.serde] diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index 0b65b5dd..a413919a 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "7.1.2" +version = "7.2.0" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" @@ -28,21 +28,21 @@ vendored-openssl = ["amq-protocol-tcp/vendored-openssl"] verbose-errors = ["amq-protocol-types/verbose-errors"] [build-dependencies.amq-protocol-codegen] -version = "=7.1.2" +version = "=7.2.0" path = "../codegen" optional = true [dependencies.amq-protocol-tcp] -version = "=7.1.2" +version = "=7.2.0" default-features = false path = "../tcp" [dependencies.amq-protocol-types] -version = "=7.1.2" +version = "=7.2.0" path = "../types" [dependencies.amq-protocol-uri] -version = "=7.1.2" +version = "=7.2.0" path = "../uri" [dependencies.cookie-factory] diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index 845295d3..b60f35b3 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "7.1.2" +version = "7.2.0" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" @@ -25,7 +25,7 @@ rustls-connector = ["tcp-stream/rustls-connector"] vendored-openssl = ["tcp-stream/vendored-openssl"] [dependencies.amq-protocol-uri] -version = "=7.1.2" +version = "=7.2.0" path = "../uri" [dependencies.tcp-stream] diff --git a/types/Cargo.toml b/types/Cargo.toml index 43b95089..1d28bb86 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "7.1.2" +version = "7.2.0" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/uri/Cargo.toml b/uri/Cargo.toml index 808198f1..233e0eed 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "7.1.2" +version = "7.2.0" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" @@ -15,7 +15,7 @@ rust-version = "1.63.0" name = "amq_protocol_uri" [dependencies.amq-protocol-types] -version = "=7.1.2" +version = "=7.2.0" path = "../types" [dependencies] From fc52c62452af4d100eadb5211181fc71198095ed Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Thu, 20 Jun 2024 14:15:51 +0200 Subject: [PATCH 104/133] update tcp-stream to 0.29 Fixes !35 --- README.md | 26 ++++++++++++++++++++++++++ protocol/Cargo.toml | 7 ++++++- tcp/Cargo.toml | 13 +++++++++---- 3 files changed, 41 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 23e6f4e7..299276ac 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,29 @@ [](https://docs.rs/amq-protocol) [](https://github.com/amqp-rs/amq-protocol/actions) [](https://crates.io/crates/amq-protocol) + +## Features + +- codegen: force code generation (default to pregenerated sources) +- vendored-openssl: use a vendored openssl version instead of the system one (when using openssl backend) +- verbose-errors: enable more verbose errors in the AMQP parser + +## TLS backends + +- native-tls +- openssl +- rustls (default) + +## Rustls certificates store + +- rustls-native-certs (default) +- rustls-webpki-roots-certs + +## Warning about crypto backends for rustls + +A crypto implementation must be enabled in rustls using feature flags. +We mimic what rustls does, providing one feature flag per implementation and enabling the same as rustls by default. +Available options are: +- `rustls--aws_lc_rs` (default) +- `rustls--ring` + diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index a413919a..313294b6 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -16,7 +16,7 @@ rust-version = "1.63.0" name = "amq_protocol" [features] -default = ["native-tls"] +default = ["rustls"] codegen = ["codegen-internal"] codegen-internal = ["amq-protocol-codegen"] native-tls = ["amq-protocol-tcp/native-tls"] @@ -27,6 +27,11 @@ rustls-webpki-roots-certs = ["amq-protocol-tcp/rustls-webpki-roots-certs"] vendored-openssl = ["amq-protocol-tcp/vendored-openssl"] verbose-errors = ["amq-protocol-types/verbose-errors"] +# rustls crypto providers. Choose at least one. Otherwise, runtime errors. +# See https://docs.rs/rustls/latest/rustls/#crate-features. for more info +rustls--aws_lc_rs = ["amq-protocol-tcp/rustls--aws_lc_rs"] # default, but doesn't build everywhere +rustls--ring = ["amq-protocol-tcp/rustls--ring"] # more compatible, (e.g., easily builds on Windows) + [build-dependencies.amq-protocol-codegen] version = "=7.2.0" path = "../codegen" diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index b60f35b3..22c34005 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -18,18 +18,23 @@ name = "amq_protocol_tcp" default = ["rustls"] native-tls = ["tcp-stream/native-tls"] openssl = ["tcp-stream/openssl"] -rustls = ["rustls-native-certs"] -rustls-native-certs = ["tcp-stream/rustls-native-certs", "rustls-connector"] -rustls-webpki-roots-certs = ["tcp-stream/rustls-webpki-roots-certs", "rustls-connector"] +rustls = ["rustls-native-certs", "rustls--aws_lc_rs"] +rustls-native-certs = ["rustls-connector", "tcp-stream/rustls-native-certs"] +rustls-webpki-roots-certs = ["rustls-connector", "tcp-stream/rustls-webpki-roots-certs"] rustls-connector = ["tcp-stream/rustls-connector"] vendored-openssl = ["tcp-stream/vendored-openssl"] +# rustls crypto providers. Choose at least one. Otherwise, runtime errors. +# See https://docs.rs/rustls/latest/rustls/#crate-features. for more info +rustls--aws_lc_rs = ["tcp-stream/rustls--aws_lc_rs"] # default, but doesn't build everywhere +rustls--ring = ["tcp-stream/rustls--ring"] # more compatible, (e.g., easily builds on Windows) + [dependencies.amq-protocol-uri] version = "=7.2.0" path = "../uri" [dependencies.tcp-stream] -version = "^0.28" +version = "^0.29" default-features = false [dependencies.tracing] From 1d1aa2e9accfd2c1d73b8e72d33c156977d20eff Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Wed, 29 May 2024 19:33:37 +0200 Subject: [PATCH 105/133] port to nom 8 --- protocol/Cargo.toml | 2 +- protocol/src/frame/parsing.rs | 61 ++-- protocol/src/generated.rs | 489 ++++++++++++++++++--------------- protocol/src/protocol.rs | 1 + protocol/templates/protocol.rs | 12 +- types/Cargo.toml | 2 +- types/src/flags.rs | 2 +- types/src/parsing.rs | 126 ++++----- 8 files changed, 376 insertions(+), 319 deletions(-) diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index 313294b6..ed1826d0 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -56,7 +56,7 @@ default-features = false features = ["std"] [dependencies.nom] -version = "^7.0" +version = "=8.0.0-alpha2" features = ["std"] [dependencies.serde] diff --git a/protocol/src/frame/parsing.rs b/protocol/src/frame/parsing.rs index 4f9a189a..6d917dd4 100644 --- a/protocol/src/frame/parsing.rs +++ b/protocol/src/frame/parsing.rs @@ -9,13 +9,13 @@ use nom::{ bytes::streaming::{tag, take}, combinator::{all_consuming, flat_map, map, map_opt, map_res}, error::context, - sequence::{pair, tuple}, + Parser, }; use traits::ParsableInput; /// Parse a channel id pub fn parse_channel<I: ParsableInput>(i: I) -> ParserResult<I, AMQPChannel> { - context("parse_channel", map(parse_id, From::from))(i) + context("parse_channel", map(parse_id, From::from)).parse(i) } /// Parse the protocol header @@ -23,20 +23,21 @@ pub fn parse_protocol_header<I: ParsableInput>(i: I) -> ParserResult<I, Protocol context( "parse_protocol_header", map( - tuple(( + ( tag(&metadata::NAME.as_bytes()[1..]), tag(&[0][..]), parse_short_short_uint, parse_short_short_uint, parse_short_short_uint, - )), + ), |(_, _, major, minor, revision)| ProtocolVersion { major, minor, revision, }, ), - )(i) + ) + .parse(i) } /// Parse the frame type @@ -51,7 +52,8 @@ pub fn parse_frame_type<I: ParsableInput>(i: I) -> ParserResult<I, AMQPFrameType constants::FRAME_HEARTBEAT => Some(AMQPFrameType::Heartbeat), _ => None, }), - )(i) + ) + .parse(i) } /// Parse a full AMQP Frame (with contents) @@ -61,7 +63,7 @@ pub fn parse_frame<I: ParsableInput>(i: I) -> ParserResult<I, AMQPFrame> { flat_map(parse_frame_type, move |frame_type| { move |i: I| match frame_type { AMQPFrameType::ProtocolHeader => { - map(parse_protocol_header, AMQPFrame::ProtocolHeader)(i) + map(parse_protocol_header, AMQPFrame::ProtocolHeader).parse(i) } frame_type => map_res( parse_raw_frame(frame_type), @@ -74,9 +76,11 @@ pub fn parse_frame<I: ParsableInput>(i: I) -> ParserResult<I, AMQPFrame> { AMQPFrameType::ProtocolHeader => { Ok(AMQPFrame::ProtocolHeader(ProtocolVersion::amqp_0_9_1())) } - AMQPFrameType::Method => all_consuming(parse_class)(payload) + AMQPFrameType::Method => all_consuming(parse_class) + .parse(payload) .map(|(_, m)| AMQPFrame::Method(channel_id, m)), - AMQPFrameType::Header => all_consuming(parse_content_header)(payload) + AMQPFrameType::Header => all_consuming(parse_content_header) + .parse(payload) .map(|(_, h)| AMQPFrame::Header(channel_id, h.class_id, Box::new(h))), AMQPFrameType::Body => Ok(AMQPFrame::Body( channel_id, @@ -84,10 +88,12 @@ pub fn parse_frame<I: ParsableInput>(i: I) -> ParserResult<I, AMQPFrame> { )), AMQPFrameType::Heartbeat => Ok(AMQPFrame::Heartbeat(channel_id)), }, - )(i), + ) + .parse(i), } }), - )(i) + ) + .parse(i) } /// Parse a raw AMQP frame @@ -97,20 +103,18 @@ pub fn parse_raw_frame<I: ParsableInput>( move |i: I| { context( "parse_raw_frame", - flat_map( - pair(parse_id, parse_long_uint), - move |(channel_id, size)| { - map( - pair(take(size), tag(&[constants::FRAME_END][..])), - move |(payload, _)| AMQPRawFrame { - frame_type, - channel_id, - payload, - }, - ) - }, - ), - )(i) + flat_map((parse_id, parse_long_uint), move |(channel_id, size)| { + map( + (take(size), tag(&[constants::FRAME_END][..])), + move |(payload, _)| AMQPRawFrame { + frame_type, + channel_id, + payload, + }, + ) + }), + ) + .parse(i) } } @@ -119,12 +123,12 @@ pub fn parse_content_header<I: ParsableInput>(i: I) -> ParserResult<I, AMQPConte context( "parse_content_header", map( - tuple(( + ( parse_id, parse_short_uint, parse_long_long_uint, context("parse_properties", parse_properties), - )), + ), // FIXME: should we validate that weight is 0? |(class_id, _weight, body_size, properties)| AMQPContentHeader { class_id, @@ -132,7 +136,8 @@ pub fn parse_content_header<I: ParsableInput>(i: I) -> ParserResult<I, AMQPConte properties, }, ), - )(i) + ) + .parse(i) } #[cfg(test)] diff --git a/protocol/src/generated.rs b/protocol/src/generated.rs index 35fbd809..62c76fc7 100644 --- a/protocol/src/generated.rs +++ b/protocol/src/generated.rs @@ -224,20 +224,21 @@ pub fn parse_class<I: ParsableInput>(i: I) -> ParserResult<I, AMQPClass> { map_opt( flat_map(parse_id, |id| { move |i| match id { - 60 => map(map(parse_basic, AMQPClass::Basic), Some)(i), - 10 => map(map(parse_connection, AMQPClass::Connection), Some)(i), - 20 => map(map(parse_channel, AMQPClass::Channel), Some)(i), - 30 => map(map(parse_access, AMQPClass::Access), Some)(i), - 40 => map(map(parse_exchange, AMQPClass::Exchange), Some)(i), - 50 => map(map(parse_queue, AMQPClass::Queue), Some)(i), - 90 => map(map(parse_tx, AMQPClass::Tx), Some)(i), - 85 => map(map(parse_confirm, AMQPClass::Confirm), Some)(i), + 60 => map(map(parse_basic, AMQPClass::Basic), Some).parse(i), + 10 => map(map(parse_connection, AMQPClass::Connection), Some).parse(i), + 20 => map(map(parse_channel, AMQPClass::Channel), Some).parse(i), + 30 => map(map(parse_access, AMQPClass::Access), Some).parse(i), + 40 => map(map(parse_exchange, AMQPClass::Exchange), Some).parse(i), + 50 => map(map(parse_queue, AMQPClass::Queue), Some).parse(i), + 90 => map(map(parse_tx, AMQPClass::Tx), Some).parse(i), + 85 => map(map(parse_confirm, AMQPClass::Confirm), Some).parse(i), _ => Ok((i, None)), } }), std::convert::identity, ), - )(i) + ) + .parse(i) } /// Serialize an AMQP class @@ -376,74 +377,91 @@ pub mod basic { map_opt( flat_map(parse_id, |id| { move |i| match id { - 10 => context("parse_qos", map(map(parse_qos, AMQPMethod::Qos), Some))(i), + 10 => context("parse_qos", map(map(parse_qos, AMQPMethod::Qos), Some)) + .parse(i), 11 => context( "parse_qos_ok", map(map(parse_qos_ok, AMQPMethod::QosOk), Some), - )(i), + ) + .parse(i), 20 => context( "parse_consume", map(map(parse_consume, AMQPMethod::Consume), Some), - )(i), + ) + .parse(i), 21 => context( "parse_consume_ok", map(map(parse_consume_ok, AMQPMethod::ConsumeOk), Some), - )(i), + ) + .parse(i), 30 => context( "parse_cancel", map(map(parse_cancel, AMQPMethod::Cancel), Some), - )(i), + ) + .parse(i), 31 => context( "parse_cancel_ok", map(map(parse_cancel_ok, AMQPMethod::CancelOk), Some), - )(i), + ) + .parse(i), 40 => context( "parse_publish", map(map(parse_publish, AMQPMethod::Publish), Some), - )(i), + ) + .parse(i), 50 => context( "parse_return", map(map(parse_return, AMQPMethod::Return), Some), - )(i), + ) + .parse(i), 60 => context( "parse_deliver", map(map(parse_deliver, AMQPMethod::Deliver), Some), - )(i), - 70 => context("parse_get", map(map(parse_get, AMQPMethod::Get), Some))(i), + ) + .parse(i), + 70 => context("parse_get", map(map(parse_get, AMQPMethod::Get), Some)) + .parse(i), 71 => context( "parse_get_ok", map(map(parse_get_ok, AMQPMethod::GetOk), Some), - )(i), + ) + .parse(i), 72 => context( "parse_get_empty", map(map(parse_get_empty, AMQPMethod::GetEmpty), Some), - )(i), - 80 => context("parse_ack", map(map(parse_ack, AMQPMethod::Ack), Some))(i), + ) + .parse(i), + 80 => context("parse_ack", map(map(parse_ack, AMQPMethod::Ack), Some)) + .parse(i), 90 => context( "parse_reject", map(map(parse_reject, AMQPMethod::Reject), Some), - )(i), + ) + .parse(i), 100 => context( "parse_recover_async", map(map(parse_recover_async, AMQPMethod::RecoverAsync), Some), - )(i), + ) + .parse(i), 110 => context( "parse_recover", map(map(parse_recover, AMQPMethod::Recover), Some), - )(i), + ) + .parse(i), 111 => context( "parse_recover_ok", map(map(parse_recover_ok, AMQPMethod::RecoverOk), Some), - )(i), - 120 => { - context("parse_nack", map(map(parse_nack, AMQPMethod::Nack), Some))(i) - } + ) + .parse(i), + 120 => context("parse_nack", map(map(parse_nack, AMQPMethod::Nack), Some)) + .parse(i), _ => Ok((i, None)), } }), std::convert::identity, ), - )(i) + ) + .parse(i) } /// Serialize basic (Generated) @@ -536,8 +554,8 @@ pub mod basic { /// Parse qos (Generated) pub fn parse_qos<I: ParsableInput>(i: I) -> ParserResult<I, Qos> { - let (i, _) = parse_long_uint(i)?; - let (i, prefetch_count) = parse_short_uint(i)?; + let (i, _) = parse_long_uint.parse(i)?; + let (i, prefetch_count) = parse_short_uint.parse(i)?; let (i, flags) = parse_flags(i, &["global"])?; Ok(( i, @@ -625,11 +643,11 @@ pub mod basic { /// Parse consume (Generated) pub fn parse_consume<I: ParsableInput>(i: I) -> ParserResult<I, Consume> { - let (i, _) = parse_short_uint(i)?; - let (i, queue) = parse_short_string(i)?; - let (i, consumer_tag) = parse_short_string(i)?; + let (i, _) = parse_short_uint.parse(i)?; + let (i, queue) = parse_short_string.parse(i)?; + let (i, consumer_tag) = parse_short_string.parse(i)?; let (i, flags) = parse_flags(i, &["no-local", "no-ack", "exclusive", "nowait"])?; - let (i, arguments) = parse_field_table(i)?; + let (i, arguments) = parse_field_table.parse(i)?; Ok(( i, Consume { @@ -684,7 +702,7 @@ pub mod basic { /// Parse consume-ok (Generated) pub fn parse_consume_ok<I: ParsableInput>(i: I) -> ParserResult<I, ConsumeOk> { - let (i, consumer_tag) = parse_short_string(i)?; + let (i, consumer_tag) = parse_short_string.parse(i)?; Ok((i, ConsumeOk { consumer_tag })) } @@ -721,7 +739,7 @@ pub mod basic { /// Parse cancel (Generated) pub fn parse_cancel<I: ParsableInput>(i: I) -> ParserResult<I, Cancel> { - let (i, consumer_tag) = parse_short_string(i)?; + let (i, consumer_tag) = parse_short_string.parse(i)?; let (i, flags) = parse_flags(i, &["nowait"])?; Ok(( i, @@ -766,7 +784,7 @@ pub mod basic { /// Parse cancel-ok (Generated) pub fn parse_cancel_ok<I: ParsableInput>(i: I) -> ParserResult<I, CancelOk> { - let (i, consumer_tag) = parse_short_string(i)?; + let (i, consumer_tag) = parse_short_string.parse(i)?; Ok((i, CancelOk { consumer_tag })) } @@ -807,9 +825,9 @@ pub mod basic { /// Parse publish (Generated) pub fn parse_publish<I: ParsableInput>(i: I) -> ParserResult<I, Publish> { - let (i, _) = parse_short_uint(i)?; - let (i, exchange) = parse_short_string(i)?; - let (i, routing_key) = parse_short_string(i)?; + let (i, _) = parse_short_uint.parse(i)?; + let (i, exchange) = parse_short_string.parse(i)?; + let (i, routing_key) = parse_short_string.parse(i)?; let (i, flags) = parse_flags(i, &["mandatory", "immediate"])?; Ok(( i, @@ -865,10 +883,10 @@ pub mod basic { /// Parse return (Generated) pub fn parse_return<I: ParsableInput>(i: I) -> ParserResult<I, Return> { - let (i, reply_code) = parse_short_uint(i)?; - let (i, reply_text) = parse_short_string(i)?; - let (i, exchange) = parse_short_string(i)?; - let (i, routing_key) = parse_short_string(i)?; + let (i, reply_code) = parse_short_uint.parse(i)?; + let (i, reply_text) = parse_short_string.parse(i)?; + let (i, exchange) = parse_short_string.parse(i)?; + let (i, routing_key) = parse_short_string.parse(i)?; Ok(( i, Return { @@ -922,11 +940,11 @@ pub mod basic { /// Parse deliver (Generated) pub fn parse_deliver<I: ParsableInput>(i: I) -> ParserResult<I, Deliver> { - let (i, consumer_tag) = parse_short_string(i)?; - let (i, delivery_tag) = parse_long_long_uint(i)?; + let (i, consumer_tag) = parse_short_string.parse(i)?; + let (i, delivery_tag) = parse_long_long_uint.parse(i)?; let (i, flags) = parse_flags(i, &["redelivered"])?; - let (i, exchange) = parse_short_string(i)?; - let (i, routing_key) = parse_short_string(i)?; + let (i, exchange) = parse_short_string.parse(i)?; + let (i, routing_key) = parse_short_string.parse(i)?; Ok(( i, Deliver { @@ -978,8 +996,8 @@ pub mod basic { /// Parse get (Generated) pub fn parse_get<I: ParsableInput>(i: I) -> ParserResult<I, Get> { - let (i, _) = parse_short_uint(i)?; - let (i, queue) = parse_short_string(i)?; + let (i, _) = parse_short_uint.parse(i)?; + let (i, queue) = parse_short_string.parse(i)?; let (i, flags) = parse_flags(i, &["no-ack"])?; Ok(( i, @@ -1033,11 +1051,11 @@ pub mod basic { /// Parse get-ok (Generated) pub fn parse_get_ok<I: ParsableInput>(i: I) -> ParserResult<I, GetOk> { - let (i, delivery_tag) = parse_long_long_uint(i)?; + let (i, delivery_tag) = parse_long_long_uint.parse(i)?; let (i, flags) = parse_flags(i, &["redelivered"])?; - let (i, exchange) = parse_short_string(i)?; - let (i, routing_key) = parse_short_string(i)?; - let (i, message_count) = parse_long_uint(i)?; + let (i, exchange) = parse_short_string.parse(i)?; + let (i, routing_key) = parse_short_string.parse(i)?; + let (i, message_count) = parse_long_uint.parse(i)?; Ok(( i, GetOk { @@ -1084,7 +1102,7 @@ pub mod basic { /// Parse get-empty (Generated) pub fn parse_get_empty<I: ParsableInput>(i: I) -> ParserResult<I, GetEmpty> { - let (i, _) = parse_short_string(i)?; + let (i, _) = parse_short_string.parse(i)?; Ok((i, GetEmpty {})) } @@ -1121,7 +1139,7 @@ pub mod basic { /// Parse ack (Generated) pub fn parse_ack<I: ParsableInput>(i: I) -> ParserResult<I, Ack> { - let (i, delivery_tag) = parse_long_long_uint(i)?; + let (i, delivery_tag) = parse_long_long_uint.parse(i)?; let (i, flags) = parse_flags(i, &["multiple"])?; Ok(( i, @@ -1168,7 +1186,7 @@ pub mod basic { /// Parse reject (Generated) pub fn parse_reject<I: ParsableInput>(i: I) -> ParserResult<I, Reject> { - let (i, delivery_tag) = parse_long_long_uint(i)?; + let (i, delivery_tag) = parse_long_long_uint.parse(i)?; let (i, flags) = parse_flags(i, &["requeue"])?; Ok(( i, @@ -1331,7 +1349,7 @@ pub mod basic { /// Parse nack (Generated) pub fn parse_nack<I: ParsableInput>(i: I) -> ParserResult<I, Nack> { - let (i, delivery_tag) = parse_long_long_uint(i)?; + let (i, delivery_tag) = parse_long_long_uint.parse(i)?; let (i, flags) = parse_flags(i, &["multiple", "requeue"])?; Ok(( i, @@ -1571,72 +1589,72 @@ pub mod basic { pub fn parse_properties<I: ParsableInput>(i: I) -> ParserResult<I, AMQPProperties> { let (i, flags) = parse_short_uint(i)?; let (i, content_type) = if flags & (1 << (15 - 0)) != 0 { - map(parse_short_string, Some)(i)? + map(parse_short_string, Some).parse(i)? } else { (i, None) }; let (i, content_encoding) = if flags & (1 << (15 - 1)) != 0 { - map(parse_short_string, Some)(i)? + map(parse_short_string, Some).parse(i)? } else { (i, None) }; let (i, headers) = if flags & (1 << (15 - 2)) != 0 { - map(parse_field_table, Some)(i)? + map(parse_field_table, Some).parse(i)? } else { (i, None) }; let (i, delivery_mode) = if flags & (1 << (15 - 3)) != 0 { - map(parse_short_short_uint, Some)(i)? + map(parse_short_short_uint, Some).parse(i)? } else { (i, None) }; let (i, priority) = if flags & (1 << (15 - 4)) != 0 { - map(parse_short_short_uint, Some)(i)? + map(parse_short_short_uint, Some).parse(i)? } else { (i, None) }; let (i, correlation_id) = if flags & (1 << (15 - 5)) != 0 { - map(parse_short_string, Some)(i)? + map(parse_short_string, Some).parse(i)? } else { (i, None) }; let (i, reply_to) = if flags & (1 << (15 - 6)) != 0 { - map(parse_short_string, Some)(i)? + map(parse_short_string, Some).parse(i)? } else { (i, None) }; let (i, expiration) = if flags & (1 << (15 - 7)) != 0 { - map(parse_short_string, Some)(i)? + map(parse_short_string, Some).parse(i)? } else { (i, None) }; let (i, message_id) = if flags & (1 << (15 - 8)) != 0 { - map(parse_short_string, Some)(i)? + map(parse_short_string, Some).parse(i)? } else { (i, None) }; let (i, timestamp) = if flags & (1 << (15 - 9)) != 0 { - map(parse_timestamp, Some)(i)? + map(parse_timestamp, Some).parse(i)? } else { (i, None) }; let (i, kind) = if flags & (1 << (15 - 10)) != 0 { - map(parse_short_string, Some)(i)? + map(parse_short_string, Some).parse(i)? } else { (i, None) }; let (i, user_id) = if flags & (1 << (15 - 11)) != 0 { - map(parse_short_string, Some)(i)? + map(parse_short_string, Some).parse(i)? } else { (i, None) }; let (i, app_id) = if flags & (1 << (15 - 12)) != 0 { - map(parse_short_string, Some)(i)? + map(parse_short_string, Some).parse(i)? } else { (i, None) }; let (i, cluster_id) = if flags & (1 << (15 - 13)) != 0 { - map(parse_short_string, Some)(i)? + map(parse_short_string, Some).parse(i)? } else { (i, None) }; @@ -1726,66 +1744,77 @@ pub mod connection { 10 => context( "parse_start", map(map(parse_start, AMQPMethod::Start), Some), - )(i), + ) + .parse(i), 11 => context( "parse_start_ok", map(map(parse_start_ok, AMQPMethod::StartOk), Some), - )(i), + ) + .parse(i), 20 => context( "parse_secure", map(map(parse_secure, AMQPMethod::Secure), Some), - )(i), + ) + .parse(i), 21 => context( "parse_secure_ok", map(map(parse_secure_ok, AMQPMethod::SecureOk), Some), - )(i), - 30 => { - context("parse_tune", map(map(parse_tune, AMQPMethod::Tune), Some))(i) - } + ) + .parse(i), + 30 => context("parse_tune", map(map(parse_tune, AMQPMethod::Tune), Some)) + .parse(i), 31 => context( "parse_tune_ok", map(map(parse_tune_ok, AMQPMethod::TuneOk), Some), - )(i), - 40 => { - context("parse_open", map(map(parse_open, AMQPMethod::Open), Some))(i) - } + ) + .parse(i), + 40 => context("parse_open", map(map(parse_open, AMQPMethod::Open), Some)) + .parse(i), 41 => context( "parse_open_ok", map(map(parse_open_ok, AMQPMethod::OpenOk), Some), - )(i), + ) + .parse(i), 50 => context( "parse_close", map(map(parse_close, AMQPMethod::Close), Some), - )(i), + ) + .parse(i), 51 => context( "parse_close_ok", map(map(parse_close_ok, AMQPMethod::CloseOk), Some), - )(i), + ) + .parse(i), 60 => context( "parse_blocked", map(map(parse_blocked, AMQPMethod::Blocked), Some), - )(i), + ) + .parse(i), 61 => context( "parse_unblocked", map(map(parse_unblocked, AMQPMethod::Unblocked), Some), - )(i), + ) + .parse(i), 70 => context( "parse_update_secret", map(map(parse_update_secret, AMQPMethod::UpdateSecret), Some), - )(i), + ) + .parse(i), 71 => context( "parse_update_secret_ok", map( map(parse_update_secret_ok, AMQPMethod::UpdateSecretOk), Some, ), - )(i), + ) + .parse(i), _ => Ok((i, None)), } }), std::convert::identity, ), - )(i) + ) + .parse(i) } /// Serialize connection (Generated) @@ -1874,11 +1903,11 @@ pub mod connection { /// Parse start (Generated) pub fn parse_start<I: ParsableInput>(i: I) -> ParserResult<I, Start> { - let (i, version_major) = parse_short_short_uint(i)?; - let (i, version_minor) = parse_short_short_uint(i)?; - let (i, server_properties) = parse_field_table(i)?; - let (i, mechanisms) = parse_long_string(i)?; - let (i, locales) = parse_long_string(i)?; + let (i, version_major) = parse_short_short_uint.parse(i)?; + let (i, version_minor) = parse_short_short_uint.parse(i)?; + let (i, server_properties) = parse_field_table.parse(i)?; + let (i, mechanisms) = parse_long_string.parse(i)?; + let (i, locales) = parse_long_string.parse(i)?; Ok(( i, Start { @@ -1932,10 +1961,10 @@ pub mod connection { /// Parse start-ok (Generated) pub fn parse_start_ok<I: ParsableInput>(i: I) -> ParserResult<I, StartOk> { - let (i, client_properties) = parse_field_table(i)?; - let (i, mechanism) = parse_short_string(i)?; - let (i, response) = parse_long_string(i)?; - let (i, locale) = parse_short_string(i)?; + let (i, client_properties) = parse_field_table.parse(i)?; + let (i, mechanism) = parse_short_string.parse(i)?; + let (i, response) = parse_long_string.parse(i)?; + let (i, locale) = parse_short_string.parse(i)?; Ok(( i, StartOk { @@ -1981,7 +2010,7 @@ pub mod connection { /// Parse secure (Generated) pub fn parse_secure<I: ParsableInput>(i: I) -> ParserResult<I, Secure> { - let (i, challenge) = parse_long_string(i)?; + let (i, challenge) = parse_long_string.parse(i)?; Ok((i, Secure { challenge })) } @@ -2016,7 +2045,7 @@ pub mod connection { /// Parse secure-ok (Generated) pub fn parse_secure_ok<I: ParsableInput>(i: I) -> ParserResult<I, SecureOk> { - let (i, response) = parse_long_string(i)?; + let (i, response) = parse_long_string.parse(i)?; Ok((i, SecureOk { response })) } @@ -2055,9 +2084,9 @@ pub mod connection { /// Parse tune (Generated) pub fn parse_tune<I: ParsableInput>(i: I) -> ParserResult<I, Tune> { - let (i, channel_max) = parse_short_uint(i)?; - let (i, frame_max) = parse_long_uint(i)?; - let (i, heartbeat) = parse_short_uint(i)?; + let (i, channel_max) = parse_short_uint.parse(i)?; + let (i, frame_max) = parse_long_uint.parse(i)?; + let (i, heartbeat) = parse_short_uint.parse(i)?; Ok(( i, Tune { @@ -2105,9 +2134,9 @@ pub mod connection { /// Parse tune-ok (Generated) pub fn parse_tune_ok<I: ParsableInput>(i: I) -> ParserResult<I, TuneOk> { - let (i, channel_max) = parse_short_uint(i)?; - let (i, frame_max) = parse_long_uint(i)?; - let (i, heartbeat) = parse_short_uint(i)?; + let (i, channel_max) = parse_short_uint.parse(i)?; + let (i, frame_max) = parse_long_uint.parse(i)?; + let (i, heartbeat) = parse_short_uint.parse(i)?; Ok(( i, TuneOk { @@ -2151,8 +2180,8 @@ pub mod connection { /// Parse open (Generated) pub fn parse_open<I: ParsableInput>(i: I) -> ParserResult<I, Open> { - let (i, virtual_host) = parse_short_string(i)?; - let (i, _) = parse_short_string(i)?; + let (i, virtual_host) = parse_short_string.parse(i)?; + let (i, _) = parse_short_string.parse(i)?; let (i, _) = parse_flags(i, &["insist"])?; Ok((i, Open { virtual_host })) } @@ -2189,7 +2218,7 @@ pub mod connection { /// Parse open-ok (Generated) pub fn parse_open_ok<I: ParsableInput>(i: I) -> ParserResult<I, OpenOk> { - let (i, _) = parse_short_string(i)?; + let (i, _) = parse_short_string.parse(i)?; Ok((i, OpenOk {})) } @@ -2230,10 +2259,10 @@ pub mod connection { /// Parse close (Generated) pub fn parse_close<I: ParsableInput>(i: I) -> ParserResult<I, Close> { - let (i, reply_code) = parse_short_uint(i)?; - let (i, reply_text) = parse_short_string(i)?; - let (i, class_id) = parse_short_uint(i)?; - let (i, method_id) = parse_short_uint(i)?; + let (i, reply_code) = parse_short_uint.parse(i)?; + let (i, reply_text) = parse_short_string.parse(i)?; + let (i, class_id) = parse_short_uint.parse(i)?; + let (i, method_id) = parse_short_uint.parse(i)?; Ok(( i, Close { @@ -2309,7 +2338,7 @@ pub mod connection { /// Parse blocked (Generated) pub fn parse_blocked<I: ParsableInput>(i: I) -> ParserResult<I, Blocked> { - let (i, reason) = parse_short_string(i)?; + let (i, reason) = parse_short_string.parse(i)?; Ok((i, Blocked { reason })) } @@ -2376,8 +2405,8 @@ pub mod connection { /// Parse update-secret (Generated) pub fn parse_update_secret<I: ParsableInput>(i: I) -> ParserResult<I, UpdateSecret> { - let (i, new_secret) = parse_long_string(i)?; - let (i, reason) = parse_short_string(i)?; + let (i, new_secret) = parse_long_string.parse(i)?; + let (i, reason) = parse_short_string.parse(i)?; Ok((i, UpdateSecret { new_secret, reason })) } @@ -2434,34 +2463,37 @@ pub mod channel { map_opt( flat_map(parse_id, |id| { move |i| match id { - 10 => { - context("parse_open", map(map(parse_open, AMQPMethod::Open), Some))(i) - } + 10 => context("parse_open", map(map(parse_open, AMQPMethod::Open), Some)) + .parse(i), 11 => context( "parse_open_ok", map(map(parse_open_ok, AMQPMethod::OpenOk), Some), - )(i), - 20 => { - context("parse_flow", map(map(parse_flow, AMQPMethod::Flow), Some))(i) - } + ) + .parse(i), + 20 => context("parse_flow", map(map(parse_flow, AMQPMethod::Flow), Some)) + .parse(i), 21 => context( "parse_flow_ok", map(map(parse_flow_ok, AMQPMethod::FlowOk), Some), - )(i), + ) + .parse(i), 40 => context( "parse_close", map(map(parse_close, AMQPMethod::Close), Some), - )(i), + ) + .parse(i), 41 => context( "parse_close_ok", map(map(parse_close_ok, AMQPMethod::CloseOk), Some), - )(i), + ) + .parse(i), _ => Ok((i, None)), } }), std::convert::identity, ), - )(i) + ) + .parse(i) } /// Serialize channel (Generated) @@ -2513,7 +2545,7 @@ pub mod channel { /// Parse open (Generated) pub fn parse_open<I: ParsableInput>(i: I) -> ParserResult<I, Open> { - let (i, _) = parse_short_string(i)?; + let (i, _) = parse_short_string.parse(i)?; Ok((i, Open {})) } @@ -2545,7 +2577,7 @@ pub mod channel { /// Parse open-ok (Generated) pub fn parse_open_ok<I: ParsableInput>(i: I) -> ParserResult<I, OpenOk> { - let (i, _) = parse_long_string(i)?; + let (i, _) = parse_long_string.parse(i)?; Ok((i, OpenOk {})) } @@ -2670,10 +2702,10 @@ pub mod channel { /// Parse close (Generated) pub fn parse_close<I: ParsableInput>(i: I) -> ParserResult<I, Close> { - let (i, reply_code) = parse_short_uint(i)?; - let (i, reply_text) = parse_short_string(i)?; - let (i, class_id) = parse_short_uint(i)?; - let (i, method_id) = parse_short_uint(i)?; + let (i, reply_code) = parse_short_uint.parse(i)?; + let (i, reply_text) = parse_short_string.parse(i)?; + let (i, class_id) = parse_short_uint.parse(i)?; + let (i, method_id) = parse_short_uint.parse(i)?; Ok(( i, Close { @@ -2743,17 +2775,20 @@ pub mod access { 10 => context( "parse_request", map(map(parse_request, AMQPMethod::Request), Some), - )(i), + ) + .parse(i), 11 => context( "parse_request_ok", map(map(parse_request_ok, AMQPMethod::RequestOk), Some), - )(i), + ) + .parse(i), _ => Ok((i, None)), } }), std::convert::identity, ), - )(i) + ) + .parse(i) } /// Serialize access (Generated) @@ -2806,7 +2841,7 @@ pub mod access { /// Parse request (Generated) pub fn parse_request<I: ParsableInput>(i: I) -> ParserResult<I, Request> { - let (i, realm) = parse_short_string(i)?; + let (i, realm) = parse_short_string.parse(i)?; let (i, flags) = parse_flags(i, &["exclusive", "passive", "active", "write", "read"])?; Ok(( i, @@ -2856,7 +2891,7 @@ pub mod access { /// Parse request-ok (Generated) pub fn parse_request_ok<I: ParsableInput>(i: I) -> ParserResult<I, RequestOk> { - let (i, _) = parse_short_uint(i)?; + let (i, _) = parse_short_uint.parse(i)?; Ok((i, RequestOk {})) } @@ -2885,40 +2920,47 @@ pub mod exchange { 10 => context( "parse_declare", map(map(parse_declare, AMQPMethod::Declare), Some), - )(i), + ) + .parse(i), 11 => context( "parse_declare_ok", map(map(parse_declare_ok, AMQPMethod::DeclareOk), Some), - )(i), + ) + .parse(i), 20 => context( "parse_delete", map(map(parse_delete, AMQPMethod::Delete), Some), - )(i), + ) + .parse(i), 21 => context( "parse_delete_ok", map(map(parse_delete_ok, AMQPMethod::DeleteOk), Some), - )(i), - 30 => { - context("parse_bind", map(map(parse_bind, AMQPMethod::Bind), Some))(i) - } + ) + .parse(i), + 30 => context("parse_bind", map(map(parse_bind, AMQPMethod::Bind), Some)) + .parse(i), 31 => context( "parse_bind_ok", map(map(parse_bind_ok, AMQPMethod::BindOk), Some), - )(i), + ) + .parse(i), 40 => context( "parse_unbind", map(map(parse_unbind, AMQPMethod::Unbind), Some), - )(i), + ) + .parse(i), 51 => context( "parse_unbind_ok", map(map(parse_unbind_ok, AMQPMethod::UnbindOk), Some), - )(i), + ) + .parse(i), _ => Ok((i, None)), } }), std::convert::identity, ), - )(i) + ) + .parse(i) } /// Serialize exchange (Generated) @@ -2993,14 +3035,14 @@ pub mod exchange { /// Parse declare (Generated) pub fn parse_declare<I: ParsableInput>(i: I) -> ParserResult<I, Declare> { - let (i, _) = parse_short_uint(i)?; - let (i, exchange) = parse_short_string(i)?; - let (i, kind) = parse_short_string(i)?; + let (i, _) = parse_short_uint.parse(i)?; + let (i, exchange) = parse_short_string.parse(i)?; + let (i, kind) = parse_short_string.parse(i)?; let (i, flags) = parse_flags( i, &["passive", "durable", "auto-delete", "internal", "nowait"], )?; - let (i, arguments) = parse_field_table(i)?; + let (i, arguments) = parse_field_table.parse(i)?; Ok(( i, Declare { @@ -3091,8 +3133,8 @@ pub mod exchange { /// Parse delete (Generated) pub fn parse_delete<I: ParsableInput>(i: I) -> ParserResult<I, Delete> { - let (i, _) = parse_short_uint(i)?; - let (i, exchange) = parse_short_string(i)?; + let (i, _) = parse_short_uint.parse(i)?; + let (i, exchange) = parse_short_string.parse(i)?; let (i, flags) = parse_flags(i, &["if-unused", "nowait"])?; Ok(( i, @@ -3178,12 +3220,12 @@ pub mod exchange { /// Parse bind (Generated) pub fn parse_bind<I: ParsableInput>(i: I) -> ParserResult<I, Bind> { - let (i, _) = parse_short_uint(i)?; - let (i, destination) = parse_short_string(i)?; - let (i, source) = parse_short_string(i)?; - let (i, routing_key) = parse_short_string(i)?; + let (i, _) = parse_short_uint.parse(i)?; + let (i, destination) = parse_short_string.parse(i)?; + let (i, source) = parse_short_string.parse(i)?; + let (i, routing_key) = parse_short_string.parse(i)?; let (i, flags) = parse_flags(i, &["nowait"])?; - let (i, arguments) = parse_field_table(i)?; + let (i, arguments) = parse_field_table.parse(i)?; Ok(( i, Bind { @@ -3272,12 +3314,12 @@ pub mod exchange { /// Parse unbind (Generated) pub fn parse_unbind<I: ParsableInput>(i: I) -> ParserResult<I, Unbind> { - let (i, _) = parse_short_uint(i)?; - let (i, destination) = parse_short_string(i)?; - let (i, source) = parse_short_string(i)?; - let (i, routing_key) = parse_short_string(i)?; + let (i, _) = parse_short_uint.parse(i)?; + let (i, destination) = parse_short_string.parse(i)?; + let (i, source) = parse_short_string.parse(i)?; + let (i, routing_key) = parse_short_string.parse(i)?; let (i, flags) = parse_flags(i, &["nowait"])?; - let (i, arguments) = parse_field_table(i)?; + let (i, arguments) = parse_field_table.parse(i)?; Ok(( i, Unbind { @@ -3352,48 +3394,57 @@ pub mod queue { 10 => context( "parse_declare", map(map(parse_declare, AMQPMethod::Declare), Some), - )(i), + ) + .parse(i), 11 => context( "parse_declare_ok", map(map(parse_declare_ok, AMQPMethod::DeclareOk), Some), - )(i), - 20 => { - context("parse_bind", map(map(parse_bind, AMQPMethod::Bind), Some))(i) - } + ) + .parse(i), + 20 => context("parse_bind", map(map(parse_bind, AMQPMethod::Bind), Some)) + .parse(i), 21 => context( "parse_bind_ok", map(map(parse_bind_ok, AMQPMethod::BindOk), Some), - )(i), + ) + .parse(i), 30 => context( "parse_purge", map(map(parse_purge, AMQPMethod::Purge), Some), - )(i), + ) + .parse(i), 31 => context( "parse_purge_ok", map(map(parse_purge_ok, AMQPMethod::PurgeOk), Some), - )(i), + ) + .parse(i), 40 => context( "parse_delete", map(map(parse_delete, AMQPMethod::Delete), Some), - )(i), + ) + .parse(i), 41 => context( "parse_delete_ok", map(map(parse_delete_ok, AMQPMethod::DeleteOk), Some), - )(i), + ) + .parse(i), 50 => context( "parse_unbind", map(map(parse_unbind, AMQPMethod::Unbind), Some), - )(i), + ) + .parse(i), 51 => context( "parse_unbind_ok", map(map(parse_unbind_ok, AMQPMethod::UnbindOk), Some), - )(i), + ) + .parse(i), _ => Ok((i, None)), } }), std::convert::identity, ), - )(i) + ) + .parse(i) } /// Serialize queue (Generated) @@ -3472,13 +3523,13 @@ pub mod queue { /// Parse declare (Generated) pub fn parse_declare<I: ParsableInput>(i: I) -> ParserResult<I, Declare> { - let (i, _) = parse_short_uint(i)?; - let (i, queue) = parse_short_string(i)?; + let (i, _) = parse_short_uint.parse(i)?; + let (i, queue) = parse_short_string.parse(i)?; let (i, flags) = parse_flags( i, &["passive", "durable", "exclusive", "auto-delete", "nowait"], )?; - let (i, arguments) = parse_field_table(i)?; + let (i, arguments) = parse_field_table.parse(i)?; Ok(( i, Declare { @@ -3537,9 +3588,9 @@ pub mod queue { /// Parse declare-ok (Generated) pub fn parse_declare_ok<I: ParsableInput>(i: I) -> ParserResult<I, DeclareOk> { - let (i, queue) = parse_short_string(i)?; - let (i, message_count) = parse_long_uint(i)?; - let (i, consumer_count) = parse_long_uint(i)?; + let (i, queue) = parse_short_string.parse(i)?; + let (i, message_count) = parse_long_uint.parse(i)?; + let (i, consumer_count) = parse_long_uint.parse(i)?; Ok(( i, DeclareOk { @@ -3591,12 +3642,12 @@ pub mod queue { /// Parse bind (Generated) pub fn parse_bind<I: ParsableInput>(i: I) -> ParserResult<I, Bind> { - let (i, _) = parse_short_uint(i)?; - let (i, queue) = parse_short_string(i)?; - let (i, exchange) = parse_short_string(i)?; - let (i, routing_key) = parse_short_string(i)?; + let (i, _) = parse_short_uint.parse(i)?; + let (i, queue) = parse_short_string.parse(i)?; + let (i, exchange) = parse_short_string.parse(i)?; + let (i, routing_key) = parse_short_string.parse(i)?; let (i, flags) = parse_flags(i, &["nowait"])?; - let (i, arguments) = parse_field_table(i)?; + let (i, arguments) = parse_field_table.parse(i)?; Ok(( i, Bind { @@ -3679,8 +3730,8 @@ pub mod queue { /// Parse purge (Generated) pub fn parse_purge<I: ParsableInput>(i: I) -> ParserResult<I, Purge> { - let (i, _) = parse_short_uint(i)?; - let (i, queue) = parse_short_string(i)?; + let (i, _) = parse_short_uint.parse(i)?; + let (i, queue) = parse_short_string.parse(i)?; let (i, flags) = parse_flags(i, &["nowait"])?; Ok(( i, @@ -3726,7 +3777,7 @@ pub mod queue { /// Parse purge-ok (Generated) pub fn parse_purge_ok<I: ParsableInput>(i: I) -> ParserResult<I, PurgeOk> { - let (i, message_count) = parse_long_uint(i)?; + let (i, message_count) = parse_long_uint.parse(i)?; Ok((i, PurgeOk { message_count })) } @@ -3767,8 +3818,8 @@ pub mod queue { /// Parse delete (Generated) pub fn parse_delete<I: ParsableInput>(i: I) -> ParserResult<I, Delete> { - let (i, _) = parse_short_uint(i)?; - let (i, queue) = parse_short_string(i)?; + let (i, _) = parse_short_uint.parse(i)?; + let (i, queue) = parse_short_string.parse(i)?; let (i, flags) = parse_flags(i, &["if-unused", "if-empty", "nowait"])?; Ok(( i, @@ -3818,7 +3869,7 @@ pub mod queue { /// Parse delete-ok (Generated) pub fn parse_delete_ok<I: ParsableInput>(i: I) -> ParserResult<I, DeleteOk> { - let (i, message_count) = parse_long_uint(i)?; + let (i, message_count) = parse_long_uint.parse(i)?; Ok((i, DeleteOk { message_count })) } @@ -3859,11 +3910,11 @@ pub mod queue { /// Parse unbind (Generated) pub fn parse_unbind<I: ParsableInput>(i: I) -> ParserResult<I, Unbind> { - let (i, _) = parse_short_uint(i)?; - let (i, queue) = parse_short_string(i)?; - let (i, exchange) = parse_short_string(i)?; - let (i, routing_key) = parse_short_string(i)?; - let (i, arguments) = parse_field_table(i)?; + let (i, _) = parse_short_uint.parse(i)?; + let (i, queue) = parse_short_string.parse(i)?; + let (i, exchange) = parse_short_string.parse(i)?; + let (i, routing_key) = parse_short_string.parse(i)?; + let (i, arguments) = parse_field_table.parse(i)?; Ok(( i, Unbind { @@ -3934,33 +3985,40 @@ pub mod tx { 10 => context( "parse_select", map(map(parse_select, AMQPMethod::Select), Some), - )(i), + ) + .parse(i), 11 => context( "parse_select_ok", map(map(parse_select_ok, AMQPMethod::SelectOk), Some), - )(i), + ) + .parse(i), 20 => context( "parse_commit", map(map(parse_commit, AMQPMethod::Commit), Some), - )(i), + ) + .parse(i), 21 => context( "parse_commit_ok", map(map(parse_commit_ok, AMQPMethod::CommitOk), Some), - )(i), + ) + .parse(i), 30 => context( "parse_rollback", map(map(parse_rollback, AMQPMethod::Rollback), Some), - )(i), + ) + .parse(i), 31 => context( "parse_rollback_ok", map(map(parse_rollback_ok, AMQPMethod::RollbackOk), Some), - )(i), + ) + .parse(i), _ => Ok((i, None)), } }), std::convert::identity, ), - )(i) + ) + .parse(i) } /// Serialize tx (Generated) @@ -4189,17 +4247,20 @@ pub mod confirm { 10 => context( "parse_select", map(map(parse_select, AMQPMethod::Select), Some), - )(i), + ) + .parse(i), 11 => context( "parse_select_ok", map(map(parse_select_ok, AMQPMethod::SelectOk), Some), - )(i), + ) + .parse(i), _ => Ok((i, None)), } }), std::convert::identity, ), - )(i) + ) + .parse(i) } /// Serialize confirm (Generated) diff --git a/protocol/src/protocol.rs b/protocol/src/protocol.rs index 14eafa37..97b486b5 100644 --- a/protocol/src/protocol.rs +++ b/protocol/src/protocol.rs @@ -7,6 +7,7 @@ use crate::types::{ use nom::{ combinator::{flat_map, map, map_opt}, error::context, + Parser, }; use serde::{Deserialize, Serialize}; use std::{convert::TryFrom, error, fmt, io::Write}; diff --git a/protocol/templates/protocol.rs b/protocol/templates/protocol.rs index 8081ad14..953153a0 100644 --- a/protocol/templates/protocol.rs +++ b/protocol/templates/protocol.rs @@ -114,10 +114,10 @@ use self::{{snake class.name}}::parse_{{snake class.name}}; pub fn parse_class<I: ParsableInput>(i: I) -> ParserResult<I, AMQPClass> { context("parse_class", map_opt(flat_map(parse_id, |id| move |i| match id { {{#each protocol.classes as |class| ~}} - {{class.id}} => map(map(parse_{{snake class.name false}}, AMQPClass::{{camel class.name}}), Some)(i), + {{class.id}} => map(map(parse_{{snake class.name false}}, AMQPClass::{{camel class.name}}), Some).parse(i), {{/each ~}} _ => Ok((i, None)), - }), std::convert::identity))(i) + }), std::convert::identity)).parse(i) } /// Serialize an AMQP class @@ -169,10 +169,10 @@ pub mod {{snake class.name}} { pub fn parse_{{snake class.name false}}<I: ParsableInput>(i: I) -> ParserResult<I, {{snake class.name}}::AMQPMethod> { context("parse_{{snake class.name false}}", map_opt(flat_map(parse_id, |id| move |i| match id { {{#each class.methods as |method| ~}} - {{method.id}} => context("parse_{{snake method.name false}}", map(map(parse_{{snake method.name false}}, AMQPMethod::{{camel method.name}}), Some))(i), + {{method.id}} => context("parse_{{snake method.name false}}", map(map(parse_{{snake method.name false}}, AMQPMethod::{{camel method.name}}), Some)).parse(i), {{/each ~}} _ => Ok((i, None)), - }), std::convert::identity))(i) + }), std::convert::identity)).parse(i) } /// Serialize {{class.name}} (Generated) @@ -237,7 +237,7 @@ pub mod {{snake class.name}} { pub fn parse_{{snake method.name false}}<I: ParsableInput>(i: I) -> ParserResult<I, {{camel method.name}}> { {{#each_argument method.arguments as |argument| ~}} {{#if @argument_is_value ~}} - let (i, {{#if argument.force_default ~}}_{{else}}{{snake argument.name}}{{/if ~}}) = parse_{{snake_type argument.type}}(i)?; + let (i, {{#if argument.force_default ~}}_{{else}}{{snake argument.name}}{{/if ~}}) = parse_{{snake_type argument.type}}.parse(i)?; {{else}} let (i, {{#if argument.ignore_flags ~}}_{{else}}flags{{/if ~}}) = parse_flags(i, &[ {{#each argument.flags as |flag| ~}} @@ -329,7 +329,7 @@ pub mod {{snake class.name}} { pub fn parse_properties<I: ParsableInput>(i: I) -> ParserResult<I, AMQPProperties> { let (i, flags) = parse_short_uint(i)?; {{#each class.properties as |property| ~}} - let (i, {{snake property.name}}) = if flags & (1 << (15 - {{@index}})) != 0 { map(parse_{{snake_type property.type}}, Some)(i)? } else { (i, None) }; + let (i, {{snake property.name}}) = if flags & (1 << (15 - {{@index}})) != 0 { map(parse_{{snake_type property.type}}, Some).parse(i)? } else { (i, None) }; {{/each ~}} Ok((i, AMQPProperties { {{#each class.properties as |property| ~}} diff --git a/types/Cargo.toml b/types/Cargo.toml index 1d28bb86..872605ee 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -26,7 +26,7 @@ default-features = false features = ["std"] [dependencies.nom] -version = "^7.0" +version = "=8.0.0-alpha2" features = ["std"] [dependencies.serde] diff --git a/types/src/flags.rs b/types/src/flags.rs index d2c8e6d4..963cc231 100644 --- a/types/src/flags.rs +++ b/types/src/flags.rs @@ -33,7 +33,7 @@ impl AMQPFlags { } /// Initialize AMQPFlags from AMQP RPC serialization - pub fn from_bytes<I: nom::InputIter<Item = u8>>(names: &[&str], bytes: I) -> AMQPFlags { + pub fn from_bytes<I: nom::Input<Item = u8>>(names: &[&str], bytes: I) -> AMQPFlags { let flags = names .iter() .map(ToString::to_string) diff --git a/types/src/parsing.rs b/types/src/parsing.rs index 77ea153d..2e9ccbbc 100644 --- a/types/src/parsing.rs +++ b/types/src/parsing.rs @@ -9,6 +9,7 @@ use nom::{ be_f32, be_f64, be_i16, be_i32, be_i64, be_u16, be_u32, be_u64, i8 as be_i8, u8 as be_u8, }, sequence::pair, + Parser, }; use std::{error, fmt}; use traits::*; @@ -92,34 +93,34 @@ pub type ParserResult<I, T> = Result<(I, T), ParserError>; /// Parse the [AMQPValue](../type.AMQPValue.html) of the given [AMQPType](../type.AMQPType.html) pub fn parse_raw_value<I: ParsableInput>( amqp_type: AMQPType, -) -> impl FnMut(I) -> ParserResult<I, AMQPValue> { +) -> impl Parser<I, Output = AMQPValue, Error = ParserErrors> { context("parse_raw_value", move |i| match amqp_type { - AMQPType::Boolean => map(parse_boolean, AMQPValue::Boolean)(i), - AMQPType::ShortShortInt => map(parse_short_short_int, AMQPValue::ShortShortInt)(i), - AMQPType::ShortShortUInt => map(parse_short_short_uint, AMQPValue::ShortShortUInt)(i), - AMQPType::ShortInt => map(parse_short_int, AMQPValue::ShortInt)(i), - AMQPType::ShortUInt => map(parse_short_uint, AMQPValue::ShortUInt)(i), - AMQPType::LongInt => map(parse_long_int, AMQPValue::LongInt)(i), - AMQPType::LongUInt => map(parse_long_uint, AMQPValue::LongUInt)(i), - AMQPType::LongLongInt => map(parse_long_long_int, AMQPValue::LongLongInt)(i), + AMQPType::Boolean => map(parse_boolean, AMQPValue::Boolean).parse(i), + AMQPType::ShortShortInt => map(parse_short_short_int, AMQPValue::ShortShortInt).parse(i), + AMQPType::ShortShortUInt => map(parse_short_short_uint, AMQPValue::ShortShortUInt).parse(i), + AMQPType::ShortInt => map(parse_short_int, AMQPValue::ShortInt).parse(i), + AMQPType::ShortUInt => map(parse_short_uint, AMQPValue::ShortUInt).parse(i), + AMQPType::LongInt => map(parse_long_int, AMQPValue::LongInt).parse(i), + AMQPType::LongUInt => map(parse_long_uint, AMQPValue::LongUInt).parse(i), + AMQPType::LongLongInt => map(parse_long_long_int, AMQPValue::LongLongInt).parse(i), /* RabbitMQ treats LongLongUInt as a LongLongInt hence expose it as such */ - AMQPType::LongLongUInt => map(parse_long_long_int, AMQPValue::LongLongInt)(i), - AMQPType::Float => map(parse_float, AMQPValue::Float)(i), - AMQPType::Double => map(parse_double, AMQPValue::Double)(i), - AMQPType::DecimalValue => map(parse_decimal_value, AMQPValue::DecimalValue)(i), - AMQPType::ShortString => map(parse_short_string, AMQPValue::ShortString)(i), - AMQPType::LongString => map(parse_long_string, AMQPValue::LongString)(i), - AMQPType::FieldArray => map(parse_field_array, AMQPValue::FieldArray)(i), - AMQPType::Timestamp => map(parse_timestamp, AMQPValue::Timestamp)(i), - AMQPType::FieldTable => map(parse_field_table, AMQPValue::FieldTable)(i), - AMQPType::ByteArray => map(parse_byte_array, AMQPValue::ByteArray)(i), + AMQPType::LongLongUInt => map(parse_long_long_int, AMQPValue::LongLongInt).parse(i), + AMQPType::Float => map(parse_float, AMQPValue::Float).parse(i), + AMQPType::Double => map(parse_double, AMQPValue::Double).parse(i), + AMQPType::DecimalValue => map(parse_decimal_value, AMQPValue::DecimalValue).parse(i), + AMQPType::ShortString => map(parse_short_string, AMQPValue::ShortString).parse(i), + AMQPType::LongString => map(parse_long_string, AMQPValue::LongString).parse(i), + AMQPType::FieldArray => map(parse_field_array, AMQPValue::FieldArray).parse(i), + AMQPType::Timestamp => map(parse_timestamp, AMQPValue::Timestamp).parse(i), + AMQPType::FieldTable => map(parse_field_table, AMQPValue::FieldTable).parse(i), + AMQPType::ByteArray => map(parse_byte_array, AMQPValue::ByteArray).parse(i), AMQPType::Void => Ok((i, AMQPValue::Void)), }) } /// Parse an [AMQPValue](../type.AMQPValue.html) pub fn parse_value<I: ParsableInput>(i: I) -> ParserResult<I, AMQPValue> { - context("parse_value", flat_map(parse_type, parse_raw_value))(i) + context("parse_value", flat_map(parse_type, parse_raw_value)).parse(i) } /// Parse an [AMQPType](../type.AMQPType.html) @@ -127,67 +128,68 @@ pub fn parse_type<I: ParsableInput>(i: I) -> ParserResult<I, AMQPType> { context( "parse_type", map_opt(be_u8, |t| AMQPType::from_id(t as char)), - )(i) + ) + .parse(i) } /// Parse an id [(ShortUInt)](../type.ShortUInt.html) pub fn parse_id<I: ParsableInput>(i: I) -> ParserResult<I, ShortUInt> { - context("parse_id", parse_short_uint)(i) + context("parse_id", parse_short_uint).parse(i) } /// Parse a [Boolean](../type.Boolean.html) pub fn parse_boolean<I: ParsableInput>(i: I) -> ParserResult<I, Boolean> { - context("parse_boolean", map(be_u8, |b| b != 0))(i) + context("parse_boolean", map(be_u8, |b| b != 0)).parse(i) } /// Parse a [ShortShortInt](../type.ShortShortInt.html) pub fn parse_short_short_int<I: ParsableInput>(i: I) -> ParserResult<I, ShortShortInt> { - context("parse_short_short_int", be_i8)(i) + context("parse_short_short_int", be_i8).parse(i) } /// Parse a [ShortShortUInt](../type.ShortShortUInt.html) pub fn parse_short_short_uint<I: ParsableInput>(i: I) -> ParserResult<I, ShortShortUInt> { - context("parse_short_short_uint", be_u8)(i) + context("parse_short_short_uint", be_u8).parse(i) } /// Parse a [ShortInt](../type.ShortInt.html) pub fn parse_short_int<I: ParsableInput>(i: I) -> ParserResult<I, ShortInt> { - context("parse_short_int", be_i16)(i) + context("parse_short_int", be_i16).parse(i) } /// Parse a [ShortUInt](../type.ShortUInt.html) pub fn parse_short_uint<I: ParsableInput>(i: I) -> ParserResult<I, ShortUInt> { - context("parse_short_uint", be_u16)(i) + context("parse_short_uint", be_u16).parse(i) } /// Parse a [LongInt](../type.LongInt.html) pub fn parse_long_int<I: ParsableInput>(i: I) -> ParserResult<I, LongInt> { - context("parse_long_int", be_i32)(i) + context("parse_long_int", be_i32).parse(i) } /// Parse a [LongUInt](../type.LongUInt.html) pub fn parse_long_uint<I: ParsableInput>(i: I) -> ParserResult<I, LongUInt> { - context("parse_long_uint", be_u32)(i) + context("parse_long_uint", be_u32).parse(i) } /// Parse a [LongLongInt](../type.LongLongInt.html) pub fn parse_long_long_int<I: ParsableInput>(i: I) -> ParserResult<I, LongLongInt> { - context("parse_long_long_int", be_i64)(i) + context("parse_long_long_int", be_i64).parse(i) } /// Parse a [LongLongUInt](../type.LongLongUInt.html) pub fn parse_long_long_uint<I: ParsableInput>(i: I) -> ParserResult<I, LongLongUInt> { - context("parse_long_long_uint", be_u64)(i) + context("parse_long_long_uint", be_u64).parse(i) } /// Parse a [Float](../type.Float.html) pub fn parse_float<I: ParsableInput>(i: I) -> ParserResult<I, Float> { - context("parse_float", be_f32)(i) + context("parse_float", be_f32).parse(i) } /// Parse a [Double](../type.Double.html) pub fn parse_double<I: ParsableInput>(i: I) -> ParserResult<I, Double> { - context("parse_double", be_f64)(i) + context("parse_double", be_f64).parse(i) } /// Parse a [DecimalValue](../type.DecimalValue.html) @@ -198,10 +200,11 @@ pub fn parse_decimal_value<I: ParsableInput>(i: I) -> ParserResult<I, DecimalVal pair(parse_short_short_uint, parse_long_uint), |(scale, value)| DecimalValue { scale, value }, ), - )(i) + ) + .parse(i) } -fn make_str<I: nom::InputIter<Item = u8>>(i: I) -> Result<String, std::string::FromUtf8Error> { +fn make_str<I: Input<Item = u8>>(i: I) -> Result<String, std::string::FromUtf8Error> { String::from_utf8(i.iter_elements().collect()) } @@ -213,7 +216,8 @@ pub fn parse_short_string<I: ParsableInput>(i: I) -> ParserResult<I, ShortString map_res(flat_map(parse_short_short_uint, take), make_str), ShortString::from, ), - )(i) + ) + .parse(i) } /// Parse a [LongString](../type.LongString.html) @@ -223,7 +227,8 @@ pub fn parse_long_string<I: ParsableInput>(i: I) -> ParserResult<I, LongString> map(flat_map(parse_long_uint, take), |i: I| { i.iter_elements().collect::<Vec<u8>>().into() }), - )(i) + ) + .parse(i) } /// Parse a [FieldArray](../type.FieldArray.html) @@ -241,12 +246,13 @@ pub fn parse_field_array<I: ParsableInput>(i: I) -> ParserResult<I, FieldArray> }, )), ), - )(i) + ) + .parse(i) } /// Parse a [Timestamp](../type.Timestamp.html) pub fn parse_timestamp<I: ParsableInput>(i: I) -> ParserResult<I, Timestamp> { - context("parse_timestamp", parse_long_long_uint)(i) + context("parse_timestamp", parse_long_long_uint).parse(i) } /// Parse a [FieldTable](../type.FieldTable.html) @@ -267,7 +273,8 @@ pub fn parse_field_table<I: ParsableInput>(i: I) -> ParserResult<I, FieldTable> }, )), ), - )(i) + ) + .parse(i) } /// Parse a [ByteArray](../type.ByteArray.html) @@ -277,7 +284,8 @@ pub fn parse_byte_array<I: ParsableInput>(i: I) -> ParserResult<I, ByteArray> { map(flat_map(parse_long_uint, take), |i: I| { i.iter_elements().collect::<Vec<u8>>().into() }), - )(i) + ) + .parse(i) } /// Parse the [AMQPFlags](../type.AMQPFlags.html) for which the names are provided @@ -287,37 +295,19 @@ pub fn parse_flags<I: ParsableInput>(i: I, names: &[&str]) -> ParserResult<I, AM map(take((names.len() + 7) / 8), |b| { AMQPFlags::from_bytes(names, b) }), - )(i) + ) + .parse(i) } /// Traits required for parsing pub mod traits { /// Reexport nom traits required for parsing - pub use nom::{Compare, InputIter, InputLength, InputTake, Needed, Slice, UnspecializedInput}; + pub use nom::{Compare, Input, Needed}; /// Trait used to ensure we can properly parse input - pub trait ParsableInput: - Clone - + Compare<&'static [u8]> - + InputIter<Item = u8> - + InputLength - + InputTake - + Slice<std::ops::RangeFrom<usize>> - + PartialEq - { - } + pub trait ParsableInput: Clone + Compare<&'static [u8]> + Input<Item = u8> + PartialEq {} - impl< - T: Clone - + Compare<&'static [u8]> - + InputIter<Item = u8> - + InputLength - + InputTake - + PartialEq - + Slice<std::ops::RangeFrom<usize>>, - > ParsableInput for T - { - } + impl<T: Clone + Compare<&'static [u8]> + Input<Item = u8> + PartialEq> ParsableInput for T {} } #[cfg(test)] @@ -341,20 +331,20 @@ mod test { #[test] fn test_parse_raw_value() { assert_eq!( - parse_raw_value(AMQPType::Timestamp)(&[42, 42, 42, 42, 42, 42, 42, 42][..]), + parse_raw_value(AMQPType::Timestamp).parse(&[42, 42, 42, 42, 42, 42, 42, 42][..]), Ok((EMPTY, AMQPValue::Timestamp(3038287259199220266))) ); assert_eq!( - parse_raw_value(AMQPType::LongString)(&[0, 0, 0, 4, 116, 101, 115, 116][..]), + parse_raw_value(AMQPType::LongString).parse(&[0, 0, 0, 4, 116, 101, 115, 116][..]), Ok((EMPTY, AMQPValue::LongString("test".into()))) ); /* Test internal exceptions */ assert_eq!( - parse_raw_value(AMQPType::LongLongUInt)(&[42, 42, 42, 42, 42, 42, 42, 42][..]), + parse_raw_value(AMQPType::LongLongUInt).parse(&[42, 42, 42, 42, 42, 42, 42, 42][..]), Ok((EMPTY, AMQPValue::LongLongInt(3038287259199220266))) ); assert_eq!( - parse_raw_value(AMQPType::ShortString)(&[4, 116, 101, 115, 116][..]), + parse_raw_value(AMQPType::ShortString).parse(&[4, 116, 101, 115, 116][..]), Ok((EMPTY, AMQPValue::ShortString("test".into()))) ); } From 7106d8a3312cf0f6bb7edb28cc2b182f354af5dc Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Sat, 22 Jun 2024 21:50:14 +0200 Subject: [PATCH 106/133] v8.0.0-alpha.1 --- codegen/Cargo.toml | 4 ++-- protocol/Cargo.toml | 10 +++++----- tcp/Cargo.toml | 4 ++-- types/Cargo.toml | 2 +- uri/Cargo.toml | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index a1dacbf7..57c91660 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "7.2.0" +version = "8.0.0-alpha.1" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" @@ -19,7 +19,7 @@ handlebars = "^5.0" serde_json = "^1.0" [dependencies.amq-protocol-types] -version = "=7.2.0" +version = "=8.0.0-alpha.1" path = "../types" [dependencies.serde] diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index ed1826d0..e039f16a 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "7.2.0" +version = "8.0.0-alpha.1" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" @@ -33,21 +33,21 @@ rustls--aws_lc_rs = ["amq-protocol-tcp/rustls--aws_lc_rs"] # default, bu rustls--ring = ["amq-protocol-tcp/rustls--ring"] # more compatible, (e.g., easily builds on Windows) [build-dependencies.amq-protocol-codegen] -version = "=7.2.0" +version = "=8.0.0-alpha.1" path = "../codegen" optional = true [dependencies.amq-protocol-tcp] -version = "=7.2.0" +version = "=8.0.0-alpha.1" default-features = false path = "../tcp" [dependencies.amq-protocol-types] -version = "=7.2.0" +version = "=8.0.0-alpha.1" path = "../types" [dependencies.amq-protocol-uri] -version = "=7.2.0" +version = "=8.0.0-alpha.1" path = "../uri" [dependencies.cookie-factory] diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index 22c34005..bbf71252 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "7.2.0" +version = "8.0.0-alpha.1" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" @@ -30,7 +30,7 @@ rustls--aws_lc_rs = ["tcp-stream/rustls--aws_lc_rs"] # default, but does rustls--ring = ["tcp-stream/rustls--ring"] # more compatible, (e.g., easily builds on Windows) [dependencies.amq-protocol-uri] -version = "=7.2.0" +version = "=8.0.0-alpha.1" path = "../uri" [dependencies.tcp-stream] diff --git a/types/Cargo.toml b/types/Cargo.toml index 872605ee..a210db2c 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "7.2.0" +version = "8.0.0-alpha.1" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/uri/Cargo.toml b/uri/Cargo.toml index 233e0eed..1b07c580 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "7.2.0" +version = "8.0.0-alpha.1" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" @@ -15,7 +15,7 @@ rust-version = "1.63.0" name = "amq_protocol_uri" [dependencies.amq-protocol-types] -version = "=7.2.0" +version = "=8.0.0-alpha.1" path = "../types" [dependencies] From cbceae8f914a8a401e7077be3c17cb11ed0830b0 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Sat, 22 Jun 2024 22:41:42 +0200 Subject: [PATCH 107/133] parsing: reexport nom::CompareResult --- types/src/parsing.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/src/parsing.rs b/types/src/parsing.rs index 2e9ccbbc..fcd4b983 100644 --- a/types/src/parsing.rs +++ b/types/src/parsing.rs @@ -302,7 +302,7 @@ pub fn parse_flags<I: ParsableInput>(i: I, names: &[&str]) -> ParserResult<I, AM /// Traits required for parsing pub mod traits { /// Reexport nom traits required for parsing - pub use nom::{Compare, Input, Needed}; + pub use nom::{Compare, CompareResult, Input, Needed}; /// Trait used to ensure we can properly parse input pub trait ParsableInput: Clone + Compare<&'static [u8]> + Input<Item = u8> + PartialEq {} From a61a540847919f332680dc38bb1372855a32af55 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Sat, 22 Jun 2024 22:48:39 +0200 Subject: [PATCH 108/133] tcp: require tcp-stream with io safety support --- tcp/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index bbf71252..0c042f51 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -34,7 +34,7 @@ version = "=8.0.0-alpha.1" path = "../uri" [dependencies.tcp-stream] -version = "^0.29" +version = "^0.29.1" default-features = false [dependencies.tracing] From 863b8ff661763e664bc69b566a53f4ca099a0c4a Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Sat, 22 Jun 2024 22:49:17 +0200 Subject: [PATCH 109/133] v8.0.0-alpha.2 --- codegen/Cargo.toml | 4 ++-- protocol/Cargo.toml | 10 +++++----- tcp/Cargo.toml | 4 ++-- types/Cargo.toml | 2 +- uri/Cargo.toml | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 57c91660..bf2a1be8 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "8.0.0-alpha.1" +version = "8.0.0-alpha.2" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" @@ -19,7 +19,7 @@ handlebars = "^5.0" serde_json = "^1.0" [dependencies.amq-protocol-types] -version = "=8.0.0-alpha.1" +version = "=8.0.0-alpha.2" path = "../types" [dependencies.serde] diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index e039f16a..b18b7ebf 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "8.0.0-alpha.1" +version = "8.0.0-alpha.2" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" @@ -33,21 +33,21 @@ rustls--aws_lc_rs = ["amq-protocol-tcp/rustls--aws_lc_rs"] # default, bu rustls--ring = ["amq-protocol-tcp/rustls--ring"] # more compatible, (e.g., easily builds on Windows) [build-dependencies.amq-protocol-codegen] -version = "=8.0.0-alpha.1" +version = "=8.0.0-alpha.2" path = "../codegen" optional = true [dependencies.amq-protocol-tcp] -version = "=8.0.0-alpha.1" +version = "=8.0.0-alpha.2" default-features = false path = "../tcp" [dependencies.amq-protocol-types] -version = "=8.0.0-alpha.1" +version = "=8.0.0-alpha.2" path = "../types" [dependencies.amq-protocol-uri] -version = "=8.0.0-alpha.1" +version = "=8.0.0-alpha.2" path = "../uri" [dependencies.cookie-factory] diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index 0c042f51..52f91dd4 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "8.0.0-alpha.1" +version = "8.0.0-alpha.2" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" @@ -30,7 +30,7 @@ rustls--aws_lc_rs = ["tcp-stream/rustls--aws_lc_rs"] # default, but does rustls--ring = ["tcp-stream/rustls--ring"] # more compatible, (e.g., easily builds on Windows) [dependencies.amq-protocol-uri] -version = "=8.0.0-alpha.1" +version = "=8.0.0-alpha.2" path = "../uri" [dependencies.tcp-stream] diff --git a/types/Cargo.toml b/types/Cargo.toml index a210db2c..85eb795b 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "8.0.0-alpha.1" +version = "8.0.0-alpha.2" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/uri/Cargo.toml b/uri/Cargo.toml index 1b07c580..d628e700 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "8.0.0-alpha.1" +version = "8.0.0-alpha.2" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" @@ -15,7 +15,7 @@ rust-version = "1.63.0" name = "amq_protocol_uri" [dependencies.amq-protocol-types] -version = "=8.0.0-alpha.1" +version = "=8.0.0-alpha.2" path = "../types" [dependencies] From 46f6ef798c9e5eb783796e93e1436bfc194bd55e Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Wed, 10 Jul 2024 22:41:04 +0200 Subject: [PATCH 110/133] rename BasicProperties::with_kind to with_type --- codegen/src/util.rs | 1 + protocol/src/generated.rs | 28 ++++++++++++++-------------- protocol/src/protocol.rs | 8 ++++++++ protocol/templates/protocol.rs | 2 +- 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/codegen/src/util.rs b/codegen/src/util.rs index b4baa5dd..adccc5f7 100644 --- a/codegen/src/util.rs +++ b/codegen/src/util.rs @@ -24,6 +24,7 @@ pub fn camel_case(name: &str) -> String { pub fn snake_case(name: &str, raw: bool) -> String { match name { "return" if raw => "r#return".to_string(), + "type" if !raw => "type".to_string(), "type" => "kind".to_string(), name => { let mut new_word = false; diff --git a/protocol/src/generated.rs b/protocol/src/generated.rs index 35fbd809..b3c1fbc3 100644 --- a/protocol/src/generated.rs +++ b/protocol/src/generated.rs @@ -1378,72 +1378,72 @@ pub mod basic { impl AMQPProperties { /// Set content-type (Generated) - pub fn with_content_type(mut self, value: ShortString) -> AMQPProperties { + pub fn with_content_type(mut self, value: ShortString) -> Self { self.content_type = Some(value); self } /// Set content-encoding (Generated) - pub fn with_content_encoding(mut self, value: ShortString) -> AMQPProperties { + pub fn with_content_encoding(mut self, value: ShortString) -> Self { self.content_encoding = Some(value); self } /// Set headers (Generated) - pub fn with_headers(mut self, value: FieldTable) -> AMQPProperties { + pub fn with_headers(mut self, value: FieldTable) -> Self { self.headers = Some(value); self } /// Set delivery-mode (Generated) - pub fn with_delivery_mode(mut self, value: ShortShortUInt) -> AMQPProperties { + pub fn with_delivery_mode(mut self, value: ShortShortUInt) -> Self { self.delivery_mode = Some(value); self } /// Set priority (Generated) - pub fn with_priority(mut self, value: ShortShortUInt) -> AMQPProperties { + pub fn with_priority(mut self, value: ShortShortUInt) -> Self { self.priority = Some(value); self } /// Set correlation-id (Generated) - pub fn with_correlation_id(mut self, value: ShortString) -> AMQPProperties { + pub fn with_correlation_id(mut self, value: ShortString) -> Self { self.correlation_id = Some(value); self } /// Set reply-to (Generated) - pub fn with_reply_to(mut self, value: ShortString) -> AMQPProperties { + pub fn with_reply_to(mut self, value: ShortString) -> Self { self.reply_to = Some(value); self } /// Set expiration (Generated) - pub fn with_expiration(mut self, value: ShortString) -> AMQPProperties { + pub fn with_expiration(mut self, value: ShortString) -> Self { self.expiration = Some(value); self } /// Set message-id (Generated) - pub fn with_message_id(mut self, value: ShortString) -> AMQPProperties { + pub fn with_message_id(mut self, value: ShortString) -> Self { self.message_id = Some(value); self } /// Set timestamp (Generated) - pub fn with_timestamp(mut self, value: Timestamp) -> AMQPProperties { + pub fn with_timestamp(mut self, value: Timestamp) -> Self { self.timestamp = Some(value); self } /// Set type (Generated) - pub fn with_kind(mut self, value: ShortString) -> AMQPProperties { + pub fn with_type(mut self, value: ShortString) -> Self { self.kind = Some(value); self } /// Set user-id (Generated) - pub fn with_user_id(mut self, value: ShortString) -> AMQPProperties { + pub fn with_user_id(mut self, value: ShortString) -> Self { self.user_id = Some(value); self } /// Set app-id (Generated) - pub fn with_app_id(mut self, value: ShortString) -> AMQPProperties { + pub fn with_app_id(mut self, value: ShortString) -> Self { self.app_id = Some(value); self } /// Set cluster-id (Generated) - pub fn with_cluster_id(mut self, value: ShortString) -> AMQPProperties { + pub fn with_cluster_id(mut self, value: ShortString) -> Self { self.cluster_id = Some(value); self } diff --git a/protocol/src/protocol.rs b/protocol/src/protocol.rs index 14eafa37..b5a6f50d 100644 --- a/protocol/src/protocol.rs +++ b/protocol/src/protocol.rs @@ -126,6 +126,14 @@ impl From<AMQPHardError> for AMQPErrorKind { } } +impl basic::AMQPProperties { + #[deprecated(note = "use with_type instead")] + /// deprecated: use with_type instead + pub fn with_kind(self, value: ShortString) -> Self { + self.with_type(value) + } +} + #[cfg(test)] mod test { use super::*; diff --git a/protocol/templates/protocol.rs b/protocol/templates/protocol.rs index 8081ad14..254cd451 100644 --- a/protocol/templates/protocol.rs +++ b/protocol/templates/protocol.rs @@ -302,7 +302,7 @@ pub mod {{snake class.name}} { impl AMQPProperties { {{#each class.properties as |property| ~}} /// Set {{property.name}} (Generated) - pub fn with_{{snake property.name false}}(mut self, value: {{property.type}}) -> AMQPProperties { + pub fn with_{{snake property.name false}}(mut self, value: {{property.type}}) -> Self { self.{{snake property.name}} = Some(value); self } From b07ecbcb02c8e915c2f436f1514553fb3b7dd48e Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Wed, 10 Jul 2024 22:42:39 +0200 Subject: [PATCH 111/133] drop deprecated BasicProperties::with_kind --- protocol/src/protocol.rs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/protocol/src/protocol.rs b/protocol/src/protocol.rs index 20c58fbd..97b486b5 100644 --- a/protocol/src/protocol.rs +++ b/protocol/src/protocol.rs @@ -127,14 +127,6 @@ impl From<AMQPHardError> for AMQPErrorKind { } } -impl basic::AMQPProperties { - #[deprecated(note = "use with_type instead")] - /// deprecated: use with_type instead - pub fn with_kind(self, value: ShortString) -> Self { - self.with_type(value) - } -} - #[cfg(test)] mod test { use super::*; From 0364d9c2c59c22f67de5df3e2248f8bff3330875 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Thu, 11 Jul 2024 17:14:45 +0200 Subject: [PATCH 112/133] v7.2.1 --- codegen/Cargo.toml | 4 ++-- protocol/Cargo.toml | 10 +++++----- tcp/Cargo.toml | 4 ++-- types/Cargo.toml | 2 +- uri/Cargo.toml | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index a1dacbf7..8fedb8ef 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "7.2.0" +version = "7.2.1" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" @@ -19,7 +19,7 @@ handlebars = "^5.0" serde_json = "^1.0" [dependencies.amq-protocol-types] -version = "=7.2.0" +version = "=7.2.1" path = "../types" [dependencies.serde] diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index a413919a..432118f1 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "7.2.0" +version = "7.2.1" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" @@ -28,21 +28,21 @@ vendored-openssl = ["amq-protocol-tcp/vendored-openssl"] verbose-errors = ["amq-protocol-types/verbose-errors"] [build-dependencies.amq-protocol-codegen] -version = "=7.2.0" +version = "=7.2.1" path = "../codegen" optional = true [dependencies.amq-protocol-tcp] -version = "=7.2.0" +version = "=7.2.1" default-features = false path = "../tcp" [dependencies.amq-protocol-types] -version = "=7.2.0" +version = "=7.2.1" path = "../types" [dependencies.amq-protocol-uri] -version = "=7.2.0" +version = "=7.2.1" path = "../uri" [dependencies.cookie-factory] diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index b60f35b3..19178049 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "7.2.0" +version = "7.2.1" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" @@ -25,7 +25,7 @@ rustls-connector = ["tcp-stream/rustls-connector"] vendored-openssl = ["tcp-stream/vendored-openssl"] [dependencies.amq-protocol-uri] -version = "=7.2.0" +version = "=7.2.1" path = "../uri" [dependencies.tcp-stream] diff --git a/types/Cargo.toml b/types/Cargo.toml index 1d28bb86..d70cf440 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "7.2.0" +version = "7.2.1" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/uri/Cargo.toml b/uri/Cargo.toml index 233e0eed..8740f72c 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "7.2.0" +version = "7.2.1" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" @@ -15,7 +15,7 @@ rust-version = "1.63.0" name = "amq_protocol_uri" [dependencies.amq-protocol-types] -version = "=7.2.0" +version = "=7.2.1" path = "../types" [dependencies] From 1bae04e6b38b30523a2d5ac26112b778bad0dede Mon Sep 17 00:00:00 2001 From: Peter Holloway <peter.holloway@diamond.ac.uk> Date: Thu, 18 Jul 2024 13:50:38 +0100 Subject: [PATCH 113/133] Add implementation for converting ShortString to String When integrating with other libraries it can be useful to get away from protocol specific types especially for common types such as `String`. Add an implementation for `From<ShortString> for String` to unwrap a `ShortString` and get the original String back. --- types/src/types.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/types/src/types.rs b/types/src/types.rs index 6924a782..65a068bc 100644 --- a/types/src/types.rs +++ b/types/src/types.rs @@ -202,6 +202,12 @@ impl fmt::Display for ShortString { } } +impl From<ShortString> for String { + fn from(value: ShortString) -> Self { + value.0 + } +} + impl<'a> LongString { /// Get a reference to a LongString as &[u8] pub fn as_bytes(&'a self) -> &'a [u8] { From 58eed8f24b7ee8a1ee8db60d55124a8a56e9cd6b Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Sat, 27 Jul 2024 22:32:27 +0200 Subject: [PATCH 114/133] codegen: update to handlebars 6.0 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index bf2a1be8..916a374c 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -15,7 +15,7 @@ rust-version = "1.63.0" name = "amq_protocol_codegen" [dependencies] -handlebars = "^5.0" +handlebars = "^6.0" serde_json = "^1.0" [dependencies.amq-protocol-types] From 143a1b46a4bd20e46b290cd6f5409fb753455eec Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Mon, 19 Aug 2024 22:03:13 +0200 Subject: [PATCH 115/133] prepare for edition 2024 --- protocol/Cargo.toml | 2 +- tcp/Cargo.toml | 6 +++--- tcp/src/lib.rs | 2 +- types/src/generation.rs | 4 ++-- types/tests/integration.rs | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index b18b7ebf..46e9ceb6 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -18,7 +18,7 @@ name = "amq_protocol" [features] default = ["rustls"] codegen = ["codegen-internal"] -codegen-internal = ["amq-protocol-codegen"] +codegen-internal = ["dep:amq-protocol-codegen"] native-tls = ["amq-protocol-tcp/native-tls"] openssl = ["amq-protocol-tcp/openssl"] rustls = ["amq-protocol-tcp/rustls"] diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index 52f91dd4..acb3455c 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -19,9 +19,9 @@ default = ["rustls"] native-tls = ["tcp-stream/native-tls"] openssl = ["tcp-stream/openssl"] rustls = ["rustls-native-certs", "rustls--aws_lc_rs"] -rustls-native-certs = ["rustls-connector", "tcp-stream/rustls-native-certs"] -rustls-webpki-roots-certs = ["rustls-connector", "tcp-stream/rustls-webpki-roots-certs"] -rustls-connector = ["tcp-stream/rustls-connector"] +rustls-native-certs = ["rustls-common", "tcp-stream/rustls-native-certs"] +rustls-webpki-roots-certs = ["rustls-common", "tcp-stream/rustls-webpki-roots-certs"] +rustls-common = ["tcp-stream/rustls-common"] vendored-openssl = ["tcp-stream/vendored-openssl"] # rustls crypto providers. Choose at least one. Otherwise, runtime errors. diff --git a/tcp/src/lib.rs b/tcp/src/lib.rs index b8178813..815a0ca2 100644 --- a/tcp/src/lib.rs +++ b/tcp/src/lib.rs @@ -21,7 +21,7 @@ pub use tcp_stream::NativeTlsConnector; #[cfg(feature = "openssl")] pub use tcp_stream::OpenSslConnector; -#[cfg(feature = "rustls-connector")] +#[cfg(feature = "rustls-common")] pub use tcp_stream::{RustlsConnector, RustlsConnectorConfig}; /// Trait providing a method to connect to a TcpStream diff --git a/types/src/generation.rs b/types/src/generation.rs index 9c20ae42..dc6a85e4 100644 --- a/types/src/generation.rs +++ b/types/src/generation.rs @@ -183,12 +183,12 @@ pub fn gen_flags<'a, W: Write + 'a>(f: &'a AMQPFlags) -> impl SerializeFn<W> + ' mod test { use super::*; - use cookie_factory::gen; + use cookie_factory::r#gen as cf_gen; macro_rules! test_gen ( ($buf: expr, $gen: ident, $val: expr) => ({ let buf = $buf; - let len = gen($gen($val), &mut buf[..]).map(|t| t.1); + let len = cf_gen($gen($val), &mut buf[..]).map(|t| t.1); match len { Err(e) => Err(format!("{:?}", e)), Ok(len) => Ok((buf.to_vec(), len)), diff --git a/types/tests/integration.rs b/types/tests/integration.rs index a1f2f908..92771075 100644 --- a/types/tests/integration.rs +++ b/types/tests/integration.rs @@ -1,6 +1,6 @@ use amq_protocol_types::{generation::gen_value, parsing::parse_value, *}; -use cookie_factory::gen; +use cookie_factory::r#gen as cf_gen; #[test] fn test_full_integration() { @@ -43,7 +43,7 @@ fn test_full_integration() { let value = AMQPValue::FieldTable(table); let mut buf: [u8; 199] = [0; 199]; - gen(gen_value(&value), &mut buf[..]).unwrap(); + cf_gen(gen_value(&value), &mut buf[..]).unwrap(); assert_eq!(parse_value(&buf[..]), Ok((&[][..], value))); } From 947d783402e1dd9bcea21b99c93a23ddf6ea74ad Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Sat, 31 Aug 2024 14:50:09 +0200 Subject: [PATCH 116/133] update MSRV for rustls-connector Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- .github/workflows/build-and-test.yaml | 4 ++-- codegen/Cargo.toml | 2 +- protocol/Cargo.toml | 2 +- tcp/Cargo.toml | 2 +- types/Cargo.toml | 2 +- uri/Cargo.toml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index 08e63ab6..2a336f14 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -13,9 +13,9 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - rust: [nightly, beta, stable, 1.63.0] + rust: [nightly, beta, stable, 1.74.0] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install latest ${{ matrix.rust }} uses: actions-rs/toolchain@v1 diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 916a374c..ab7ec81d 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -9,7 +9,7 @@ documentation = "https://docs.rs/amq-protocol-codegen" keywords = ["amqp","rabbitmq","protocol"] categories = ["api-bindings","network-programming"] license = "BSD-2-Clause" -rust-version = "1.63.0" +rust-version = "1.74.0" [lib] name = "amq_protocol_codegen" diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index 46e9ceb6..5cc26bc5 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -10,7 +10,7 @@ keywords = ["amqp","rabbitmq","protocol","nom"] categories = ["api-bindings","network-programming"] license = "BSD-2-Clause" build = "build.rs" -rust-version = "1.63.0" +rust-version = "1.74.0" [lib] name = "amq_protocol" diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index acb3455c..fd87d092 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -9,7 +9,7 @@ documentation = "https://docs.rs/amq-protocol-tcp" keywords = ["amqp","rabbitmq","protocol"] categories = ["api-bindings","network-programming"] license = "BSD-2-Clause" -rust-version = "1.63.0" +rust-version = "1.74.0" [lib] name = "amq_protocol_tcp" diff --git a/types/Cargo.toml b/types/Cargo.toml index 85eb795b..d203d897 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -9,7 +9,7 @@ documentation = "https://docs.rs/amq-protocol-types" keywords = ["amqp","rabbitmq","protocol","nom"] categories = ["api-bindings","network-programming"] license = "BSD-2-Clause" -rust-version = "1.63.0" +rust-version = "1.74.0" [lib] name = "amq_protocol_types" diff --git a/uri/Cargo.toml b/uri/Cargo.toml index d628e700..7889ea82 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -9,7 +9,7 @@ documentation = "https://docs.rs/amq-protocol-uri" keywords = ["amqp","rabbitmq","protocol"] categories = ["api-bindings","network-programming"] license = "BSD-2-Clause" -rust-version = "1.63.0" +rust-version = "1.74.0" [lib] name = "amq_protocol_uri" From 7cb355ed61de8c05fcfadc2032156c98137bd9fc Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Sat, 31 Aug 2024 14:53:14 +0200 Subject: [PATCH 117/133] ci: install rustls binary deps on windows Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- .github/workflows/build-and-test.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index 2a336f14..0e6b03bc 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -24,6 +24,14 @@ jobs: profile: minimal override: true + - name: Install NASM for aws-lc-rs on Windows + if: runner.os == 'Windows' + uses: ilammy/setup-nasm@v1 + + - name: Install ninja-build tool for aws-lc-fips-sys on Windows + if: runner.os == 'Windows' + uses: seanmiddleditch/gha-setup-ninja@v5 + - name: Run cargo check uses: actions-rs/cargo@v1 with: From 0009a1e3a402b988a7dfcf16b3bf02b6670bb919 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Thu, 5 Sep 2024 21:50:10 +0200 Subject: [PATCH 118/133] v8.0.0-alpha.3 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/Cargo.toml | 4 ++-- codegen/src/util.rs | 2 ++ protocol/Cargo.toml | 10 +++++----- tcp/Cargo.toml | 4 ++-- types/Cargo.toml | 2 +- uri/Cargo.toml | 4 ++-- 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index ab7ec81d..fa0085e1 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "8.0.0-alpha.2" +version = "8.0.0-alpha.3" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" @@ -19,7 +19,7 @@ handlebars = "^6.0" serde_json = "^1.0" [dependencies.amq-protocol-types] -version = "=8.0.0-alpha.2" +version = "=8.0.0-alpha.3" path = "../types" [dependencies.serde] diff --git a/codegen/src/util.rs b/codegen/src/util.rs index adccc5f7..3237ef4a 100644 --- a/codegen/src/util.rs +++ b/codegen/src/util.rs @@ -18,8 +18,10 @@ pub fn camel_case(name: &str) -> String { } /// Convert input to snake case +/// /// For the purpose of the AMQP codegen usage, we also handle a few special cases: /// "type" and "return" become "kind" and "r#return" if raw is true +/// /// A word needs to be composed of at least two letters, this makes UInt become uint and not u_int pub fn snake_case(name: &str, raw: bool) -> String { match name { diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index 5cc26bc5..89c28b87 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "8.0.0-alpha.2" +version = "8.0.0-alpha.3" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" @@ -33,21 +33,21 @@ rustls--aws_lc_rs = ["amq-protocol-tcp/rustls--aws_lc_rs"] # default, bu rustls--ring = ["amq-protocol-tcp/rustls--ring"] # more compatible, (e.g., easily builds on Windows) [build-dependencies.amq-protocol-codegen] -version = "=8.0.0-alpha.2" +version = "=8.0.0-alpha.3" path = "../codegen" optional = true [dependencies.amq-protocol-tcp] -version = "=8.0.0-alpha.2" +version = "=8.0.0-alpha.3" default-features = false path = "../tcp" [dependencies.amq-protocol-types] -version = "=8.0.0-alpha.2" +version = "=8.0.0-alpha.3" path = "../types" [dependencies.amq-protocol-uri] -version = "=8.0.0-alpha.2" +version = "=8.0.0-alpha.3" path = "../uri" [dependencies.cookie-factory] diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index fd87d092..e636aeb6 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "8.0.0-alpha.2" +version = "8.0.0-alpha.3" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" @@ -30,7 +30,7 @@ rustls--aws_lc_rs = ["tcp-stream/rustls--aws_lc_rs"] # default, but does rustls--ring = ["tcp-stream/rustls--ring"] # more compatible, (e.g., easily builds on Windows) [dependencies.amq-protocol-uri] -version = "=8.0.0-alpha.2" +version = "=8.0.0-alpha.3" path = "../uri" [dependencies.tcp-stream] diff --git a/types/Cargo.toml b/types/Cargo.toml index d203d897..77de9538 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "8.0.0-alpha.2" +version = "8.0.0-alpha.3" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/uri/Cargo.toml b/uri/Cargo.toml index 7889ea82..c1f3b753 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "8.0.0-alpha.2" +version = "8.0.0-alpha.3" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" @@ -15,7 +15,7 @@ rust-version = "1.74.0" name = "amq_protocol_uri" [dependencies.amq-protocol-types] -version = "=8.0.0-alpha.2" +version = "=8.0.0-alpha.3" path = "../types" [dependencies] From 044ea98e70438003ac4b63a6e66453d1decb8840 Mon Sep 17 00:00:00 2001 From: Michael Zhalevich <cheshirsky.code@gmail.com> Date: Tue, 17 Sep 2024 15:36:55 +0200 Subject: [PATCH 119/133] parsing: fixed parsing frames with attributes contained dashes --- protocol/src/frame/parsing.rs | 21 +++++++++++++++++++++ protocol/src/generated.rs | 12 ++++++------ protocol/templates/protocol.rs | 2 +- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/protocol/src/frame/parsing.rs b/protocol/src/frame/parsing.rs index 6d917dd4..ef6dfb26 100644 --- a/protocol/src/frame/parsing.rs +++ b/protocol/src/frame/parsing.rs @@ -162,4 +162,25 @@ mod test { Ok((&[][..], AMQPFrame::Heartbeat(1))) ); } + + #[test] + fn test_parse_declare_queue_frame() { + let frame = AMQPFrame::Method( + 1, + AMQPClass::Queue(queue::AMQPMethod::Declare(queue::Declare { + queue: "some_queue".into(), + passive: true, + durable: true, + exclusive: true, + auto_delete: true, + nowait: true, + arguments: Default::default(), + })), + ); + + let mut buffer = vec![0u8; 30]; + + assert!(gen_frame(&frame)(buffer.as_mut_slice().into()).is_ok()); + assert_eq!(parse_frame(buffer.as_slice()), Ok((&[][..], frame))); + } } diff --git a/protocol/src/generated.rs b/protocol/src/generated.rs index 00e47437..3b72154e 100644 --- a/protocol/src/generated.rs +++ b/protocol/src/generated.rs @@ -646,7 +646,7 @@ pub mod basic { let (i, _) = parse_short_uint.parse(i)?; let (i, queue) = parse_short_string.parse(i)?; let (i, consumer_tag) = parse_short_string.parse(i)?; - let (i, flags) = parse_flags(i, &["no-local", "no-ack", "exclusive", "nowait"])?; + let (i, flags) = parse_flags(i, &["no_local", "no_ack", "exclusive", "nowait"])?; let (i, arguments) = parse_field_table.parse(i)?; Ok(( i, @@ -998,7 +998,7 @@ pub mod basic { pub fn parse_get<I: ParsableInput>(i: I) -> ParserResult<I, Get> { let (i, _) = parse_short_uint.parse(i)?; let (i, queue) = parse_short_string.parse(i)?; - let (i, flags) = parse_flags(i, &["no-ack"])?; + let (i, flags) = parse_flags(i, &["no_ack"])?; Ok(( i, Get { @@ -3040,7 +3040,7 @@ pub mod exchange { let (i, kind) = parse_short_string.parse(i)?; let (i, flags) = parse_flags( i, - &["passive", "durable", "auto-delete", "internal", "nowait"], + &["passive", "durable", "auto_delete", "internal", "nowait"], )?; let (i, arguments) = parse_field_table.parse(i)?; Ok(( @@ -3135,7 +3135,7 @@ pub mod exchange { pub fn parse_delete<I: ParsableInput>(i: I) -> ParserResult<I, Delete> { let (i, _) = parse_short_uint.parse(i)?; let (i, exchange) = parse_short_string.parse(i)?; - let (i, flags) = parse_flags(i, &["if-unused", "nowait"])?; + let (i, flags) = parse_flags(i, &["if_unused", "nowait"])?; Ok(( i, Delete { @@ -3527,7 +3527,7 @@ pub mod queue { let (i, queue) = parse_short_string.parse(i)?; let (i, flags) = parse_flags( i, - &["passive", "durable", "exclusive", "auto-delete", "nowait"], + &["passive", "durable", "exclusive", "auto_delete", "nowait"], )?; let (i, arguments) = parse_field_table.parse(i)?; Ok(( @@ -3820,7 +3820,7 @@ pub mod queue { pub fn parse_delete<I: ParsableInput>(i: I) -> ParserResult<I, Delete> { let (i, _) = parse_short_uint.parse(i)?; let (i, queue) = parse_short_string.parse(i)?; - let (i, flags) = parse_flags(i, &["if-unused", "if-empty", "nowait"])?; + let (i, flags) = parse_flags(i, &["if_unused", "if_empty", "nowait"])?; Ok(( i, Delete { diff --git a/protocol/templates/protocol.rs b/protocol/templates/protocol.rs index ab16fd97..5688a934 100644 --- a/protocol/templates/protocol.rs +++ b/protocol/templates/protocol.rs @@ -241,7 +241,7 @@ pub mod {{snake class.name}} { {{else}} let (i, {{#if argument.ignore_flags ~}}_{{else}}flags{{/if ~}}) = parse_flags(i, &[ {{#each argument.flags as |flag| ~}} - "{{flag.name}}", + "{{snake flag.name}}", {{/each ~}} ])?; {{/if ~}} From 1e1fb839a8d07812e979d0eaa86fc36d772ef8ce Mon Sep 17 00:00:00 2001 From: Michael Zhalevich <cheshirsky.code@gmail.com> Date: Tue, 17 Sep 2024 15:36:55 +0200 Subject: [PATCH 120/133] parsing: fixed parsing frames with attributes contained dashes --- protocol/src/frame/parsing.rs | 21 +++++++++++++++++++++ protocol/src/generated.rs | 12 ++++++------ protocol/templates/protocol.rs | 2 +- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/protocol/src/frame/parsing.rs b/protocol/src/frame/parsing.rs index 4f9a189a..b5548c5a 100644 --- a/protocol/src/frame/parsing.rs +++ b/protocol/src/frame/parsing.rs @@ -157,4 +157,25 @@ mod test { Ok((&[][..], AMQPFrame::Heartbeat(1))) ); } + + #[test] + fn test_parse_declare_queue_frame() { + let frame = AMQPFrame::Method( + 1, + AMQPClass::Queue(queue::AMQPMethod::Declare(queue::Declare { + queue: "some_queue".into(), + passive: true, + durable: true, + exclusive: true, + auto_delete: true, + nowait: true, + arguments: Default::default(), + })), + ); + + let mut buffer = vec![0u8; 30]; + + assert!(gen_frame(&frame)(buffer.as_mut_slice().into()).is_ok()); + assert_eq!(parse_frame(buffer.as_slice()), Ok((&[][..], frame))); + } } diff --git a/protocol/src/generated.rs b/protocol/src/generated.rs index b3c1fbc3..cb5ccc1a 100644 --- a/protocol/src/generated.rs +++ b/protocol/src/generated.rs @@ -628,7 +628,7 @@ pub mod basic { let (i, _) = parse_short_uint(i)?; let (i, queue) = parse_short_string(i)?; let (i, consumer_tag) = parse_short_string(i)?; - let (i, flags) = parse_flags(i, &["no-local", "no-ack", "exclusive", "nowait"])?; + let (i, flags) = parse_flags(i, &["no_local", "no_ack", "exclusive", "nowait"])?; let (i, arguments) = parse_field_table(i)?; Ok(( i, @@ -980,7 +980,7 @@ pub mod basic { pub fn parse_get<I: ParsableInput>(i: I) -> ParserResult<I, Get> { let (i, _) = parse_short_uint(i)?; let (i, queue) = parse_short_string(i)?; - let (i, flags) = parse_flags(i, &["no-ack"])?; + let (i, flags) = parse_flags(i, &["no_ack"])?; Ok(( i, Get { @@ -2998,7 +2998,7 @@ pub mod exchange { let (i, kind) = parse_short_string(i)?; let (i, flags) = parse_flags( i, - &["passive", "durable", "auto-delete", "internal", "nowait"], + &["passive", "durable", "auto_delete", "internal", "nowait"], )?; let (i, arguments) = parse_field_table(i)?; Ok(( @@ -3093,7 +3093,7 @@ pub mod exchange { pub fn parse_delete<I: ParsableInput>(i: I) -> ParserResult<I, Delete> { let (i, _) = parse_short_uint(i)?; let (i, exchange) = parse_short_string(i)?; - let (i, flags) = parse_flags(i, &["if-unused", "nowait"])?; + let (i, flags) = parse_flags(i, &["if_unused", "nowait"])?; Ok(( i, Delete { @@ -3476,7 +3476,7 @@ pub mod queue { let (i, queue) = parse_short_string(i)?; let (i, flags) = parse_flags( i, - &["passive", "durable", "exclusive", "auto-delete", "nowait"], + &["passive", "durable", "exclusive", "auto_delete", "nowait"], )?; let (i, arguments) = parse_field_table(i)?; Ok(( @@ -3769,7 +3769,7 @@ pub mod queue { pub fn parse_delete<I: ParsableInput>(i: I) -> ParserResult<I, Delete> { let (i, _) = parse_short_uint(i)?; let (i, queue) = parse_short_string(i)?; - let (i, flags) = parse_flags(i, &["if-unused", "if-empty", "nowait"])?; + let (i, flags) = parse_flags(i, &["if_unused", "if_empty", "nowait"])?; Ok(( i, Delete { diff --git a/protocol/templates/protocol.rs b/protocol/templates/protocol.rs index 254cd451..4ca157aa 100644 --- a/protocol/templates/protocol.rs +++ b/protocol/templates/protocol.rs @@ -241,7 +241,7 @@ pub mod {{snake class.name}} { {{else}} let (i, {{#if argument.ignore_flags ~}}_{{else}}flags{{/if ~}}) = parse_flags(i, &[ {{#each argument.flags as |flag| ~}} - "{{flag.name}}", + "{{snake flag.name}}", {{/each ~}} ])?; {{/if ~}} From 9a4e7ee97234dd876087ac46657a3dfe4625d681 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Sat, 21 Sep 2024 14:00:08 +0200 Subject: [PATCH 121/133] v7.2.2 Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> --- codegen/Cargo.toml | 4 ++-- protocol/Cargo.toml | 10 +++++----- tcp/Cargo.toml | 4 ++-- types/Cargo.toml | 2 +- uri/Cargo.toml | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 8fedb8ef..80935671 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "7.2.1" +version = "7.2.2" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" @@ -19,7 +19,7 @@ handlebars = "^5.0" serde_json = "^1.0" [dependencies.amq-protocol-types] -version = "=7.2.1" +version = "=7.2.2" path = "../types" [dependencies.serde] diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index 432118f1..0bf47aa3 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "7.2.1" +version = "7.2.2" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" @@ -28,21 +28,21 @@ vendored-openssl = ["amq-protocol-tcp/vendored-openssl"] verbose-errors = ["amq-protocol-types/verbose-errors"] [build-dependencies.amq-protocol-codegen] -version = "=7.2.1" +version = "=7.2.2" path = "../codegen" optional = true [dependencies.amq-protocol-tcp] -version = "=7.2.1" +version = "=7.2.2" default-features = false path = "../tcp" [dependencies.amq-protocol-types] -version = "=7.2.1" +version = "=7.2.2" path = "../types" [dependencies.amq-protocol-uri] -version = "=7.2.1" +version = "=7.2.2" path = "../uri" [dependencies.cookie-factory] diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index 19178049..abd3e144 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "7.2.1" +version = "7.2.2" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" @@ -25,7 +25,7 @@ rustls-connector = ["tcp-stream/rustls-connector"] vendored-openssl = ["tcp-stream/vendored-openssl"] [dependencies.amq-protocol-uri] -version = "=7.2.1" +version = "=7.2.2" path = "../uri" [dependencies.tcp-stream] diff --git a/types/Cargo.toml b/types/Cargo.toml index d70cf440..976a95ce 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "7.2.1" +version = "7.2.2" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/uri/Cargo.toml b/uri/Cargo.toml index 8740f72c..7572ea7f 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "7.2.1" +version = "7.2.2" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" @@ -15,7 +15,7 @@ rust-version = "1.63.0" name = "amq_protocol_uri" [dependencies.amq-protocol-types] -version = "=7.2.1" +version = "=7.2.2" path = "../types" [dependencies] From 79e0ce70e6895f7739368f3d5a72886cb5ac41aa Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Mon, 9 Dec 2024 09:46:15 +0100 Subject: [PATCH 122/133] update to nom 8.0.0-beta.1 --- protocol/Cargo.toml | 2 +- types/Cargo.toml | 2 +- types/src/parsing.rs | 13 ++++++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index 7b13076c..0d29c9ce 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -56,7 +56,7 @@ default-features = false features = ["std"] [dependencies.nom] -version = "=8.0.0-alpha2" +version = "=8.0.0-beta.1" features = ["std"] [dependencies.serde] diff --git a/types/Cargo.toml b/types/Cargo.toml index 0c573a0b..3dbc50ea 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -26,7 +26,7 @@ default-features = false features = ["std"] [dependencies.nom] -version = "=8.0.0-alpha2" +version = "=8.0.0-beta.1" features = ["std"] [dependencies.serde] diff --git a/types/src/parsing.rs b/types/src/parsing.rs index fcd4b983..fc5e1d1e 100644 --- a/types/src/parsing.rs +++ b/types/src/parsing.rs @@ -3,7 +3,7 @@ use nom::{ self, bytes::streaming::take, combinator::{all_consuming, complete, flat_map, map, map_opt, map_parser, map_res}, - error::{context, ContextError, ErrorKind, ParseError, VerboseErrorKind}, + error::{context, ContextError, ErrorKind, ParseError}, multi::fold_many0, number::streaming::{ be_f32, be_f64, be_i16, be_i32, be_i64, be_u16, be_u32, be_u64, i8 as be_i8, u8 as be_u8, @@ -14,6 +14,17 @@ use nom::{ use std::{error, fmt}; use traits::*; +/// Error context for `ParserErrors` +#[derive(Clone, Debug, Eq, PartialEq)] +enum VerboseErrorKind { + /// Static string added by the `context` function + Context(&'static str), + /// Indicates which character was expected by the `char` function + Char(char), + /// Error kind given by various nom parsers + Nom(ErrorKind), +} + /// Struct holding the errors stack #[derive(Clone, Debug, PartialEq)] pub struct ParserErrors { From de37a25caeca20037d9aee347b158864eb9503db Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Mon, 9 Dec 2024 09:46:29 +0100 Subject: [PATCH 123/133] v8.0.0-beta.1 --- codegen/Cargo.toml | 4 ++-- protocol/Cargo.toml | 10 +++++----- tcp/Cargo.toml | 4 ++-- types/Cargo.toml | 2 +- uri/Cargo.toml | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 75eb2c48..3fa4e848 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "8.0.0-alpha.4" +version = "8.0.0-beta.1" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" @@ -19,7 +19,7 @@ handlebars = "^6.0" serde_json = "^1.0" [dependencies.amq-protocol-types] -version = "=8.0.0-alpha.4" +version = "=8.0.0-beta.1" path = "../types" [dependencies.serde] diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index 0d29c9ce..3d7d14ea 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "8.0.0-alpha.4" +version = "8.0.0-beta.1" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" @@ -33,21 +33,21 @@ rustls--aws_lc_rs = ["amq-protocol-tcp/rustls--aws_lc_rs"] # default, bu rustls--ring = ["amq-protocol-tcp/rustls--ring"] # more compatible, (e.g., easily builds on Windows) [build-dependencies.amq-protocol-codegen] -version = "=8.0.0-alpha.4" +version = "=8.0.0-beta.1" path = "../codegen" optional = true [dependencies.amq-protocol-tcp] -version = "=8.0.0-alpha.4" +version = "=8.0.0-beta.1" default-features = false path = "../tcp" [dependencies.amq-protocol-types] -version = "=8.0.0-alpha.4" +version = "=8.0.0-beta.1" path = "../types" [dependencies.amq-protocol-uri] -version = "=8.0.0-alpha.4" +version = "=8.0.0-beta.1" path = "../uri" [dependencies.cookie-factory] diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index 56beca62..621c6f30 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "8.0.0-alpha.4" +version = "8.0.0-beta.1" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" @@ -30,7 +30,7 @@ rustls--aws_lc_rs = ["tcp-stream/rustls--aws_lc_rs"] # default, but does rustls--ring = ["tcp-stream/rustls--ring"] # more compatible, (e.g., easily builds on Windows) [dependencies.amq-protocol-uri] -version = "=8.0.0-alpha.4" +version = "=8.0.0-beta.1" path = "../uri" [dependencies.tcp-stream] diff --git a/types/Cargo.toml b/types/Cargo.toml index 3dbc50ea..55e587d3 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "8.0.0-alpha.4" +version = "8.0.0-beta.1" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/uri/Cargo.toml b/uri/Cargo.toml index 51cb6028..a2b63bef 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "8.0.0-alpha.4" +version = "8.0.0-beta.1" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" @@ -15,7 +15,7 @@ rust-version = "1.74.0" name = "amq_protocol_uri" [dependencies.amq-protocol-types] -version = "=8.0.0-alpha.4" +version = "=8.0.0-beta.1" path = "../types" [dependencies] From b4b69f92cbb2461c9b6431baf36f9bbd989cf19b Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Mon, 9 Dec 2024 10:12:54 +0100 Subject: [PATCH 124/133] rustfmt --- types/src/parsing.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/types/src/parsing.rs b/types/src/parsing.rs index fc5e1d1e..18c6c03d 100644 --- a/types/src/parsing.rs +++ b/types/src/parsing.rs @@ -17,12 +17,12 @@ use traits::*; /// Error context for `ParserErrors` #[derive(Clone, Debug, Eq, PartialEq)] enum VerboseErrorKind { - /// Static string added by the `context` function - Context(&'static str), - /// Indicates which character was expected by the `char` function - Char(char), - /// Error kind given by various nom parsers - Nom(ErrorKind), + /// Static string added by the `context` function + Context(&'static str), + /// Indicates which character was expected by the `char` function + Char(char), + /// Error kind given by various nom parsers + Nom(ErrorKind), } /// Struct holding the errors stack From b51dd2c427926b2ad1c828a74b131d21cc499aeb Mon Sep 17 00:00:00 2001 From: Anton Jansson <anton_jansson@live.se> Date: Mon, 30 Dec 2024 13:43:20 +0100 Subject: [PATCH 125/133] Change so that FieldTable::insert returns self to enable chained inserts. --- types/src/types.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/src/types.rs b/types/src/types.rs index 65a068bc..1092cc17 100644 --- a/types/src/types.rs +++ b/types/src/types.rs @@ -250,8 +250,9 @@ impl From<Vec<AMQPValue>> for FieldArray { impl FieldTable { /// Insert a new entry in the table - pub fn insert(&mut self, k: ShortString, v: AMQPValue) { + pub fn insert(&mut self, k: ShortString, v: AMQPValue) -> &mut Self { self.0.insert(k, v); + self } /// Check whether the table contains the given key From 91831c6b41e1890010a6a1c92057c825ba0b6a3b Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Wed, 29 Jan 2025 10:23:34 +0100 Subject: [PATCH 126/133] update to nom 8.0 --- protocol/Cargo.toml | 2 +- types/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index 3d7d14ea..34bc3971 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -56,7 +56,7 @@ default-features = false features = ["std"] [dependencies.nom] -version = "=8.0.0-beta.1" +version = "^8.0" features = ["std"] [dependencies.serde] diff --git a/types/Cargo.toml b/types/Cargo.toml index 55e587d3..9d05f3ec 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -26,7 +26,7 @@ default-features = false features = ["std"] [dependencies.nom] -version = "=8.0.0-beta.1" +version = "^8.0" features = ["std"] [dependencies.serde] From 69f147b79036e95cbd0dfd470e6170d107d61d2d Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Wed, 29 Jan 2025 10:23:57 +0100 Subject: [PATCH 127/133] silence clippy warning --- protocol/src/auth.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol/src/auth.rs b/protocol/src/auth.rs index cfe54d84..ef54b3cc 100644 --- a/protocol/src/auth.rs +++ b/protocol/src/auth.rs @@ -43,7 +43,7 @@ impl Credentials { } fn amqplain_auth_string(&self) -> String { - let needed_len = 4 /* FieldTable length */ + 15 /* LOGIN + PASSWORD + 2 * 1 (length) */ + 5 /* type + length */ + self.username().as_bytes().len() + 5 /* type + length */ + self.password().as_bytes().len(); + let needed_len = 4 /* FieldTable length */ + 15 /* LOGIN + PASSWORD + 2 * 1 (length) */ + 5 /* type + length */ + self.username().len() + 5 /* type + length */ + self.password().len(); let mut buf = vec![0; needed_len]; let mut table = FieldTable::default(); table.insert( From d999b20ea53a07918e4488bb5ec91e5c22467b3c Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Wed, 29 Jan 2025 13:52:27 +0100 Subject: [PATCH 128/133] v8.0.0 --- codegen/Cargo.toml | 4 ++-- protocol/Cargo.toml | 10 +++++----- tcp/Cargo.toml | 4 ++-- types/Cargo.toml | 2 +- uri/Cargo.toml | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 3fa4e848..8a592173 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "8.0.0-beta.1" +version = "8.0.0" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" @@ -19,7 +19,7 @@ handlebars = "^6.0" serde_json = "^1.0" [dependencies.amq-protocol-types] -version = "=8.0.0-beta.1" +version = "=8.0.0" path = "../types" [dependencies.serde] diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index 34bc3971..f2faa196 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "8.0.0-beta.1" +version = "8.0.0" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" @@ -33,21 +33,21 @@ rustls--aws_lc_rs = ["amq-protocol-tcp/rustls--aws_lc_rs"] # default, bu rustls--ring = ["amq-protocol-tcp/rustls--ring"] # more compatible, (e.g., easily builds on Windows) [build-dependencies.amq-protocol-codegen] -version = "=8.0.0-beta.1" +version = "=8.0.0" path = "../codegen" optional = true [dependencies.amq-protocol-tcp] -version = "=8.0.0-beta.1" +version = "=8.0.0" default-features = false path = "../tcp" [dependencies.amq-protocol-types] -version = "=8.0.0-beta.1" +version = "=8.0.0" path = "../types" [dependencies.amq-protocol-uri] -version = "=8.0.0-beta.1" +version = "=8.0.0" path = "../uri" [dependencies.cookie-factory] diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index 621c6f30..31c1a830 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "8.0.0-beta.1" +version = "8.0.0" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" @@ -30,7 +30,7 @@ rustls--aws_lc_rs = ["tcp-stream/rustls--aws_lc_rs"] # default, but does rustls--ring = ["tcp-stream/rustls--ring"] # more compatible, (e.g., easily builds on Windows) [dependencies.amq-protocol-uri] -version = "=8.0.0-beta.1" +version = "=8.0.0" path = "../uri" [dependencies.tcp-stream] diff --git a/types/Cargo.toml b/types/Cargo.toml index 9d05f3ec..cec5c546 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "8.0.0-beta.1" +version = "8.0.0" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/uri/Cargo.toml b/uri/Cargo.toml index a2b63bef..22263145 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "8.0.0-beta.1" +version = "8.0.0" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" @@ -15,7 +15,7 @@ rust-version = "1.74.0" name = "amq_protocol_uri" [dependencies.amq-protocol-types] -version = "=8.0.0-beta.1" +version = "=8.0.0" path = "../types" [dependencies] From fdde3e87ffcc737c3e465d17a8283934d1bdf55e Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Mon, 24 Feb 2025 15:27:17 +0100 Subject: [PATCH 129/133] v8.1.0 --- codegen/Cargo.toml | 4 ++-- protocol/Cargo.toml | 10 +++++----- tcp/Cargo.toml | 6 +++--- types/Cargo.toml | 2 +- uri/Cargo.toml | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 8a592173..e32572af 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "8.0.0" +version = "8.1.0" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" @@ -19,7 +19,7 @@ handlebars = "^6.0" serde_json = "^1.0" [dependencies.amq-protocol-types] -version = "=8.0.0" +version = "=8.1.0" path = "../types" [dependencies.serde] diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index f2faa196..2529b8df 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "8.0.0" +version = "8.1.0" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" @@ -33,21 +33,21 @@ rustls--aws_lc_rs = ["amq-protocol-tcp/rustls--aws_lc_rs"] # default, bu rustls--ring = ["amq-protocol-tcp/rustls--ring"] # more compatible, (e.g., easily builds on Windows) [build-dependencies.amq-protocol-codegen] -version = "=8.0.0" +version = "=8.1.0" path = "../codegen" optional = true [dependencies.amq-protocol-tcp] -version = "=8.0.0" +version = "=8.1.0" default-features = false path = "../tcp" [dependencies.amq-protocol-types] -version = "=8.0.0" +version = "=8.1.0" path = "../types" [dependencies.amq-protocol-uri] -version = "=8.0.0" +version = "=8.1.0" path = "../uri" [dependencies.cookie-factory] diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index 31c1a830..b2ead407 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "8.0.0" +version = "8.1.0" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" @@ -30,11 +30,11 @@ rustls--aws_lc_rs = ["tcp-stream/rustls--aws_lc_rs"] # default, but does rustls--ring = ["tcp-stream/rustls--ring"] # more compatible, (e.g., easily builds on Windows) [dependencies.amq-protocol-uri] -version = "=8.0.0" +version = "=8.1.0" path = "../uri" [dependencies.tcp-stream] -version = "^0.29.1" +version = "^0.30" default-features = false [dependencies.tracing] diff --git a/types/Cargo.toml b/types/Cargo.toml index cec5c546..e41505b1 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "8.0.0" +version = "8.1.0" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/uri/Cargo.toml b/uri/Cargo.toml index 22263145..5b7cd9b3 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "8.0.0" +version = "8.1.0" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" @@ -15,7 +15,7 @@ rust-version = "1.74.0" name = "amq_protocol_uri" [dependencies.amq-protocol-types] -version = "=8.0.0" +version = "=8.1.0" path = "../types" [dependencies] From 6018eb87a5ecfe8561426a3e91923d454742ee96 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Mon, 24 Feb 2025 15:31:16 +0100 Subject: [PATCH 130/133] udpate MSRV for native-tls --- .github/workflows/build-and-test.yaml | 2 +- codegen/Cargo.toml | 2 +- protocol/Cargo.toml | 2 +- tcp/Cargo.toml | 2 +- types/Cargo.toml | 2 +- uri/Cargo.toml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index 0e6b03bc..e5ca58ff 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -13,7 +13,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - rust: [nightly, beta, stable, 1.74.0] + rust: [nightly, beta, stable, 1.80.0] steps: - uses: actions/checkout@v4 diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index e32572af..af361c15 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -9,7 +9,7 @@ documentation = "https://docs.rs/amq-protocol-codegen" keywords = ["amqp","rabbitmq","protocol"] categories = ["api-bindings","network-programming"] license = "BSD-2-Clause" -rust-version = "1.74.0" +rust-version = "1.80.0" [lib] name = "amq_protocol_codegen" diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index 2529b8df..8c35d968 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -10,7 +10,7 @@ keywords = ["amqp","rabbitmq","protocol","nom"] categories = ["api-bindings","network-programming"] license = "BSD-2-Clause" build = "build.rs" -rust-version = "1.74.0" +rust-version = "1.80.0" [lib] name = "amq_protocol" diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index b2ead407..bef0e560 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -9,7 +9,7 @@ documentation = "https://docs.rs/amq-protocol-tcp" keywords = ["amqp","rabbitmq","protocol"] categories = ["api-bindings","network-programming"] license = "BSD-2-Clause" -rust-version = "1.74.0" +rust-version = "1.80.0" [lib] name = "amq_protocol_tcp" diff --git a/types/Cargo.toml b/types/Cargo.toml index e41505b1..cc6c5a0c 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -9,7 +9,7 @@ documentation = "https://docs.rs/amq-protocol-types" keywords = ["amqp","rabbitmq","protocol","nom"] categories = ["api-bindings","network-programming"] license = "BSD-2-Clause" -rust-version = "1.74.0" +rust-version = "1.80.0" [lib] name = "amq_protocol_types" diff --git a/uri/Cargo.toml b/uri/Cargo.toml index 5b7cd9b3..ee13df10 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -9,7 +9,7 @@ documentation = "https://docs.rs/amq-protocol-uri" keywords = ["amqp","rabbitmq","protocol"] categories = ["api-bindings","network-programming"] license = "BSD-2-Clause" -rust-version = "1.74.0" +rust-version = "1.80.0" [lib] name = "amq_protocol_uri" From 49f0dc3a8c562eaa7eea6e62557118de51a987ee Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Sun, 2 Mar 2025 15:32:51 +0100 Subject: [PATCH 131/133] update MSRV --- .github/workflows/build-and-test.yaml | 2 +- codegen/Cargo.toml | 2 +- protocol/Cargo.toml | 2 +- tcp/Cargo.toml | 2 +- types/Cargo.toml | 2 +- uri/Cargo.toml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index e5ca58ff..76fb070e 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -13,7 +13,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - rust: [nightly, beta, stable, 1.80.0] + rust: [nightly, beta, stable, 1.81.0] steps: - uses: actions/checkout@v4 diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index af361c15..b2979607 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -9,7 +9,7 @@ documentation = "https://docs.rs/amq-protocol-codegen" keywords = ["amqp","rabbitmq","protocol"] categories = ["api-bindings","network-programming"] license = "BSD-2-Clause" -rust-version = "1.80.0" +rust-version = "1.81.0" [lib] name = "amq_protocol_codegen" diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index 8c35d968..60157524 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -10,7 +10,7 @@ keywords = ["amqp","rabbitmq","protocol","nom"] categories = ["api-bindings","network-programming"] license = "BSD-2-Clause" build = "build.rs" -rust-version = "1.80.0" +rust-version = "1.81.0" [lib] name = "amq_protocol" diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index bef0e560..e8b856f2 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -9,7 +9,7 @@ documentation = "https://docs.rs/amq-protocol-tcp" keywords = ["amqp","rabbitmq","protocol"] categories = ["api-bindings","network-programming"] license = "BSD-2-Clause" -rust-version = "1.80.0" +rust-version = "1.81.0" [lib] name = "amq_protocol_tcp" diff --git a/types/Cargo.toml b/types/Cargo.toml index cc6c5a0c..0685dbea 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -9,7 +9,7 @@ documentation = "https://docs.rs/amq-protocol-types" keywords = ["amqp","rabbitmq","protocol","nom"] categories = ["api-bindings","network-programming"] license = "BSD-2-Clause" -rust-version = "1.80.0" +rust-version = "1.81.0" [lib] name = "amq_protocol_types" diff --git a/uri/Cargo.toml b/uri/Cargo.toml index ee13df10..d6b2cd7f 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -9,7 +9,7 @@ documentation = "https://docs.rs/amq-protocol-uri" keywords = ["amqp","rabbitmq","protocol"] categories = ["api-bindings","network-programming"] license = "BSD-2-Clause" -rust-version = "1.80.0" +rust-version = "1.81.0" [lib] name = "amq_protocol_uri" From 5583b0501ed52080b7acb76fa13f850c6fe39ede Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Mon, 17 Mar 2025 19:44:31 +0100 Subject: [PATCH 132/133] update CI --- .github/workflows/lint.yaml | 6 +- .github/workflows/security.yaml | 6 +- .github/workflows/semver.yaml | 13 + .gitignore | 1 - Cargo.lock | 2003 +++++++++++++++++++++++++++++++ tcp/Cargo.toml | 2 +- 6 files changed, 2021 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/semver.yaml create mode 100644 Cargo.lock diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index c672e393..8a03da72 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -2,15 +2,13 @@ name: Lint on: push: - branches: - - main pull_request: jobs: clippy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: @@ -25,7 +23,7 @@ jobs: rustfmt: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: diff --git a/.github/workflows/security.yaml b/.github/workflows/security.yaml index 4238fb02..2b82f715 100644 --- a/.github/workflows/security.yaml +++ b/.github/workflows/security.yaml @@ -2,16 +2,14 @@ name: Security audit on: push: - branches: - - main pull_request: jobs: security_audit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - uses: actions-rs/audit-check@v1 + - uses: rustsec/audit-check@v2 with: token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/semver.yaml b/.github/workflows/semver.yaml new file mode 100644 index 00000000..c7f6a1f1 --- /dev/null +++ b/.github/workflows/semver.yaml @@ -0,0 +1,13 @@ +name: Semver compliance check + +on: + push: + pull_request: + +jobs: + semver_check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: obi1kenobi/cargo-semver-checks-action@v2 + diff --git a/.gitignore b/.gitignore index a9d37c56..eb5a316c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ target -Cargo.lock diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 00000000..5190cfee --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,2003 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "amq-protocol" +version = "8.1.0" +dependencies = [ + "amq-protocol-codegen", + "amq-protocol-tcp", + "amq-protocol-types", + "amq-protocol-uri", + "cookie-factory", + "nom 8.0.0", + "serde", +] + +[[package]] +name = "amq-protocol-codegen" +version = "8.1.0" +dependencies = [ + "amq-protocol-types", + "handlebars", + "serde", + "serde_json", +] + +[[package]] +name = "amq-protocol-tcp" +version = "8.1.0" +dependencies = [ + "amq-protocol-uri", + "tcp-stream", + "tracing", +] + +[[package]] +name = "amq-protocol-types" +version = "8.1.0" +dependencies = [ + "cookie-factory", + "nom 8.0.0", + "serde", + "serde_json", +] + +[[package]] +name = "amq-protocol-uri" +version = "8.1.0" +dependencies = [ + "amq-protocol-types", + "percent-encoding", + "url", +] + +[[package]] +name = "asn1-rs" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56624a96882bb8c26d61312ae18cb45868e5a9992ea73c58e45c3101e56a1e60" +dependencies = [ + "asn1-rs-derive", + "asn1-rs-impl", + "displaydoc", + "nom 7.1.3", + "num-traits", + "rusticata-macros", + "thiserror", + "time", +] + +[[package]] +name = "asn1-rs-derive" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3109e49b1e4909e9db6515a30c633684d68cdeaa252f215214cb4fa1a5bfee2c" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "asn1-rs-impl" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b18050c2cd6fe86c3a76584ef5e0baf286d038cda203eb6223df2cc413565f7" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "autocfg" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + +[[package]] +name = "aws-lc-rs" +version = "1.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dabb68eb3a7aa08b46fddfd59a3d55c978243557a90ab804769f7e20e67d2b01" +dependencies = [ + "aws-lc-sys", + "zeroize", +] + +[[package]] +name = "aws-lc-sys" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77926887776171ced7d662120a75998e444d3750c951abfe07f90da130514b1f" +dependencies = [ + "bindgen", + "cc", + "cmake", + "dunce", + "fs_extra", +] + +[[package]] +name = "base64ct" +version = "1.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89e25b6adfb930f02d1981565a6e5d9c547ac15a96606256d3b59040e5cd4ca3" + +[[package]] +name = "bindgen" +version = "0.69.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088" +dependencies = [ + "bitflags", + "cexpr", + "clang-sys", + "itertools", + "lazy_static", + "lazycell", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn", + "which", +] + +[[package]] +name = "bitflags" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block-padding" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93" +dependencies = [ + "generic-array", +] + +[[package]] +name = "cbc" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6" +dependencies = [ + "cipher", +] + +[[package]] +name = "cc" +version = "1.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be714c154be609ec7f5dad223a33bf1482fff90472de28f7362806e6d4832b8c" +dependencies = [ + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom 7.1.3", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "clang-sys" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +dependencies = [ + "glob", + "libc", + "libloading", +] + +[[package]] +name = "cmake" +version = "0.1.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7caa3f9de89ddbe2c607f4101924c5abec803763ae9534e4f4d7d8f84aa81f0" +dependencies = [ + "cc", +] + +[[package]] +name = "cms" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b77c319abfd5219629c45c34c89ba945ed3c5e49fcde9d16b6c3885f118a730" +dependencies = [ + "const-oid", + "der", + "spki", + "x509-cert", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "cookie-factory" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9885fa71e26b8ab7855e2ec7cae6e9b380edff76cd052e07c683a0319d51b3a2" + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "darling" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +dependencies = [ + "darling_core", + "quote", + "syn", +] + +[[package]] +name = "data-encoding" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "575f75dfd25738df5b91b8e43e14d44bda14637a58fae779fd2b064f8bf3e010" + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "der_derive", + "flagset", + "pem-rfc7468", + "zeroize", +] + +[[package]] +name = "der-parser" +version = "10.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07da5016415d5a3c4dd39b11ed26f915f52fc4e0dc197d87908bc916e51bc1a6" +dependencies = [ + "asn1-rs", + "displaydoc", + "nom 7.1.3", + "num-bigint", + "num-traits", + "rusticata-macros", +] + +[[package]] +name = "der_derive" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8034092389675178f570469e6c3b0465d3d30b4505c294a6550db47f3c17ad18" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", +] + +[[package]] +name = "derive_builder" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "507dfb09ea8b7fa618fcf76e953f4f5e192547945816d5358edffe39f6f94947" +dependencies = [ + "derive_builder_macro", +] + +[[package]] +name = "derive_builder_core" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d5bcf7b024d6835cfb3d473887cd966994907effbe9227e8c8219824d06c4e8" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "derive_builder_macro" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" +dependencies = [ + "derive_builder_core", + "syn", +] + +[[package]] +name = "des" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffdd80ce8ce993de27e9f063a444a4d53ce8e8db4c1f00cc03af5ad5a9867a1e" +dependencies = [ + "cipher", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "errno" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[package]] +name = "flagset" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3ea1ec5f8307826a5b71094dd91fc04d4ae75d5709b20ad351c7fb4815c86ec" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "fs_extra" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a49c392881ce6d5c3b8cb70f98717b7c07aabbdff06687b9030dbfbe2725f8" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.13.3+wasi-0.2.2", + "windows-targets", +] + +[[package]] +name = "glob" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" + +[[package]] +name = "handlebars" +version = "6.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "759e2d5aea3287cb1190c8ec394f42866cb5bf74fcbf213f354e3c856ea26098" +dependencies = [ + "derive_builder", + "log", + "num-order", + "pest", + "pest_derive", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "home" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "block-padding", + "generic-array", +] + +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + +[[package]] +name = "jobserver" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" +dependencies = [ + "libc", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + +[[package]] +name = "libc" +version = "0.2.171" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" + +[[package]] +name = "libloading" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" +dependencies = [ + "cfg-if", + "windows-targets", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + +[[package]] +name = "linux-raw-sys" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe7db12097d22ec582439daf8618b8fdd1a7bef6270e9af3b1ebcd30893cf413" + +[[package]] +name = "litemap" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23fb14cb19457329c82206317a5663005a4d404783dc74f4252769b0d5f42856" + +[[package]] +name = "log" +version = "0.4.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e" + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "native-tls" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework 2.11.1", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "nom" +version = "8.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405" +dependencies = [ + "memchr", +] + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-modular" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17bb261bf36fa7d83f4c294f834e91256769097b3cb505d44831e0a179ac647f" + +[[package]] +name = "num-order" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "537b596b97c40fcf8056d153049eb22f481c17ebce72a513ec9286e4986d1bb6" +dependencies = [ + "num-modular", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "oid-registry" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f40cff3dde1b6087cc5d5f5d4d65712f34016a03ed60e9c08dcc392736b5b7" +dependencies = [ + "asn1-rs", +] + +[[package]] +name = "once_cell" +version = "1.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d75b0bedcc4fe52caa0e03d9f1151a323e4aa5e2d78ba3580400cd3c9e2bc4bc" + +[[package]] +name = "openssl" +version = "0.10.71" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e14130c6a98cd258fdcb0fb6d744152343ff729cbfcb28c656a9d12b999fbcd" +dependencies = [ + "bitflags", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "openssl-probe" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" + +[[package]] +name = "openssl-src" +version = "300.4.2+3.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "168ce4e058f975fe43e89d9ccf78ca668601887ae736090aacc23ae353c298e2" +dependencies = [ + "cc", +] + +[[package]] +name = "openssl-sys" +version = "0.9.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bb61ea9811cc39e3c2069f40b8b8e2e70d8569b361f879786cc7ed48b777cdd" +dependencies = [ + "cc", + "libc", + "openssl-src", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "p12-keystore" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a09eaa3a6d8884c204c2ab17e313f563b524362e62567f09ba27857a6e31257f" +dependencies = [ + "cbc", + "cms", + "der", + "des", + "hex", + "hmac", + "pkcs12", + "pkcs5", + "rand", + "rc2", + "sha1", + "sha2", + "thiserror", + "x509-parser", +] + +[[package]] +name = "pbkdf2" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" +dependencies = [ + "digest", + "hmac", +] + +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pest" +version = "2.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b7cafe60d6cf8e62e1b9b2ea516a089c008945bb5a275416789e7db0bc199dc" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "816518421cfc6887a0d62bf441b6ffb4536fcc926395a69e1a85852d4363f57e" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d1396fd3a870fc7838768d171b4616d5c91f6cc25e377b673d714567d99377b" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pest_meta" +version = "2.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1e58089ea25d717bfd31fb534e4f3afcc2cc569c70de3e239778991ea3b7dea" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "pkcs12" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "695b3df3d3cc1015f12d70235e35b6b79befc5fa7a9b95b951eab1dd07c9efc2" +dependencies = [ + "cms", + "const-oid", + "der", + "digest", + "spki", + "x509-cert", + "zeroize", +] + +[[package]] +name = "pkcs5" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e847e2c91a18bfa887dd028ec33f2fe6f25db77db3619024764914affe8b69a6" +dependencies = [ + "aes", + "cbc", + "der", + "pbkdf2", + "scrypt", + "sha2", + "spki", +] + +[[package]] +name = "pkg-config" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "prettyplease" +version = "0.2.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5316f57387668042f561aae71480de936257848f9c43ce528e311d89a07cadeb" +dependencies = [ + "proc-macro2", + "syn", +] + +[[package]] +name = "proc-macro2" +version = "1.0.94" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94" +dependencies = [ + "rand_chacha", + "rand_core", + "zerocopy", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.1", +] + +[[package]] +name = "rc2" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62c64daa8e9438b84aaae55010a93f396f8e60e3911590fcba770d04643fc1dd" +dependencies = [ + "cipher", +] + +[[package]] +name = "regex" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.15", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rusticata-macros" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faf0c4a6ece9950b9abdb62b1cfcf2a68b3b67a10ba445b3bb85be2a293d0632" +dependencies = [ + "nom 7.1.3", +] + +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys 0.4.15", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustix" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7178faa4b75a30e269c71e61c353ce2748cf3d76f0c44c393f4e60abf49b825" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys 0.9.3", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustls" +version = "0.23.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "822ee9188ac4ec04a2f0531e55d035fb2de73f18b41a63c70c2712503b6fb13c" +dependencies = [ + "aws-lc-rs", + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-connector" +version = "0.21.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6af6d372e69b04369835927fe7051ab6c0d901c8854a1f2b4d8b5dd22f2d29e" +dependencies = [ + "log", + "rustls", + "rustls-native-certs", + "rustls-pki-types", + "rustls-webpki", + "webpki-roots", +] + +[[package]] +name = "rustls-native-certs" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fcff2dd52b58a8d98a70243663a0d234c4e2b79235637849d15913394a247d3" +dependencies = [ + "openssl-probe", + "rustls-pki-types", + "schannel", + "security-framework 3.2.0", +] + +[[package]] +name = "rustls-pemfile" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "rustls-pki-types" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "917ce264624a4b4db1c364dcc35bfca9ded014d0a958cd47ad3e960e988ea51c" + +[[package]] +name = "rustls-webpki" +version = "0.103.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0aa4eeac2588ffff23e9d7a7e9b3f971c5fb5b7ebc9452745e0c232c64f83b2f" +dependencies = [ + "aws-lc-rs", + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "ryu" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" + +[[package]] +name = "salsa20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" +dependencies = [ + "cipher", +] + +[[package]] +name = "schannel" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "scrypt" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0516a385866c09368f0b5bcd1caff3366aace790fcd46e2bb032697bb172fd1f" +dependencies = [ + "pbkdf2", + "salsa20", + "sha2", +] + +[[package]] +name = "security-framework" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +dependencies = [ + "bitflags", + "core-foundation 0.9.4", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271720403f46ca04f7ba6f55d438f8bd878d6b8ca0a1046e8228c4145bcbb316" +dependencies = [ + "bitflags", + "core-foundation 0.10.0", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "serde" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.140" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "smallvec" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd" + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tcp-stream" +version = "0.30.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0217559d8c5a883d66838180671a74007e785689364ebe9627d517af936eaa9" +dependencies = [ + "cfg-if", + "native-tls", + "openssl", + "p12-keystore", + "rustls-connector", + "rustls-pemfile", +] + +[[package]] +name = "tempfile" +version = "3.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488960f40a3fd53d72c2a29a58722561dee8afdd175bd88e3db4677d7b2ba600" +dependencies = [ + "fastrand", + "getrandom 0.3.1", + "once_cell", + "rustix 1.0.2", + "windows-sys 0.59.0", +] + +[[package]] +name = "thiserror" +version = "2.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "time" +version = "0.3.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dad298b01a40a23aac4580b67e3dbedb7cc8402f3592d7f49469de2ea4aecdd8" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "765c97a5b985b7c11d7bc27fa927dc4fe6af3a6dfb021d28deb60d3bf51e76ef" + +[[package]] +name = "time-macros" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8093bc3e81c3bc5f7879de09619d06c9a5a5e45ca44dfeeb7225bae38005c5c" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tinystr" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tracing" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" + +[[package]] +name = "typenum" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" + +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + +[[package]] +name = "unicode-ident" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasi" +version = "0.13.3+wasi-0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26816d2e1a4a36a2940b96c5296ce403917633dff8f3440e9b236ed6f6bacad2" +dependencies = [ + "wit-bindgen-rt", +] + +[[package]] +name = "webpki-roots" +version = "0.26.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2210b291f7ea53617fbafcc4939f10914214ec15aace5ba62293a668f322c5c9" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "which" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +dependencies = [ + "either", + "home", + "once_cell", + "rustix 0.38.44", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "wit-bindgen-rt" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c" +dependencies = [ + "bitflags", +] + +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + +[[package]] +name = "x509-cert" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1301e935010a701ae5f8655edc0ad17c44bad3ac5ce8c39185f75453b720ae94" +dependencies = [ + "const-oid", + "der", + "spki", +] + +[[package]] +name = "x509-parser" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4569f339c0c402346d4a75a9e39cf8dad310e287eef1ff56d4c68e5067f53460" +dependencies = [ + "asn1-rs", + "data-encoding", + "der-parser", + "lazy_static", + "nom 7.1.3", + "oid-registry", + "rusticata-macros", + "thiserror", + "time", +] + +[[package]] +name = "yoke" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd97444d05a4328b90e75e503a34bad781f14e28a823ad3557f0750df1ebcbc6" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6352c01d0edd5db859a63e2605f4ea3183ddbd15e2c4a9e7d32184df75e4f154" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zerofrom" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" + +[[package]] +name = "zerovec" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index e8b856f2..35af0e14 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -34,7 +34,7 @@ version = "=8.1.0" path = "../uri" [dependencies.tcp-stream] -version = "^0.30" +version = "^0.30.1" default-features = false [dependencies.tracing] From 86aaafad953203ea52db2f19dfd846d1c58fb057 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> Date: Mon, 17 Mar 2025 19:47:18 +0100 Subject: [PATCH 133/133] v8.1.1 --- Cargo.lock | 10 +++++----- codegen/Cargo.toml | 4 ++-- protocol/Cargo.toml | 10 +++++----- tcp/Cargo.toml | 4 ++-- types/Cargo.toml | 2 +- uri/Cargo.toml | 4 ++-- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5190cfee..2e5cf9fd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -24,7 +24,7 @@ dependencies = [ [[package]] name = "amq-protocol" -version = "8.1.0" +version = "8.1.1" dependencies = [ "amq-protocol-codegen", "amq-protocol-tcp", @@ -37,7 +37,7 @@ dependencies = [ [[package]] name = "amq-protocol-codegen" -version = "8.1.0" +version = "8.1.1" dependencies = [ "amq-protocol-types", "handlebars", @@ -47,7 +47,7 @@ dependencies = [ [[package]] name = "amq-protocol-tcp" -version = "8.1.0" +version = "8.1.1" dependencies = [ "amq-protocol-uri", "tcp-stream", @@ -56,7 +56,7 @@ dependencies = [ [[package]] name = "amq-protocol-types" -version = "8.1.0" +version = "8.1.1" dependencies = [ "cookie-factory", "nom 8.0.0", @@ -66,7 +66,7 @@ dependencies = [ [[package]] name = "amq-protocol-uri" -version = "8.1.0" +version = "8.1.1" dependencies = [ "amq-protocol-types", "percent-encoding", diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index b2979607..bfb6cd91 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-codegen" -version = "8.1.0" +version = "8.1.1" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - codegen" @@ -19,7 +19,7 @@ handlebars = "^6.0" serde_json = "^1.0" [dependencies.amq-protocol-types] -version = "=8.1.0" +version = "=8.1.1" path = "../types" [dependencies.serde] diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index 60157524..ec14a90d 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol" -version = "8.1.0" +version = "8.1.1" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications" @@ -33,21 +33,21 @@ rustls--aws_lc_rs = ["amq-protocol-tcp/rustls--aws_lc_rs"] # default, bu rustls--ring = ["amq-protocol-tcp/rustls--ring"] # more compatible, (e.g., easily builds on Windows) [build-dependencies.amq-protocol-codegen] -version = "=8.1.0" +version = "=8.1.1" path = "../codegen" optional = true [dependencies.amq-protocol-tcp] -version = "=8.1.0" +version = "=8.1.1" default-features = false path = "../tcp" [dependencies.amq-protocol-types] -version = "=8.1.0" +version = "=8.1.1" path = "../types" [dependencies.amq-protocol-uri] -version = "=8.1.0" +version = "=8.1.1" path = "../uri" [dependencies.cookie-factory] diff --git a/tcp/Cargo.toml b/tcp/Cargo.toml index 35af0e14..0730f05d 100644 --- a/tcp/Cargo.toml +++ b/tcp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-tcp" -version = "8.1.0" +version = "8.1.1" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI TCP connection handling" @@ -30,7 +30,7 @@ rustls--aws_lc_rs = ["tcp-stream/rustls--aws_lc_rs"] # default, but does rustls--ring = ["tcp-stream/rustls--ring"] # more compatible, (e.g., easily builds on Windows) [dependencies.amq-protocol-uri] -version = "=8.1.0" +version = "=8.1.1" path = "../uri" [dependencies.tcp-stream] diff --git a/types/Cargo.toml b/types/Cargo.toml index 0685dbea..a274234c 100644 --- a/types/Cargo.toml +++ b/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-types" -version = "8.1.0" +version = "8.1.1" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP specifications - types" diff --git a/uri/Cargo.toml b/uri/Cargo.toml index d6b2cd7f..1c86b120 100644 --- a/uri/Cargo.toml +++ b/uri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "amq-protocol-uri" -version = "8.1.0" +version = "8.1.1" edition = "2021" authors = ["Marc-Antoine Perennou <%arc-Antoine@Perennou.com>"] description = "AMQP URI manipulation" @@ -15,7 +15,7 @@ rust-version = "1.81.0" name = "amq_protocol_uri" [dependencies.amq-protocol-types] -version = "=8.1.0" +version = "=8.1.1" path = "../types" [dependencies]