Skip to content

Commit

Permalink
fix: change required trait for Queuing and Sampling Ports to Ext version
Browse files Browse the repository at this point in the history
  • Loading branch information
sevenautumns committed Jan 24, 2024
1 parent da5bf63 commit 7672c0c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
18 changes: 9 additions & 9 deletions src/apex/queuing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ pub mod abstraction {
pub struct QueuingPortSender<
const MSG_SIZE: MessageSize,
const NB_MSGS: MessageRange,
Q: ApexQueuingPortP4,
Q: ApexQueuingPortP4Ext,
> {
_b: PhantomData<AtomicPtr<Q>>,
id: QueuingPortId,
}

impl<const MSG_SIZE: MessageSize, const NB_MSGS: MessageRange, S: ApexQueuingPortP4> Clone
impl<const MSG_SIZE: MessageSize, const NB_MSGS: MessageRange, S: ApexQueuingPortP4Ext> Clone
for QueuingPortSender<MSG_SIZE, NB_MSGS, S>
{
fn clone(&self) -> Self {
Expand All @@ -95,13 +95,13 @@ pub mod abstraction {
pub struct QueuingPortReceiver<
const MSG_SIZE: MessageSize,
const NB_MSGS: MessageRange,
Q: ApexQueuingPortP4,
Q: ApexQueuingPortP4Ext,
> {
_b: PhantomData<AtomicPtr<Q>>,
id: QueuingPortId,
}

impl<const MSG_SIZE: MessageSize, const NB_MSGS: MessageRange, S: ApexQueuingPortP4> Clone
impl<const MSG_SIZE: MessageSize, const NB_MSGS: MessageRange, S: ApexQueuingPortP4Ext> Clone
for QueuingPortReceiver<MSG_SIZE, NB_MSGS, S>
{
fn clone(&self) -> Self {
Expand Down Expand Up @@ -239,7 +239,7 @@ pub mod abstraction {
}
}

impl<const MSG_SIZE: MessageSize, const NB_MSGS: MessageRange, Q: ApexQueuingPortP4>
impl<const MSG_SIZE: MessageSize, const NB_MSGS: MessageRange, Q: ApexQueuingPortP4Ext>
QueuingPortSender<MSG_SIZE, NB_MSGS, Q>
{
pub fn send(&self, buffer: &[ApexByte], timeout: SystemTime) -> Result<(), Error> {
Expand Down Expand Up @@ -268,15 +268,15 @@ pub mod abstraction {
}
}

impl<const MSG_SIZE: MessageSize, const NB_MSGS: MessageRange, Q: ApexQueuingPortP1>
impl<const MSG_SIZE: MessageSize, const NB_MSGS: MessageRange, Q: ApexQueuingPortP1Ext>
QueuingPortSender<MSG_SIZE, NB_MSGS, Q>
{
pub fn from_name(name: Name) -> Result<QueuingPortSender<MSG_SIZE, NB_MSGS, Q>, Error> {
Q::get_queuing_port_sender(name)
}
}

impl<const MSG_SIZE: MessageSize, const NB_MSGS: MessageRange, Q: ApexQueuingPortP4>
impl<const MSG_SIZE: MessageSize, const NB_MSGS: MessageRange, Q: ApexQueuingPortP4Ext>
QueuingPortReceiver<MSG_SIZE, NB_MSGS, Q>
{
pub fn receive<'a>(
Expand Down Expand Up @@ -318,15 +318,15 @@ pub mod abstraction {
}
}

impl<const MSG_SIZE: MessageSize, const NB_MSGS: MessageRange, Q: ApexQueuingPortP1>
impl<const MSG_SIZE: MessageSize, const NB_MSGS: MessageRange, Q: ApexQueuingPortP1Ext>
QueuingPortReceiver<MSG_SIZE, NB_MSGS, Q>
{
pub fn from_name(name: Name) -> Result<QueuingPortReceiver<MSG_SIZE, NB_MSGS, Q>, Error> {
Q::get_queuing_port_receiver(name)
}
}

impl<Q: ApexQueuingPortP4> StartContext<Q> {
impl<Q: ApexQueuingPortP4Ext> StartContext<Q> {
pub fn create_queuing_port_sender<
const MSG_SIZE: MessageSize,
const NB_MSGS: MessageRange,
Expand Down
20 changes: 11 additions & 9 deletions src/apex/sampling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,14 @@ pub mod abstraction {
}

#[derive(Debug)]
pub struct SamplingPortSource<const MSG_SIZE: MessageSize, S: ApexSamplingPortP4> {
pub struct SamplingPortSource<const MSG_SIZE: MessageSize, S: ApexSamplingPortP4Ext> {
_b: PhantomData<AtomicPtr<S>>,
id: SamplingPortId,
}

impl<const MSG_SIZE: MessageSize, S: ApexSamplingPortP4> Clone for SamplingPortSource<MSG_SIZE, S> {
impl<const MSG_SIZE: MessageSize, S: ApexSamplingPortP4Ext> Clone
for SamplingPortSource<MSG_SIZE, S>
{
fn clone(&self) -> Self {
Self {
_b: self._b,
Expand All @@ -112,13 +114,13 @@ pub mod abstraction {
}

#[derive(Debug)]
pub struct SamplingPortDestination<const MSG_SIZE: MessageSize, S: ApexSamplingPortP4> {
pub struct SamplingPortDestination<const MSG_SIZE: MessageSize, S: ApexSamplingPortP4Ext> {
_b: PhantomData<AtomicPtr<S>>,
id: SamplingPortId,
refresh: Duration,
}

impl<const MSG_SIZE: MessageSize, S: ApexSamplingPortP4> Clone
impl<const MSG_SIZE: MessageSize, S: ApexSamplingPortP4Ext> Clone
for SamplingPortDestination<MSG_SIZE, S>
{
fn clone(&self) -> Self {
Expand Down Expand Up @@ -244,7 +246,7 @@ pub mod abstraction {
}
}

impl<const MSG_SIZE: MessageSize, S: ApexSamplingPortP4> SamplingPortSource<MSG_SIZE, S> {
impl<const MSG_SIZE: MessageSize, S: ApexSamplingPortP4Ext> SamplingPortSource<MSG_SIZE, S> {
pub fn send(&self, buffer: &[ApexByte]) -> Result<(), Error> {
buffer.validate_write(MSG_SIZE)?;
S::sampling_port_send_unchecked(self.id, buffer)
Expand All @@ -259,7 +261,7 @@ pub mod abstraction {
}
}

impl<const MSG_SIZE: MessageSize, S: ApexSamplingPortP1> SamplingPortSource<MSG_SIZE, S> {
impl<const MSG_SIZE: MessageSize, S: ApexSamplingPortP1Ext> SamplingPortSource<MSG_SIZE, S> {
pub fn from_name(name: Name) -> Result<SamplingPortSource<MSG_SIZE, S>, Error> {
S::get_sampling_port_source(name)
}
Expand All @@ -273,7 +275,7 @@ pub mod abstraction {
}
}

impl<const MSG_SIZE: MessageSize, S: ApexSamplingPortP4> SamplingPortDestination<MSG_SIZE, S> {
impl<const MSG_SIZE: MessageSize, S: ApexSamplingPortP4Ext> SamplingPortDestination<MSG_SIZE, S> {
pub fn receive<'a>(
&self,
buffer: &'a mut [ApexByte],
Expand All @@ -295,7 +297,7 @@ pub mod abstraction {
}
}

impl<const MSG_SIZE: MessageSize, S: ApexSamplingPortP1> SamplingPortDestination<MSG_SIZE, S> {
impl<const MSG_SIZE: MessageSize, S: ApexSamplingPortP1Ext> SamplingPortDestination<MSG_SIZE, S> {
pub fn from_name(name: Name) -> Result<SamplingPortDestination<MSG_SIZE, S>, Error> {
S::get_sampling_port_destination(name)
}
Expand All @@ -309,7 +311,7 @@ pub mod abstraction {
}
}

impl<S: ApexSamplingPortP4> StartContext<S> {
impl<S: ApexSamplingPortP4Ext> StartContext<S> {
pub fn create_sampling_port_source<const MSG_SIZE: MessageSize>(
&mut self,
name: Name,
Expand Down

0 comments on commit 7672c0c

Please sign in to comment.