Skip to content

Commit

Permalink
refactor: change QueuingPort related generics to Q
Browse files Browse the repository at this point in the history
  • Loading branch information
sevenautumns authored and dadada committed Apr 12, 2024
1 parent dd5e13a commit cc3859e
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions src/apex/queuing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,28 +96,28 @@ pub mod abstraction {
}
}

impl<const MSG_SIZE: MessageSize, const NB_MSGS: MessageRange, S: ApexQueuingPortP4Ext>
AsRef<QueuingPortSender<S>> for ConstQueuingPortSender<MSG_SIZE, NB_MSGS, S>
impl<const MSG_SIZE: MessageSize, const NB_MSGS: MessageRange, Q: ApexQueuingPortP4Ext>
AsRef<QueuingPortSender<Q>> for ConstQueuingPortSender<MSG_SIZE, NB_MSGS, Q>
{
fn as_ref(&self) -> &QueuingPortSender<S> {
fn as_ref(&self) -> &QueuingPortSender<Q> {
&self.0
}
}

impl<const MSG_SIZE: MessageSize, const NB_MSGS: MessageRange, S: ApexQueuingPortP4Ext>
Borrow<QueuingPortSender<S>> for ConstQueuingPortSender<MSG_SIZE, NB_MSGS, S>
impl<const MSG_SIZE: MessageSize, const NB_MSGS: MessageRange, Q: ApexQueuingPortP4Ext>
Borrow<QueuingPortSender<Q>> for ConstQueuingPortSender<MSG_SIZE, NB_MSGS, Q>
{
fn borrow(&self) -> &QueuingPortSender<S> {
fn borrow(&self) -> &QueuingPortSender<Q> {
&self.0
}
}

impl<const MSG_SIZE: MessageSize, const NB_MSGS: MessageRange, S: ApexQueuingPortP4Ext>
TryFrom<QueuingPortSender<S>> for ConstQueuingPortSender<MSG_SIZE, NB_MSGS, S>
impl<const MSG_SIZE: MessageSize, const NB_MSGS: MessageRange, Q: ApexQueuingPortP4Ext>
TryFrom<QueuingPortSender<Q>> for ConstQueuingPortSender<MSG_SIZE, NB_MSGS, Q>
{
type Error = Error;

fn try_from(port: QueuingPortSender<S>) -> Result<Self, Self::Error> {
fn try_from(port: QueuingPortSender<Q>) -> Result<Self, Self::Error> {
if port.msg_size != MSG_SIZE || port.nb_msgs != NB_MSGS {
return Err(Error::InvalidConfig);
}
Expand All @@ -143,28 +143,28 @@ pub mod abstraction {
}
}

impl<const MSG_SIZE: MessageSize, const NB_MSGS: MessageRange, S: ApexQueuingPortP4Ext>
AsRef<QueuingPortReceiver<S>> for ConstQueuingPortReceiver<MSG_SIZE, NB_MSGS, S>
impl<const MSG_SIZE: MessageSize, const NB_MSGS: MessageRange, Q: ApexQueuingPortP4Ext>
AsRef<QueuingPortReceiver<Q>> for ConstQueuingPortReceiver<MSG_SIZE, NB_MSGS, Q>
{
fn as_ref(&self) -> &QueuingPortReceiver<S> {
fn as_ref(&self) -> &QueuingPortReceiver<Q> {
&self.0
}
}

impl<const MSG_SIZE: MessageSize, const NB_MSGS: MessageRange, S: ApexQueuingPortP4Ext>
Borrow<QueuingPortReceiver<S>> for ConstQueuingPortReceiver<MSG_SIZE, NB_MSGS, S>
impl<const MSG_SIZE: MessageSize, const NB_MSGS: MessageRange, Q: ApexQueuingPortP4Ext>
Borrow<QueuingPortReceiver<Q>> for ConstQueuingPortReceiver<MSG_SIZE, NB_MSGS, Q>
{
fn borrow(&self) -> &QueuingPortReceiver<S> {
fn borrow(&self) -> &QueuingPortReceiver<Q> {
&self.0
}
}

impl<const MSG_SIZE: MessageSize, const NB_MSGS: MessageRange, S: ApexQueuingPortP4Ext>
TryFrom<QueuingPortReceiver<S>> for ConstQueuingPortReceiver<MSG_SIZE, NB_MSGS, S>
impl<const MSG_SIZE: MessageSize, const NB_MSGS: MessageRange, Q: ApexQueuingPortP4Ext>
TryFrom<QueuingPortReceiver<Q>> for ConstQueuingPortReceiver<MSG_SIZE, NB_MSGS, Q>
{
type Error = Error;

fn try_from(port: QueuingPortReceiver<S>) -> Result<Self, Self::Error> {
fn try_from(port: QueuingPortReceiver<Q>) -> Result<Self, Self::Error> {
if port.msg_size != MSG_SIZE || port.nb_msgs != NB_MSGS {
return Err(Error::InvalidConfig);
}
Expand All @@ -181,7 +181,7 @@ pub mod abstraction {
nb_msgs: MessageRange,
}

impl<S: ApexQueuingPortP4Ext> Clone for QueuingPortSender<S> {
impl<Q: ApexQueuingPortP4Ext> Clone for QueuingPortSender<Q> {
fn clone(&self) -> Self {
Self {
_b: self._b,
Expand All @@ -192,10 +192,10 @@ pub mod abstraction {
}
}

impl<const MSG_SIZE: MessageSize, const NB_MSGS: MessageRange, S: ApexQueuingPortP4Ext>
From<ConstQueuingPortSender<MSG_SIZE, NB_MSGS, S>> for QueuingPortSender<S>
impl<const MSG_SIZE: MessageSize, const NB_MSGS: MessageRange, Q: ApexQueuingPortP4Ext>
From<ConstQueuingPortSender<MSG_SIZE, NB_MSGS, Q>> for QueuingPortSender<Q>
{
fn from(port: ConstQueuingPortSender<MSG_SIZE, NB_MSGS, S>) -> Self {
fn from(port: ConstQueuingPortSender<MSG_SIZE, NB_MSGS, Q>) -> Self {
port.0
}
}
Expand All @@ -208,7 +208,7 @@ pub mod abstraction {
nb_msgs: MessageRange,
}

impl<S: ApexQueuingPortP4Ext> Clone for QueuingPortReceiver<S> {
impl<Q: ApexQueuingPortP4Ext> Clone for QueuingPortReceiver<Q> {
fn clone(&self) -> Self {
Self {
_b: self._b,
Expand All @@ -219,10 +219,10 @@ pub mod abstraction {
}
}

impl<const MSG_SIZE: MessageSize, const NB_MSGS: MessageRange, S: ApexQueuingPortP4Ext>
From<ConstQueuingPortReceiver<MSG_SIZE, NB_MSGS, S>> for QueuingPortReceiver<S>
impl<const MSG_SIZE: MessageSize, const NB_MSGS: MessageRange, Q: ApexQueuingPortP4Ext>
From<ConstQueuingPortReceiver<MSG_SIZE, NB_MSGS, Q>> for QueuingPortReceiver<Q>
{
fn from(port: ConstQueuingPortReceiver<MSG_SIZE, NB_MSGS, S>) -> Self {
fn from(port: ConstQueuingPortReceiver<MSG_SIZE, NB_MSGS, Q>) -> Self {
port.0
}
}
Expand Down

0 comments on commit cc3859e

Please sign in to comment.