diff --git a/orchestra/proc-macro/src/impl_builder.rs b/orchestra/proc-macro/src/impl_builder.rs index bed0da5..be4bb7b 100644 --- a/orchestra/proc-macro/src/impl_builder.rs +++ b/orchestra/proc-macro/src/impl_builder.rs @@ -175,7 +175,7 @@ pub(crate) fn impl_feature_gated_items( let channel_name_rx = &cfg_set.channel_names_without_wip("_rx"); let channel_name_unbounded_rx = &info.channel_names_without_wip("_unbounded_rx"); - let with_priority_channel = &cfg_set.with_priority_channel_without_wip(); + let can_receive_priority_messages = &cfg_set.can_receive_priority_messages_without_wip(); let baggage_name = &info.baggage_names(); let baggage_generic_ty = &info.baggage_generic_types(); @@ -635,7 +635,7 @@ pub(crate) fn impl_feature_gated_items( >(); #( - let (#channel_name_tx, #channel_name_rx) = if #with_priority_channel { + let (#channel_name_tx, #channel_name_rx) = if #can_receive_priority_messages { #support_crate ::metered::channel_with_priority::< MessagePacket< #maybe_boxed_consumes > >( diff --git a/orchestra/proc-macro/src/parse/parse_orchestra_struct.rs b/orchestra/proc-macro/src/parse/parse_orchestra_struct.rs index 8e3a92d..0203251 100644 --- a/orchestra/proc-macro/src/parse/parse_orchestra_struct.rs +++ b/orchestra/proc-macro/src/parse/parse_orchestra_struct.rs @@ -40,7 +40,7 @@ mod kw { syn::custom_keyword!(sends); syn::custom_keyword!(message_capacity); syn::custom_keyword!(signal_capacity); - syn::custom_keyword!(with_priority_channel); + syn::custom_keyword!(can_receive_priority_messages); } #[derive(Clone, Debug)] @@ -59,8 +59,8 @@ pub(crate) enum SubSysAttrItem { MessageChannelCapacity(ChannelCapacity), /// Custom signal channels capacity for this subsystem SignalChannelCapacity(ChannelCapacity), - /// The subsystem can send priority messages - WithPriorityChannel(kw::with_priority_channel), + /// The subsystem can receive priority messages + CanReceivePriorityMessages(kw::can_receive_priority_messages), } impl Parse for SubSysAttrItem { @@ -76,8 +76,8 @@ impl Parse for SubSysAttrItem { Self::MessageChannelCapacity(input.parse::>()?) } else if lookahead.peek(kw::signal_capacity) { Self::SignalChannelCapacity(input.parse::>()?) - } else if lookahead.peek(kw::with_priority_channel) { - Self::WithPriorityChannel(input.parse::()?) + } else if lookahead.peek(kw::can_receive_priority_messages) { + Self::CanReceivePriorityMessages(input.parse::()?) } else { Self::Consumes(input.parse::()?) }) @@ -105,8 +105,8 @@ impl ToTokens for SubSysAttrItem { Self::SignalChannelCapacity(_) => { quote! {} }, - Self::WithPriorityChannel(with_priority_channel) => { - quote! { #with_priority_channel } + Self::CanReceivePriorityMessages(can_receive_priority_messages) => { + quote! { #can_receive_priority_messages } }, }; tokens.extend(ts.into_iter()); @@ -138,8 +138,8 @@ pub(crate) struct SubSysField { pub(crate) message_capacity: Option, /// Custom signal channel capacity pub(crate) signal_capacity: Option, - /// The subsystem can send priority messages - pub(crate) with_priority_channel: bool, + /// The subsystem can receive priority messages + pub(crate) can_receive_priority_messages: bool, pub(crate) feature_gates: Option, } @@ -362,8 +362,8 @@ pub(crate) struct SubSystemAttrItems { pub(crate) message_capacity: Option>, /// Custom signal channel capacity pub(crate) signal_capacity: Option>, - /// The subsystem can send priority messages - pub(crate) with_priority_channel: bool, + /// The subsystem can receive priority messages + pub(crate) can_receive_priority_messages: bool, } impl Parse for SubSystemAttrItems { @@ -405,7 +405,8 @@ impl Parse for SubSystemAttrItems { let wip = extract_variant!(unique, Wip; default = false); let message_capacity = extract_variant!(unique, MessageChannelCapacity take ); let signal_capacity = extract_variant!(unique, SignalChannelCapacity take ); - let with_priority_channel = extract_variant!(unique, WithPriorityChannel; default = false); + let can_receive_priority_messages = + extract_variant!(unique, CanReceivePriorityMessages; default = false); Ok(Self { blocking, @@ -414,7 +415,7 @@ impl Parse for SubSystemAttrItems { consumes, message_capacity, signal_capacity, - with_priority_channel, + can_receive_priority_messages, }) } } @@ -509,8 +510,8 @@ impl<'a> SubsystemConfigSet<'a> { signal_channel_capacities_without_wip(&self.enabled_subsystems, default_capacity) } - pub(crate) fn with_priority_channel_without_wip(&self) -> Vec { - with_priority_channel_without_wip(&self.enabled_subsystems) + pub(crate) fn can_receive_priority_messages_without_wip(&self) -> Vec { + can_receive_priority_messages_without_wip(&self.enabled_subsystems) } } @@ -763,7 +764,7 @@ impl OrchestraGuts { sends, message_capacity, signal_capacity, - with_priority_channel, + can_receive_priority_messages, .. } = subsystem_attrs; @@ -787,7 +788,7 @@ impl OrchestraGuts { message_capacity, signal_capacity, feature_gates, - with_priority_channel, + can_receive_priority_messages, }); } else { // collect the "baggage" @@ -921,12 +922,12 @@ pub(crate) fn consumes_without_wip<'a, T: Borrow>(subsystems: &[T]) .collect::>() } -pub(crate) fn with_priority_channel_without_wip( +pub(crate) fn can_receive_priority_messages_without_wip( subsystems: &Vec<&SubSysField>, ) -> Vec { subsystems .iter() .filter(|ssf| !ssf.wip) - .map(|ssf| if ssf.with_priority_channel { quote!(true) } else { quote!(false) }) + .map(|ssf| if ssf.can_receive_priority_messages { quote!(true) } else { quote!(false) }) .collect::>() } diff --git a/orchestra/tests/subsystem_with_priority_channel_test.rs b/orchestra/tests/subsystem_with_priority_channel_test.rs index 244be34..4c2cc0b 100644 --- a/orchestra/tests/subsystem_with_priority_channel_test.rs +++ b/orchestra/tests/subsystem_with_priority_channel_test.rs @@ -166,7 +166,7 @@ pub struct Orchestra { #[subsystem(consumes: MsgA, sends: [MsgB])] sub_a: SubA, - #[subsystem(consumes: MsgB, sends: [MsgA], with_priority_channel)] + #[subsystem(consumes: MsgB, sends: [MsgA], can_receive_priority_messages)] sub_b: SubB, }