mirror of
https://github.com/Noratrieb/haesli.git
synced 2026-01-16 04:35:03 +01:00
write completed (hopoefully)
This commit is contained in:
parent
427cfadc11
commit
2aeb588ab3
5 changed files with 117 additions and 113 deletions
|
|
@ -5,6 +5,7 @@ use crate::parser::codegen_parser;
|
||||||
use crate::write::codegen_write;
|
use crate::write::codegen_write;
|
||||||
use heck::ToUpperCamelCase;
|
use heck::ToUpperCamelCase;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
|
use std::iter::Peekable;
|
||||||
use strong_xml::XmlRead;
|
use strong_xml::XmlRead;
|
||||||
|
|
||||||
#[derive(Debug, XmlRead)]
|
#[derive(Debug, XmlRead)]
|
||||||
|
|
@ -191,6 +192,27 @@ fn snake_case(ident: &str) -> String {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn subsequent_bit_fields<'a>(
|
||||||
|
amqp: &Amqp,
|
||||||
|
bit_field: &'a Field,
|
||||||
|
iter: &mut Peekable<impl Iterator<Item = &'a Field>>,
|
||||||
|
) -> Vec<&'a Field> {
|
||||||
|
let mut fields_with_bit = vec![bit_field];
|
||||||
|
|
||||||
|
loop {
|
||||||
|
if iter
|
||||||
|
.peek()
|
||||||
|
.map(|f| resolve_type_from_domain(amqp, field_type(f)) == "bit")
|
||||||
|
.unwrap_or(false)
|
||||||
|
{
|
||||||
|
fields_with_bit.push(iter.next().unwrap());
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fields_with_bit
|
||||||
|
}
|
||||||
|
|
||||||
fn invariants<'a>(asserts: impl Iterator<Item = &'a Assert>) -> String {
|
fn invariants<'a>(asserts: impl Iterator<Item = &'a Assert>) -> String {
|
||||||
asserts
|
asserts
|
||||||
.map(|assert| match &*assert.check {
|
.map(|assert| match &*assert.check {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
field_type, resolve_type_from_domain, snake_case, Amqp, Assert, Class, Domain, Method,
|
field_type, resolve_type_from_domain, snake_case, subsequent_bit_fields, Amqp, Assert, Class,
|
||||||
|
Domain, Method,
|
||||||
};
|
};
|
||||||
use heck::{ToSnakeCase, ToUpperCamelCase};
|
use heck::{ToSnakeCase, ToUpperCamelCase};
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
|
|
@ -99,19 +100,7 @@ fn method_parser(amqp: &Amqp, class: &Class, method: &Method) {
|
||||||
let type_name = resolve_type_from_domain(amqp, field_type(field));
|
let type_name = resolve_type_from_domain(amqp, field_type(field));
|
||||||
|
|
||||||
if type_name == "bit" {
|
if type_name == "bit" {
|
||||||
let mut fields_with_bit = vec![field];
|
let fields_with_bit = subsequent_bit_fields(amqp, field, &mut iter);
|
||||||
|
|
||||||
loop {
|
|
||||||
if iter
|
|
||||||
.peek()
|
|
||||||
.map(|f| resolve_type_from_domain(amqp, field_type(f)) == "bit")
|
|
||||||
.unwrap_or(false)
|
|
||||||
{
|
|
||||||
fields_with_bit.push(iter.next().unwrap());
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let amount = fields_with_bit.len();
|
let amount = fields_with_bit.len();
|
||||||
println!(" let (input, bits) = bit(input, {amount})?;");
|
println!(" let (input, bits) = bit(input, {amount})?;");
|
||||||
|
|
@ -132,7 +121,7 @@ fn method_parser(amqp: &Amqp, class: &Class, method: &Method) {
|
||||||
}
|
}
|
||||||
let class_name = class_name.to_upper_camel_case();
|
let class_name = class_name.to_upper_camel_case();
|
||||||
let method_name = method.name.to_upper_camel_case();
|
let method_name = method.name.to_upper_camel_case();
|
||||||
println!(" Ok((input, Class::{class_name}({class_name}::{method_name} {{");
|
println!(" Ok((input, Class::{class_name}({class_name}::{method_name} {{");
|
||||||
for field in &method.fields {
|
for field in &method.fields {
|
||||||
let field_name = snake_case(&field.name);
|
let field_name = snake_case(&field.name);
|
||||||
println!(" {field_name},");
|
println!(" {field_name},");
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::{field_type, resolve_type_from_domain, snake_case, Amqp};
|
use crate::{field_type, resolve_type_from_domain, snake_case, subsequent_bit_fields, Amqp};
|
||||||
use heck::ToUpperCamelCase;
|
use heck::ToUpperCamelCase;
|
||||||
|
|
||||||
pub(crate) fn codegen_write(amqp: &Amqp) {
|
pub(crate) fn codegen_write(amqp: &Amqp) {
|
||||||
|
|
@ -26,13 +26,21 @@ pub fn write_method<W: Write>(class: Class, mut writer: W) -> Result<(), TransEr
|
||||||
}
|
}
|
||||||
println!(" }}) => {{");
|
println!(" }}) => {{");
|
||||||
println!(" writer.write_all(&[{class_index}, {method_index}])?;");
|
println!(" writer.write_all(&[{class_index}, {method_index}])?;");
|
||||||
for field in &method.fields {
|
let mut iter = method.fields.iter().peekable();
|
||||||
|
|
||||||
|
while let Some(field) = iter.next() {
|
||||||
let field_name = snake_case(&field.name);
|
let field_name = snake_case(&field.name);
|
||||||
let field_type = resolve_type_from_domain(amqp, field_type(field));
|
let type_name = resolve_type_from_domain(amqp, field_type(field));
|
||||||
if field_type == "bit" {
|
if type_name == "bit" {
|
||||||
println!(" todo!();");
|
let fields_with_bit = subsequent_bit_fields(amqp, field, &mut iter);
|
||||||
|
print!(" bit(&[");
|
||||||
|
for field in fields_with_bit {
|
||||||
|
let field_name = snake_case(&field.name);
|
||||||
|
print!("{field_name}, ");
|
||||||
|
}
|
||||||
|
println!("], &mut writer)?;");
|
||||||
} else {
|
} else {
|
||||||
println!(" {field_type}({field_name}, &mut writer)?;");
|
println!(" {type_name}({field_name}, &mut writer)?;");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
println!(" }}");
|
println!(" }}");
|
||||||
|
|
|
||||||
|
|
@ -468,7 +468,7 @@ fn connection_start(input: &[u8]) -> IResult<Class> {
|
||||||
if mechanisms.is_empty() { fail!() }
|
if mechanisms.is_empty() { fail!() }
|
||||||
let (input, locales) = domain_longstr(input)?;
|
let (input, locales) = domain_longstr(input)?;
|
||||||
if locales.is_empty() { fail!() }
|
if locales.is_empty() { fail!() }
|
||||||
Ok((input, Class::Connection(Connection::Start {
|
Ok((input, Class::Connection(Connection::Start {
|
||||||
version_major,
|
version_major,
|
||||||
version_minor,
|
version_minor,
|
||||||
server_properties,
|
server_properties,
|
||||||
|
|
@ -485,7 +485,7 @@ fn connection_start_ok(input: &[u8]) -> IResult<Class> {
|
||||||
if response.is_empty() { fail!() }
|
if response.is_empty() { fail!() }
|
||||||
let (input, locale) = domain_shortstr(input)?;
|
let (input, locale) = domain_shortstr(input)?;
|
||||||
if locale.is_empty() { fail!() }
|
if locale.is_empty() { fail!() }
|
||||||
Ok((input, Class::Connection(Connection::StartOk {
|
Ok((input, Class::Connection(Connection::StartOk {
|
||||||
client_properties,
|
client_properties,
|
||||||
mechanism,
|
mechanism,
|
||||||
response,
|
response,
|
||||||
|
|
@ -495,7 +495,7 @@ fn connection_start_ok(input: &[u8]) -> IResult<Class> {
|
||||||
fn connection_secure(input: &[u8]) -> IResult<Class> {
|
fn connection_secure(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, _) = tag([20])(input)?;
|
let (input, _) = tag([20])(input)?;
|
||||||
let (input, challenge) = domain_longstr(input)?;
|
let (input, challenge) = domain_longstr(input)?;
|
||||||
Ok((input, Class::Connection(Connection::Secure {
|
Ok((input, Class::Connection(Connection::Secure {
|
||||||
challenge,
|
challenge,
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
|
|
@ -503,7 +503,7 @@ fn connection_secure_ok(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, _) = tag([21])(input)?;
|
let (input, _) = tag([21])(input)?;
|
||||||
let (input, response) = domain_longstr(input)?;
|
let (input, response) = domain_longstr(input)?;
|
||||||
if response.is_empty() { fail!() }
|
if response.is_empty() { fail!() }
|
||||||
Ok((input, Class::Connection(Connection::SecureOk {
|
Ok((input, Class::Connection(Connection::SecureOk {
|
||||||
response,
|
response,
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
|
|
@ -512,7 +512,7 @@ fn connection_tune(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, channel_max) = domain_short(input)?;
|
let (input, channel_max) = domain_short(input)?;
|
||||||
let (input, frame_max) = domain_long(input)?;
|
let (input, frame_max) = domain_long(input)?;
|
||||||
let (input, heartbeat) = domain_short(input)?;
|
let (input, heartbeat) = domain_short(input)?;
|
||||||
Ok((input, Class::Connection(Connection::Tune {
|
Ok((input, Class::Connection(Connection::Tune {
|
||||||
channel_max,
|
channel_max,
|
||||||
frame_max,
|
frame_max,
|
||||||
heartbeat,
|
heartbeat,
|
||||||
|
|
@ -524,7 +524,7 @@ fn connection_tune_ok(input: &[u8]) -> IResult<Class> {
|
||||||
if channel_max == 0 { fail!() }
|
if channel_max == 0 { fail!() }
|
||||||
let (input, frame_max) = domain_long(input)?;
|
let (input, frame_max) = domain_long(input)?;
|
||||||
let (input, heartbeat) = domain_short(input)?;
|
let (input, heartbeat) = domain_short(input)?;
|
||||||
Ok((input, Class::Connection(Connection::TuneOk {
|
Ok((input, Class::Connection(Connection::TuneOk {
|
||||||
channel_max,
|
channel_max,
|
||||||
frame_max,
|
frame_max,
|
||||||
heartbeat,
|
heartbeat,
|
||||||
|
|
@ -536,7 +536,7 @@ fn connection_open(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, reserved_1) = domain_shortstr(input)?;
|
let (input, reserved_1) = domain_shortstr(input)?;
|
||||||
let (input, bits) = bit(input, 1)?;
|
let (input, bits) = bit(input, 1)?;
|
||||||
let reserved_2 = bits[0];
|
let reserved_2 = bits[0];
|
||||||
Ok((input, Class::Connection(Connection::Open {
|
Ok((input, Class::Connection(Connection::Open {
|
||||||
virtual_host,
|
virtual_host,
|
||||||
reserved_1,
|
reserved_1,
|
||||||
reserved_2,
|
reserved_2,
|
||||||
|
|
@ -545,7 +545,7 @@ fn connection_open(input: &[u8]) -> IResult<Class> {
|
||||||
fn connection_open_ok(input: &[u8]) -> IResult<Class> {
|
fn connection_open_ok(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, _) = tag([41])(input)?;
|
let (input, _) = tag([41])(input)?;
|
||||||
let (input, reserved_1) = domain_shortstr(input)?;
|
let (input, reserved_1) = domain_shortstr(input)?;
|
||||||
Ok((input, Class::Connection(Connection::OpenOk {
|
Ok((input, Class::Connection(Connection::OpenOk {
|
||||||
reserved_1,
|
reserved_1,
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
|
|
@ -555,7 +555,7 @@ fn connection_close(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, reply_text) = domain_reply_text(input)?;
|
let (input, reply_text) = domain_reply_text(input)?;
|
||||||
let (input, class_id) = domain_class_id(input)?;
|
let (input, class_id) = domain_class_id(input)?;
|
||||||
let (input, method_id) = domain_method_id(input)?;
|
let (input, method_id) = domain_method_id(input)?;
|
||||||
Ok((input, Class::Connection(Connection::Close {
|
Ok((input, Class::Connection(Connection::Close {
|
||||||
reply_code,
|
reply_code,
|
||||||
reply_text,
|
reply_text,
|
||||||
class_id,
|
class_id,
|
||||||
|
|
@ -564,19 +564,19 @@ fn connection_close(input: &[u8]) -> IResult<Class> {
|
||||||
}
|
}
|
||||||
fn connection_close_ok(input: &[u8]) -> IResult<Class> {
|
fn connection_close_ok(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, _) = tag([51])(input)?;
|
let (input, _) = tag([51])(input)?;
|
||||||
Ok((input, Class::Connection(Connection::CloseOk {
|
Ok((input, Class::Connection(Connection::CloseOk {
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
fn connection_blocked(input: &[u8]) -> IResult<Class> {
|
fn connection_blocked(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, _) = tag([60])(input)?;
|
let (input, _) = tag([60])(input)?;
|
||||||
let (input, reason) = domain_shortstr(input)?;
|
let (input, reason) = domain_shortstr(input)?;
|
||||||
Ok((input, Class::Connection(Connection::Blocked {
|
Ok((input, Class::Connection(Connection::Blocked {
|
||||||
reason,
|
reason,
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
fn connection_unblocked(input: &[u8]) -> IResult<Class> {
|
fn connection_unblocked(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, _) = tag([61])(input)?;
|
let (input, _) = tag([61])(input)?;
|
||||||
Ok((input, Class::Connection(Connection::Unblocked {
|
Ok((input, Class::Connection(Connection::Unblocked {
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
fn channel(input: &[u8]) -> IResult<Class> {
|
fn channel(input: &[u8]) -> IResult<Class> {
|
||||||
|
|
@ -586,14 +586,14 @@ fn channel(input: &[u8]) -> IResult<Class> {
|
||||||
fn channel_open(input: &[u8]) -> IResult<Class> {
|
fn channel_open(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, _) = tag([10])(input)?;
|
let (input, _) = tag([10])(input)?;
|
||||||
let (input, reserved_1) = domain_shortstr(input)?;
|
let (input, reserved_1) = domain_shortstr(input)?;
|
||||||
Ok((input, Class::Channel(Channel::Open {
|
Ok((input, Class::Channel(Channel::Open {
|
||||||
reserved_1,
|
reserved_1,
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
fn channel_open_ok(input: &[u8]) -> IResult<Class> {
|
fn channel_open_ok(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, _) = tag([11])(input)?;
|
let (input, _) = tag([11])(input)?;
|
||||||
let (input, reserved_1) = domain_longstr(input)?;
|
let (input, reserved_1) = domain_longstr(input)?;
|
||||||
Ok((input, Class::Channel(Channel::OpenOk {
|
Ok((input, Class::Channel(Channel::OpenOk {
|
||||||
reserved_1,
|
reserved_1,
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
|
|
@ -601,7 +601,7 @@ fn channel_flow(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, _) = tag([20])(input)?;
|
let (input, _) = tag([20])(input)?;
|
||||||
let (input, bits) = bit(input, 1)?;
|
let (input, bits) = bit(input, 1)?;
|
||||||
let active = bits[0];
|
let active = bits[0];
|
||||||
Ok((input, Class::Channel(Channel::Flow {
|
Ok((input, Class::Channel(Channel::Flow {
|
||||||
active,
|
active,
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
|
|
@ -609,7 +609,7 @@ fn channel_flow_ok(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, _) = tag([21])(input)?;
|
let (input, _) = tag([21])(input)?;
|
||||||
let (input, bits) = bit(input, 1)?;
|
let (input, bits) = bit(input, 1)?;
|
||||||
let active = bits[0];
|
let active = bits[0];
|
||||||
Ok((input, Class::Channel(Channel::FlowOk {
|
Ok((input, Class::Channel(Channel::FlowOk {
|
||||||
active,
|
active,
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
|
|
@ -619,7 +619,7 @@ fn channel_close(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, reply_text) = domain_reply_text(input)?;
|
let (input, reply_text) = domain_reply_text(input)?;
|
||||||
let (input, class_id) = domain_class_id(input)?;
|
let (input, class_id) = domain_class_id(input)?;
|
||||||
let (input, method_id) = domain_method_id(input)?;
|
let (input, method_id) = domain_method_id(input)?;
|
||||||
Ok((input, Class::Channel(Channel::Close {
|
Ok((input, Class::Channel(Channel::Close {
|
||||||
reply_code,
|
reply_code,
|
||||||
reply_text,
|
reply_text,
|
||||||
class_id,
|
class_id,
|
||||||
|
|
@ -628,7 +628,7 @@ fn channel_close(input: &[u8]) -> IResult<Class> {
|
||||||
}
|
}
|
||||||
fn channel_close_ok(input: &[u8]) -> IResult<Class> {
|
fn channel_close_ok(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, _) = tag([41])(input)?;
|
let (input, _) = tag([41])(input)?;
|
||||||
Ok((input, Class::Channel(Channel::CloseOk {
|
Ok((input, Class::Channel(Channel::CloseOk {
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
fn exchange(input: &[u8]) -> IResult<Class> {
|
fn exchange(input: &[u8]) -> IResult<Class> {
|
||||||
|
|
@ -648,7 +648,7 @@ fn exchange_declare(input: &[u8]) -> IResult<Class> {
|
||||||
let reserved_3 = bits[3];
|
let reserved_3 = bits[3];
|
||||||
let no_wait = bits[4];
|
let no_wait = bits[4];
|
||||||
let (input, arguments) = domain_table(input)?;
|
let (input, arguments) = domain_table(input)?;
|
||||||
Ok((input, Class::Exchange(Exchange::Declare {
|
Ok((input, Class::Exchange(Exchange::Declare {
|
||||||
reserved_1,
|
reserved_1,
|
||||||
exchange,
|
exchange,
|
||||||
r#type,
|
r#type,
|
||||||
|
|
@ -662,7 +662,7 @@ fn exchange_declare(input: &[u8]) -> IResult<Class> {
|
||||||
}
|
}
|
||||||
fn exchange_declare_ok(input: &[u8]) -> IResult<Class> {
|
fn exchange_declare_ok(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, _) = tag([11])(input)?;
|
let (input, _) = tag([11])(input)?;
|
||||||
Ok((input, Class::Exchange(Exchange::DeclareOk {
|
Ok((input, Class::Exchange(Exchange::DeclareOk {
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
fn exchange_delete(input: &[u8]) -> IResult<Class> {
|
fn exchange_delete(input: &[u8]) -> IResult<Class> {
|
||||||
|
|
@ -673,7 +673,7 @@ fn exchange_delete(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, bits) = bit(input, 2)?;
|
let (input, bits) = bit(input, 2)?;
|
||||||
let if_unused = bits[0];
|
let if_unused = bits[0];
|
||||||
let no_wait = bits[1];
|
let no_wait = bits[1];
|
||||||
Ok((input, Class::Exchange(Exchange::Delete {
|
Ok((input, Class::Exchange(Exchange::Delete {
|
||||||
reserved_1,
|
reserved_1,
|
||||||
exchange,
|
exchange,
|
||||||
if_unused,
|
if_unused,
|
||||||
|
|
@ -682,7 +682,7 @@ fn exchange_delete(input: &[u8]) -> IResult<Class> {
|
||||||
}
|
}
|
||||||
fn exchange_delete_ok(input: &[u8]) -> IResult<Class> {
|
fn exchange_delete_ok(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, _) = tag([21])(input)?;
|
let (input, _) = tag([21])(input)?;
|
||||||
Ok((input, Class::Exchange(Exchange::DeleteOk {
|
Ok((input, Class::Exchange(Exchange::DeleteOk {
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
fn queue(input: &[u8]) -> IResult<Class> {
|
fn queue(input: &[u8]) -> IResult<Class> {
|
||||||
|
|
@ -700,7 +700,7 @@ fn queue_declare(input: &[u8]) -> IResult<Class> {
|
||||||
let auto_delete = bits[3];
|
let auto_delete = bits[3];
|
||||||
let no_wait = bits[4];
|
let no_wait = bits[4];
|
||||||
let (input, arguments) = domain_table(input)?;
|
let (input, arguments) = domain_table(input)?;
|
||||||
Ok((input, Class::Queue(Queue::Declare {
|
Ok((input, Class::Queue(Queue::Declare {
|
||||||
reserved_1,
|
reserved_1,
|
||||||
queue,
|
queue,
|
||||||
passive,
|
passive,
|
||||||
|
|
@ -717,7 +717,7 @@ fn queue_declare_ok(input: &[u8]) -> IResult<Class> {
|
||||||
if queue.is_empty() { fail!() }
|
if queue.is_empty() { fail!() }
|
||||||
let (input, message_count) = domain_message_count(input)?;
|
let (input, message_count) = domain_message_count(input)?;
|
||||||
let (input, consumer_count) = domain_long(input)?;
|
let (input, consumer_count) = domain_long(input)?;
|
||||||
Ok((input, Class::Queue(Queue::DeclareOk {
|
Ok((input, Class::Queue(Queue::DeclareOk {
|
||||||
queue,
|
queue,
|
||||||
message_count,
|
message_count,
|
||||||
consumer_count,
|
consumer_count,
|
||||||
|
|
@ -732,7 +732,7 @@ fn queue_bind(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, bits) = bit(input, 1)?;
|
let (input, bits) = bit(input, 1)?;
|
||||||
let no_wait = bits[0];
|
let no_wait = bits[0];
|
||||||
let (input, arguments) = domain_table(input)?;
|
let (input, arguments) = domain_table(input)?;
|
||||||
Ok((input, Class::Queue(Queue::Bind {
|
Ok((input, Class::Queue(Queue::Bind {
|
||||||
reserved_1,
|
reserved_1,
|
||||||
queue,
|
queue,
|
||||||
exchange,
|
exchange,
|
||||||
|
|
@ -743,7 +743,7 @@ fn queue_bind(input: &[u8]) -> IResult<Class> {
|
||||||
}
|
}
|
||||||
fn queue_bind_ok(input: &[u8]) -> IResult<Class> {
|
fn queue_bind_ok(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, _) = tag([21])(input)?;
|
let (input, _) = tag([21])(input)?;
|
||||||
Ok((input, Class::Queue(Queue::BindOk {
|
Ok((input, Class::Queue(Queue::BindOk {
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
fn queue_unbind(input: &[u8]) -> IResult<Class> {
|
fn queue_unbind(input: &[u8]) -> IResult<Class> {
|
||||||
|
|
@ -753,7 +753,7 @@ fn queue_unbind(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, exchange) = domain_exchange_name(input)?;
|
let (input, exchange) = domain_exchange_name(input)?;
|
||||||
let (input, routing_key) = domain_shortstr(input)?;
|
let (input, routing_key) = domain_shortstr(input)?;
|
||||||
let (input, arguments) = domain_table(input)?;
|
let (input, arguments) = domain_table(input)?;
|
||||||
Ok((input, Class::Queue(Queue::Unbind {
|
Ok((input, Class::Queue(Queue::Unbind {
|
||||||
reserved_1,
|
reserved_1,
|
||||||
queue,
|
queue,
|
||||||
exchange,
|
exchange,
|
||||||
|
|
@ -763,7 +763,7 @@ fn queue_unbind(input: &[u8]) -> IResult<Class> {
|
||||||
}
|
}
|
||||||
fn queue_unbind_ok(input: &[u8]) -> IResult<Class> {
|
fn queue_unbind_ok(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, _) = tag([51])(input)?;
|
let (input, _) = tag([51])(input)?;
|
||||||
Ok((input, Class::Queue(Queue::UnbindOk {
|
Ok((input, Class::Queue(Queue::UnbindOk {
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
fn queue_purge(input: &[u8]) -> IResult<Class> {
|
fn queue_purge(input: &[u8]) -> IResult<Class> {
|
||||||
|
|
@ -772,7 +772,7 @@ fn queue_purge(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, queue) = domain_queue_name(input)?;
|
let (input, queue) = domain_queue_name(input)?;
|
||||||
let (input, bits) = bit(input, 1)?;
|
let (input, bits) = bit(input, 1)?;
|
||||||
let no_wait = bits[0];
|
let no_wait = bits[0];
|
||||||
Ok((input, Class::Queue(Queue::Purge {
|
Ok((input, Class::Queue(Queue::Purge {
|
||||||
reserved_1,
|
reserved_1,
|
||||||
queue,
|
queue,
|
||||||
no_wait,
|
no_wait,
|
||||||
|
|
@ -781,7 +781,7 @@ fn queue_purge(input: &[u8]) -> IResult<Class> {
|
||||||
fn queue_purge_ok(input: &[u8]) -> IResult<Class> {
|
fn queue_purge_ok(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, _) = tag([31])(input)?;
|
let (input, _) = tag([31])(input)?;
|
||||||
let (input, message_count) = domain_message_count(input)?;
|
let (input, message_count) = domain_message_count(input)?;
|
||||||
Ok((input, Class::Queue(Queue::PurgeOk {
|
Ok((input, Class::Queue(Queue::PurgeOk {
|
||||||
message_count,
|
message_count,
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
|
|
@ -793,7 +793,7 @@ fn queue_delete(input: &[u8]) -> IResult<Class> {
|
||||||
let if_unused = bits[0];
|
let if_unused = bits[0];
|
||||||
let if_empty = bits[1];
|
let if_empty = bits[1];
|
||||||
let no_wait = bits[2];
|
let no_wait = bits[2];
|
||||||
Ok((input, Class::Queue(Queue::Delete {
|
Ok((input, Class::Queue(Queue::Delete {
|
||||||
reserved_1,
|
reserved_1,
|
||||||
queue,
|
queue,
|
||||||
if_unused,
|
if_unused,
|
||||||
|
|
@ -804,7 +804,7 @@ fn queue_delete(input: &[u8]) -> IResult<Class> {
|
||||||
fn queue_delete_ok(input: &[u8]) -> IResult<Class> {
|
fn queue_delete_ok(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, _) = tag([41])(input)?;
|
let (input, _) = tag([41])(input)?;
|
||||||
let (input, message_count) = domain_message_count(input)?;
|
let (input, message_count) = domain_message_count(input)?;
|
||||||
Ok((input, Class::Queue(Queue::DeleteOk {
|
Ok((input, Class::Queue(Queue::DeleteOk {
|
||||||
message_count,
|
message_count,
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
|
|
@ -818,7 +818,7 @@ fn basic_qos(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, prefetch_count) = domain_short(input)?;
|
let (input, prefetch_count) = domain_short(input)?;
|
||||||
let (input, bits) = bit(input, 1)?;
|
let (input, bits) = bit(input, 1)?;
|
||||||
let global = bits[0];
|
let global = bits[0];
|
||||||
Ok((input, Class::Basic(Basic::Qos {
|
Ok((input, Class::Basic(Basic::Qos {
|
||||||
prefetch_size,
|
prefetch_size,
|
||||||
prefetch_count,
|
prefetch_count,
|
||||||
global,
|
global,
|
||||||
|
|
@ -826,7 +826,7 @@ fn basic_qos(input: &[u8]) -> IResult<Class> {
|
||||||
}
|
}
|
||||||
fn basic_qos_ok(input: &[u8]) -> IResult<Class> {
|
fn basic_qos_ok(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, _) = tag([11])(input)?;
|
let (input, _) = tag([11])(input)?;
|
||||||
Ok((input, Class::Basic(Basic::QosOk {
|
Ok((input, Class::Basic(Basic::QosOk {
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
fn basic_consume(input: &[u8]) -> IResult<Class> {
|
fn basic_consume(input: &[u8]) -> IResult<Class> {
|
||||||
|
|
@ -840,7 +840,7 @@ fn basic_consume(input: &[u8]) -> IResult<Class> {
|
||||||
let exclusive = bits[2];
|
let exclusive = bits[2];
|
||||||
let no_wait = bits[3];
|
let no_wait = bits[3];
|
||||||
let (input, arguments) = domain_table(input)?;
|
let (input, arguments) = domain_table(input)?;
|
||||||
Ok((input, Class::Basic(Basic::Consume {
|
Ok((input, Class::Basic(Basic::Consume {
|
||||||
reserved_1,
|
reserved_1,
|
||||||
queue,
|
queue,
|
||||||
consumer_tag,
|
consumer_tag,
|
||||||
|
|
@ -854,7 +854,7 @@ fn basic_consume(input: &[u8]) -> IResult<Class> {
|
||||||
fn basic_consume_ok(input: &[u8]) -> IResult<Class> {
|
fn basic_consume_ok(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, _) = tag([21])(input)?;
|
let (input, _) = tag([21])(input)?;
|
||||||
let (input, consumer_tag) = domain_consumer_tag(input)?;
|
let (input, consumer_tag) = domain_consumer_tag(input)?;
|
||||||
Ok((input, Class::Basic(Basic::ConsumeOk {
|
Ok((input, Class::Basic(Basic::ConsumeOk {
|
||||||
consumer_tag,
|
consumer_tag,
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
|
|
@ -863,7 +863,7 @@ fn basic_cancel(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, consumer_tag) = domain_consumer_tag(input)?;
|
let (input, consumer_tag) = domain_consumer_tag(input)?;
|
||||||
let (input, bits) = bit(input, 1)?;
|
let (input, bits) = bit(input, 1)?;
|
||||||
let no_wait = bits[0];
|
let no_wait = bits[0];
|
||||||
Ok((input, Class::Basic(Basic::Cancel {
|
Ok((input, Class::Basic(Basic::Cancel {
|
||||||
consumer_tag,
|
consumer_tag,
|
||||||
no_wait,
|
no_wait,
|
||||||
})))
|
})))
|
||||||
|
|
@ -871,7 +871,7 @@ fn basic_cancel(input: &[u8]) -> IResult<Class> {
|
||||||
fn basic_cancel_ok(input: &[u8]) -> IResult<Class> {
|
fn basic_cancel_ok(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, _) = tag([31])(input)?;
|
let (input, _) = tag([31])(input)?;
|
||||||
let (input, consumer_tag) = domain_consumer_tag(input)?;
|
let (input, consumer_tag) = domain_consumer_tag(input)?;
|
||||||
Ok((input, Class::Basic(Basic::CancelOk {
|
Ok((input, Class::Basic(Basic::CancelOk {
|
||||||
consumer_tag,
|
consumer_tag,
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
|
|
@ -883,7 +883,7 @@ fn basic_publish(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, bits) = bit(input, 2)?;
|
let (input, bits) = bit(input, 2)?;
|
||||||
let mandatory = bits[0];
|
let mandatory = bits[0];
|
||||||
let immediate = bits[1];
|
let immediate = bits[1];
|
||||||
Ok((input, Class::Basic(Basic::Publish {
|
Ok((input, Class::Basic(Basic::Publish {
|
||||||
reserved_1,
|
reserved_1,
|
||||||
exchange,
|
exchange,
|
||||||
routing_key,
|
routing_key,
|
||||||
|
|
@ -897,7 +897,7 @@ fn basic_return(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, reply_text) = domain_reply_text(input)?;
|
let (input, reply_text) = domain_reply_text(input)?;
|
||||||
let (input, exchange) = domain_exchange_name(input)?;
|
let (input, exchange) = domain_exchange_name(input)?;
|
||||||
let (input, routing_key) = domain_shortstr(input)?;
|
let (input, routing_key) = domain_shortstr(input)?;
|
||||||
Ok((input, Class::Basic(Basic::Return {
|
Ok((input, Class::Basic(Basic::Return {
|
||||||
reply_code,
|
reply_code,
|
||||||
reply_text,
|
reply_text,
|
||||||
exchange,
|
exchange,
|
||||||
|
|
@ -912,7 +912,7 @@ fn basic_deliver(input: &[u8]) -> IResult<Class> {
|
||||||
let redelivered = bits[0];
|
let redelivered = bits[0];
|
||||||
let (input, exchange) = domain_exchange_name(input)?;
|
let (input, exchange) = domain_exchange_name(input)?;
|
||||||
let (input, routing_key) = domain_shortstr(input)?;
|
let (input, routing_key) = domain_shortstr(input)?;
|
||||||
Ok((input, Class::Basic(Basic::Deliver {
|
Ok((input, Class::Basic(Basic::Deliver {
|
||||||
consumer_tag,
|
consumer_tag,
|
||||||
delivery_tag,
|
delivery_tag,
|
||||||
redelivered,
|
redelivered,
|
||||||
|
|
@ -926,7 +926,7 @@ fn basic_get(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, queue) = domain_queue_name(input)?;
|
let (input, queue) = domain_queue_name(input)?;
|
||||||
let (input, bits) = bit(input, 1)?;
|
let (input, bits) = bit(input, 1)?;
|
||||||
let no_ack = bits[0];
|
let no_ack = bits[0];
|
||||||
Ok((input, Class::Basic(Basic::Get {
|
Ok((input, Class::Basic(Basic::Get {
|
||||||
reserved_1,
|
reserved_1,
|
||||||
queue,
|
queue,
|
||||||
no_ack,
|
no_ack,
|
||||||
|
|
@ -940,7 +940,7 @@ fn basic_get_ok(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, exchange) = domain_exchange_name(input)?;
|
let (input, exchange) = domain_exchange_name(input)?;
|
||||||
let (input, routing_key) = domain_shortstr(input)?;
|
let (input, routing_key) = domain_shortstr(input)?;
|
||||||
let (input, message_count) = domain_message_count(input)?;
|
let (input, message_count) = domain_message_count(input)?;
|
||||||
Ok((input, Class::Basic(Basic::GetOk {
|
Ok((input, Class::Basic(Basic::GetOk {
|
||||||
delivery_tag,
|
delivery_tag,
|
||||||
redelivered,
|
redelivered,
|
||||||
exchange,
|
exchange,
|
||||||
|
|
@ -951,7 +951,7 @@ fn basic_get_ok(input: &[u8]) -> IResult<Class> {
|
||||||
fn basic_get_empty(input: &[u8]) -> IResult<Class> {
|
fn basic_get_empty(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, _) = tag([72])(input)?;
|
let (input, _) = tag([72])(input)?;
|
||||||
let (input, reserved_1) = domain_shortstr(input)?;
|
let (input, reserved_1) = domain_shortstr(input)?;
|
||||||
Ok((input, Class::Basic(Basic::GetEmpty {
|
Ok((input, Class::Basic(Basic::GetEmpty {
|
||||||
reserved_1,
|
reserved_1,
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
|
|
@ -960,7 +960,7 @@ fn basic_ack(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, delivery_tag) = domain_delivery_tag(input)?;
|
let (input, delivery_tag) = domain_delivery_tag(input)?;
|
||||||
let (input, bits) = bit(input, 1)?;
|
let (input, bits) = bit(input, 1)?;
|
||||||
let multiple = bits[0];
|
let multiple = bits[0];
|
||||||
Ok((input, Class::Basic(Basic::Ack {
|
Ok((input, Class::Basic(Basic::Ack {
|
||||||
delivery_tag,
|
delivery_tag,
|
||||||
multiple,
|
multiple,
|
||||||
})))
|
})))
|
||||||
|
|
@ -970,7 +970,7 @@ fn basic_reject(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, delivery_tag) = domain_delivery_tag(input)?;
|
let (input, delivery_tag) = domain_delivery_tag(input)?;
|
||||||
let (input, bits) = bit(input, 1)?;
|
let (input, bits) = bit(input, 1)?;
|
||||||
let requeue = bits[0];
|
let requeue = bits[0];
|
||||||
Ok((input, Class::Basic(Basic::Reject {
|
Ok((input, Class::Basic(Basic::Reject {
|
||||||
delivery_tag,
|
delivery_tag,
|
||||||
requeue,
|
requeue,
|
||||||
})))
|
})))
|
||||||
|
|
@ -979,7 +979,7 @@ fn basic_recover_async(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, _) = tag([100])(input)?;
|
let (input, _) = tag([100])(input)?;
|
||||||
let (input, bits) = bit(input, 1)?;
|
let (input, bits) = bit(input, 1)?;
|
||||||
let requeue = bits[0];
|
let requeue = bits[0];
|
||||||
Ok((input, Class::Basic(Basic::RecoverAsync {
|
Ok((input, Class::Basic(Basic::RecoverAsync {
|
||||||
requeue,
|
requeue,
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
|
|
@ -987,13 +987,13 @@ fn basic_recover(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, _) = tag([110])(input)?;
|
let (input, _) = tag([110])(input)?;
|
||||||
let (input, bits) = bit(input, 1)?;
|
let (input, bits) = bit(input, 1)?;
|
||||||
let requeue = bits[0];
|
let requeue = bits[0];
|
||||||
Ok((input, Class::Basic(Basic::Recover {
|
Ok((input, Class::Basic(Basic::Recover {
|
||||||
requeue,
|
requeue,
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
fn basic_recover_ok(input: &[u8]) -> IResult<Class> {
|
fn basic_recover_ok(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, _) = tag([111])(input)?;
|
let (input, _) = tag([111])(input)?;
|
||||||
Ok((input, Class::Basic(Basic::RecoverOk {
|
Ok((input, Class::Basic(Basic::RecoverOk {
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
fn tx(input: &[u8]) -> IResult<Class> {
|
fn tx(input: &[u8]) -> IResult<Class> {
|
||||||
|
|
@ -1002,32 +1002,32 @@ fn tx(input: &[u8]) -> IResult<Class> {
|
||||||
}
|
}
|
||||||
fn tx_select(input: &[u8]) -> IResult<Class> {
|
fn tx_select(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, _) = tag([10])(input)?;
|
let (input, _) = tag([10])(input)?;
|
||||||
Ok((input, Class::Tx(Tx::Select {
|
Ok((input, Class::Tx(Tx::Select {
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
fn tx_select_ok(input: &[u8]) -> IResult<Class> {
|
fn tx_select_ok(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, _) = tag([11])(input)?;
|
let (input, _) = tag([11])(input)?;
|
||||||
Ok((input, Class::Tx(Tx::SelectOk {
|
Ok((input, Class::Tx(Tx::SelectOk {
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
fn tx_commit(input: &[u8]) -> IResult<Class> {
|
fn tx_commit(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, _) = tag([20])(input)?;
|
let (input, _) = tag([20])(input)?;
|
||||||
Ok((input, Class::Tx(Tx::Commit {
|
Ok((input, Class::Tx(Tx::Commit {
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
fn tx_commit_ok(input: &[u8]) -> IResult<Class> {
|
fn tx_commit_ok(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, _) = tag([21])(input)?;
|
let (input, _) = tag([21])(input)?;
|
||||||
Ok((input, Class::Tx(Tx::CommitOk {
|
Ok((input, Class::Tx(Tx::CommitOk {
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
fn tx_rollback(input: &[u8]) -> IResult<Class> {
|
fn tx_rollback(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, _) = tag([30])(input)?;
|
let (input, _) = tag([30])(input)?;
|
||||||
Ok((input, Class::Tx(Tx::Rollback {
|
Ok((input, Class::Tx(Tx::Rollback {
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
fn tx_rollback_ok(input: &[u8]) -> IResult<Class> {
|
fn tx_rollback_ok(input: &[u8]) -> IResult<Class> {
|
||||||
let (input, _) = tag([31])(input)?;
|
let (input, _) = tag([31])(input)?;
|
||||||
Ok((input, Class::Tx(Tx::RollbackOk {
|
Ok((input, Class::Tx(Tx::RollbackOk {
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1106,7 +1106,7 @@ pub fn write_method<W: Write>(class: Class, mut writer: W) -> Result<(), TransEr
|
||||||
writer.write_all(&[10, 40])?;
|
writer.write_all(&[10, 40])?;
|
||||||
shortstr(virtual_host, &mut writer)?;
|
shortstr(virtual_host, &mut writer)?;
|
||||||
shortstr(reserved_1, &mut writer)?;
|
shortstr(reserved_1, &mut writer)?;
|
||||||
todo!();
|
bit(&[reserved_2, ], &mut writer)?;
|
||||||
}
|
}
|
||||||
Class::Connection(Connection::OpenOk {
|
Class::Connection(Connection::OpenOk {
|
||||||
reserved_1,
|
reserved_1,
|
||||||
|
|
@ -1156,13 +1156,13 @@ pub fn write_method<W: Write>(class: Class, mut writer: W) -> Result<(), TransEr
|
||||||
active,
|
active,
|
||||||
}) => {
|
}) => {
|
||||||
writer.write_all(&[20, 20])?;
|
writer.write_all(&[20, 20])?;
|
||||||
todo!();
|
bit(&[active, ], &mut writer)?;
|
||||||
}
|
}
|
||||||
Class::Channel(Channel::FlowOk {
|
Class::Channel(Channel::FlowOk {
|
||||||
active,
|
active,
|
||||||
}) => {
|
}) => {
|
||||||
writer.write_all(&[20, 21])?;
|
writer.write_all(&[20, 21])?;
|
||||||
todo!();
|
bit(&[active, ], &mut writer)?;
|
||||||
}
|
}
|
||||||
Class::Channel(Channel::Close {
|
Class::Channel(Channel::Close {
|
||||||
reply_code,
|
reply_code,
|
||||||
|
|
@ -1195,11 +1195,7 @@ pub fn write_method<W: Write>(class: Class, mut writer: W) -> Result<(), TransEr
|
||||||
short(reserved_1, &mut writer)?;
|
short(reserved_1, &mut writer)?;
|
||||||
shortstr(exchange, &mut writer)?;
|
shortstr(exchange, &mut writer)?;
|
||||||
shortstr(r#type, &mut writer)?;
|
shortstr(r#type, &mut writer)?;
|
||||||
todo!();
|
bit(&[passive, durable, reserved_2, reserved_3, no_wait, ], &mut writer)?;
|
||||||
todo!();
|
|
||||||
todo!();
|
|
||||||
todo!();
|
|
||||||
todo!();
|
|
||||||
table(arguments, &mut writer)?;
|
table(arguments, &mut writer)?;
|
||||||
}
|
}
|
||||||
Class::Exchange(Exchange::DeclareOk {
|
Class::Exchange(Exchange::DeclareOk {
|
||||||
|
|
@ -1215,8 +1211,7 @@ pub fn write_method<W: Write>(class: Class, mut writer: W) -> Result<(), TransEr
|
||||||
writer.write_all(&[40, 20])?;
|
writer.write_all(&[40, 20])?;
|
||||||
short(reserved_1, &mut writer)?;
|
short(reserved_1, &mut writer)?;
|
||||||
shortstr(exchange, &mut writer)?;
|
shortstr(exchange, &mut writer)?;
|
||||||
todo!();
|
bit(&[if_unused, no_wait, ], &mut writer)?;
|
||||||
todo!();
|
|
||||||
}
|
}
|
||||||
Class::Exchange(Exchange::DeleteOk {
|
Class::Exchange(Exchange::DeleteOk {
|
||||||
}) => {
|
}) => {
|
||||||
|
|
@ -1235,11 +1230,7 @@ pub fn write_method<W: Write>(class: Class, mut writer: W) -> Result<(), TransEr
|
||||||
writer.write_all(&[50, 10])?;
|
writer.write_all(&[50, 10])?;
|
||||||
short(reserved_1, &mut writer)?;
|
short(reserved_1, &mut writer)?;
|
||||||
shortstr(queue, &mut writer)?;
|
shortstr(queue, &mut writer)?;
|
||||||
todo!();
|
bit(&[passive, durable, exclusive, auto_delete, no_wait, ], &mut writer)?;
|
||||||
todo!();
|
|
||||||
todo!();
|
|
||||||
todo!();
|
|
||||||
todo!();
|
|
||||||
table(arguments, &mut writer)?;
|
table(arguments, &mut writer)?;
|
||||||
}
|
}
|
||||||
Class::Queue(Queue::DeclareOk {
|
Class::Queue(Queue::DeclareOk {
|
||||||
|
|
@ -1265,7 +1256,7 @@ pub fn write_method<W: Write>(class: Class, mut writer: W) -> Result<(), TransEr
|
||||||
shortstr(queue, &mut writer)?;
|
shortstr(queue, &mut writer)?;
|
||||||
shortstr(exchange, &mut writer)?;
|
shortstr(exchange, &mut writer)?;
|
||||||
shortstr(routing_key, &mut writer)?;
|
shortstr(routing_key, &mut writer)?;
|
||||||
todo!();
|
bit(&[no_wait, ], &mut writer)?;
|
||||||
table(arguments, &mut writer)?;
|
table(arguments, &mut writer)?;
|
||||||
}
|
}
|
||||||
Class::Queue(Queue::BindOk {
|
Class::Queue(Queue::BindOk {
|
||||||
|
|
@ -1298,7 +1289,7 @@ pub fn write_method<W: Write>(class: Class, mut writer: W) -> Result<(), TransEr
|
||||||
writer.write_all(&[50, 30])?;
|
writer.write_all(&[50, 30])?;
|
||||||
short(reserved_1, &mut writer)?;
|
short(reserved_1, &mut writer)?;
|
||||||
shortstr(queue, &mut writer)?;
|
shortstr(queue, &mut writer)?;
|
||||||
todo!();
|
bit(&[no_wait, ], &mut writer)?;
|
||||||
}
|
}
|
||||||
Class::Queue(Queue::PurgeOk {
|
Class::Queue(Queue::PurgeOk {
|
||||||
message_count,
|
message_count,
|
||||||
|
|
@ -1316,9 +1307,7 @@ pub fn write_method<W: Write>(class: Class, mut writer: W) -> Result<(), TransEr
|
||||||
writer.write_all(&[50, 40])?;
|
writer.write_all(&[50, 40])?;
|
||||||
short(reserved_1, &mut writer)?;
|
short(reserved_1, &mut writer)?;
|
||||||
shortstr(queue, &mut writer)?;
|
shortstr(queue, &mut writer)?;
|
||||||
todo!();
|
bit(&[if_unused, if_empty, no_wait, ], &mut writer)?;
|
||||||
todo!();
|
|
||||||
todo!();
|
|
||||||
}
|
}
|
||||||
Class::Queue(Queue::DeleteOk {
|
Class::Queue(Queue::DeleteOk {
|
||||||
message_count,
|
message_count,
|
||||||
|
|
@ -1334,7 +1323,7 @@ pub fn write_method<W: Write>(class: Class, mut writer: W) -> Result<(), TransEr
|
||||||
writer.write_all(&[60, 10])?;
|
writer.write_all(&[60, 10])?;
|
||||||
long(prefetch_size, &mut writer)?;
|
long(prefetch_size, &mut writer)?;
|
||||||
short(prefetch_count, &mut writer)?;
|
short(prefetch_count, &mut writer)?;
|
||||||
todo!();
|
bit(&[global, ], &mut writer)?;
|
||||||
}
|
}
|
||||||
Class::Basic(Basic::QosOk {
|
Class::Basic(Basic::QosOk {
|
||||||
}) => {
|
}) => {
|
||||||
|
|
@ -1354,10 +1343,7 @@ pub fn write_method<W: Write>(class: Class, mut writer: W) -> Result<(), TransEr
|
||||||
short(reserved_1, &mut writer)?;
|
short(reserved_1, &mut writer)?;
|
||||||
shortstr(queue, &mut writer)?;
|
shortstr(queue, &mut writer)?;
|
||||||
shortstr(consumer_tag, &mut writer)?;
|
shortstr(consumer_tag, &mut writer)?;
|
||||||
todo!();
|
bit(&[no_local, no_ack, exclusive, no_wait, ], &mut writer)?;
|
||||||
todo!();
|
|
||||||
todo!();
|
|
||||||
todo!();
|
|
||||||
table(arguments, &mut writer)?;
|
table(arguments, &mut writer)?;
|
||||||
}
|
}
|
||||||
Class::Basic(Basic::ConsumeOk {
|
Class::Basic(Basic::ConsumeOk {
|
||||||
|
|
@ -1372,7 +1358,7 @@ pub fn write_method<W: Write>(class: Class, mut writer: W) -> Result<(), TransEr
|
||||||
}) => {
|
}) => {
|
||||||
writer.write_all(&[60, 30])?;
|
writer.write_all(&[60, 30])?;
|
||||||
shortstr(consumer_tag, &mut writer)?;
|
shortstr(consumer_tag, &mut writer)?;
|
||||||
todo!();
|
bit(&[no_wait, ], &mut writer)?;
|
||||||
}
|
}
|
||||||
Class::Basic(Basic::CancelOk {
|
Class::Basic(Basic::CancelOk {
|
||||||
consumer_tag,
|
consumer_tag,
|
||||||
|
|
@ -1391,8 +1377,7 @@ pub fn write_method<W: Write>(class: Class, mut writer: W) -> Result<(), TransEr
|
||||||
short(reserved_1, &mut writer)?;
|
short(reserved_1, &mut writer)?;
|
||||||
shortstr(exchange, &mut writer)?;
|
shortstr(exchange, &mut writer)?;
|
||||||
shortstr(routing_key, &mut writer)?;
|
shortstr(routing_key, &mut writer)?;
|
||||||
todo!();
|
bit(&[mandatory, immediate, ], &mut writer)?;
|
||||||
todo!();
|
|
||||||
}
|
}
|
||||||
Class::Basic(Basic::Return {
|
Class::Basic(Basic::Return {
|
||||||
reply_code,
|
reply_code,
|
||||||
|
|
@ -1416,7 +1401,7 @@ pub fn write_method<W: Write>(class: Class, mut writer: W) -> Result<(), TransEr
|
||||||
writer.write_all(&[60, 60])?;
|
writer.write_all(&[60, 60])?;
|
||||||
shortstr(consumer_tag, &mut writer)?;
|
shortstr(consumer_tag, &mut writer)?;
|
||||||
longlong(delivery_tag, &mut writer)?;
|
longlong(delivery_tag, &mut writer)?;
|
||||||
todo!();
|
bit(&[redelivered, ], &mut writer)?;
|
||||||
shortstr(exchange, &mut writer)?;
|
shortstr(exchange, &mut writer)?;
|
||||||
shortstr(routing_key, &mut writer)?;
|
shortstr(routing_key, &mut writer)?;
|
||||||
}
|
}
|
||||||
|
|
@ -1428,7 +1413,7 @@ pub fn write_method<W: Write>(class: Class, mut writer: W) -> Result<(), TransEr
|
||||||
writer.write_all(&[60, 70])?;
|
writer.write_all(&[60, 70])?;
|
||||||
short(reserved_1, &mut writer)?;
|
short(reserved_1, &mut writer)?;
|
||||||
shortstr(queue, &mut writer)?;
|
shortstr(queue, &mut writer)?;
|
||||||
todo!();
|
bit(&[no_ack, ], &mut writer)?;
|
||||||
}
|
}
|
||||||
Class::Basic(Basic::GetOk {
|
Class::Basic(Basic::GetOk {
|
||||||
delivery_tag,
|
delivery_tag,
|
||||||
|
|
@ -1439,7 +1424,7 @@ pub fn write_method<W: Write>(class: Class, mut writer: W) -> Result<(), TransEr
|
||||||
}) => {
|
}) => {
|
||||||
writer.write_all(&[60, 71])?;
|
writer.write_all(&[60, 71])?;
|
||||||
longlong(delivery_tag, &mut writer)?;
|
longlong(delivery_tag, &mut writer)?;
|
||||||
todo!();
|
bit(&[redelivered, ], &mut writer)?;
|
||||||
shortstr(exchange, &mut writer)?;
|
shortstr(exchange, &mut writer)?;
|
||||||
shortstr(routing_key, &mut writer)?;
|
shortstr(routing_key, &mut writer)?;
|
||||||
long(message_count, &mut writer)?;
|
long(message_count, &mut writer)?;
|
||||||
|
|
@ -1456,7 +1441,7 @@ pub fn write_method<W: Write>(class: Class, mut writer: W) -> Result<(), TransEr
|
||||||
}) => {
|
}) => {
|
||||||
writer.write_all(&[60, 80])?;
|
writer.write_all(&[60, 80])?;
|
||||||
longlong(delivery_tag, &mut writer)?;
|
longlong(delivery_tag, &mut writer)?;
|
||||||
todo!();
|
bit(&[multiple, ], &mut writer)?;
|
||||||
}
|
}
|
||||||
Class::Basic(Basic::Reject {
|
Class::Basic(Basic::Reject {
|
||||||
delivery_tag,
|
delivery_tag,
|
||||||
|
|
@ -1464,19 +1449,19 @@ pub fn write_method<W: Write>(class: Class, mut writer: W) -> Result<(), TransEr
|
||||||
}) => {
|
}) => {
|
||||||
writer.write_all(&[60, 90])?;
|
writer.write_all(&[60, 90])?;
|
||||||
longlong(delivery_tag, &mut writer)?;
|
longlong(delivery_tag, &mut writer)?;
|
||||||
todo!();
|
bit(&[requeue, ], &mut writer)?;
|
||||||
}
|
}
|
||||||
Class::Basic(Basic::RecoverAsync {
|
Class::Basic(Basic::RecoverAsync {
|
||||||
requeue,
|
requeue,
|
||||||
}) => {
|
}) => {
|
||||||
writer.write_all(&[60, 100])?;
|
writer.write_all(&[60, 100])?;
|
||||||
todo!();
|
bit(&[requeue, ], &mut writer)?;
|
||||||
}
|
}
|
||||||
Class::Basic(Basic::Recover {
|
Class::Basic(Basic::Recover {
|
||||||
requeue,
|
requeue,
|
||||||
}) => {
|
}) => {
|
||||||
writer.write_all(&[60, 110])?;
|
writer.write_all(&[60, 110])?;
|
||||||
todo!();
|
bit(&[requeue, ], &mut writer)?;
|
||||||
}
|
}
|
||||||
Class::Basic(Basic::RecoverOk {
|
Class::Basic(Basic::RecoverOk {
|
||||||
}) => {
|
}) => {
|
||||||
|
|
|
||||||
|
|
@ -27,14 +27,14 @@ pub fn longlong<W: Write>(value: Longlong, writer: &mut W) -> Result<(), TransEr
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn bit<W: Write>(value: Vec<Bit>, writer: &mut W) -> Result<(), TransError> {
|
pub fn bit<W: Write>(value: &[Bit], writer: &mut W) -> Result<(), TransError> {
|
||||||
// accumulate bits into bytes, starting from the least significant bit in each byte
|
// accumulate bits into bytes, starting from the least significant bit in each byte
|
||||||
|
|
||||||
// how many bits have already been packed into `current_buf`
|
// how many bits have already been packed into `current_buf`
|
||||||
let mut already_filled = 0;
|
let mut already_filled = 0;
|
||||||
let mut current_buf = 0u8;
|
let mut current_buf = 0u8;
|
||||||
|
|
||||||
for bit in value {
|
for &bit in value {
|
||||||
if already_filled >= 8 {
|
if already_filled >= 8 {
|
||||||
writer.write_all(&[current_buf])?;
|
writer.write_all(&[current_buf])?;
|
||||||
current_buf = 0;
|
current_buf = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue