Skip to content

Commit

Permalink
Merge pull request #4 from trussed-dev/alloc
Browse files Browse the repository at this point in the history
Remove `'static` requirement on the bus
  • Loading branch information
robin-nitrokey authored Jan 25, 2023
2 parents 3826ffe + a3069b3 commit c9d9a06
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions src/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ use crate::{
use usb_device::class_prelude::*;
type Result<T> = core::result::Result<T, UsbError>;

pub struct Ccid<Bus, I, const N: usize>
pub struct Ccid<'bus, Bus, I, const N: usize>
where
Bus: 'static + UsbBus,
I: 'static + Interchange<REQUEST = Vec<u8, N>, RESPONSE = Vec<u8, N>>,
{
interface_number: InterfaceNumber,
string_index: StringIndex,
read: EndpointOut<'static, Bus>,
read: EndpointOut<'bus, Bus>,
// interrupt: EndpointIn<'static, Bus>,
pipe: Pipe<Bus, I, N>,
pipe: Pipe<'bus, Bus, I, N>,
}

impl<Bus, I, const N: usize> Ccid<Bus, I, N>
impl<'bus, Bus, I, const N: usize> Ccid<'bus, Bus, I, N>
where
Bus: 'static + UsbBus,
I: 'static + Interchange<REQUEST = Vec<u8, N>, RESPONSE = Vec<u8, N>>,
Expand All @@ -36,7 +36,7 @@ where
/// and allows personalizing the Answer-to-Reset, for instance by
/// ASCII-encoding vendor or model information.
pub fn new(
allocator: &'static UsbBusAllocator<Bus>,
allocator: &'bus UsbBusAllocator<Bus>,
request_pipe: Requester<I>,
card_issuers_data: Option<&[u8]>,
) -> Self {
Expand Down Expand Up @@ -84,7 +84,7 @@ where
}
}

impl<Bus, I, const N: usize> UsbClass<Bus> for Ccid<Bus, I, N>
impl<'bus, Bus, I, const N: usize> UsbClass<Bus> for Ccid<'bus, Bus, I, N>
where
Bus: 'static + UsbBus,
I: 'static + Interchange<REQUEST = Vec<u8, N>, RESPONSE = Vec<u8, N>>,
Expand Down
10 changes: 5 additions & 5 deletions src/pipe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ enum Error {
CommandNotSupported = 0x00,
}

pub struct Pipe<Bus, I, const N: usize>
pub struct Pipe<'bus, Bus, I, const N: usize>
where
Bus: 'static + UsbBus,
I: 'static + Interchange<REQUEST = Vec<u8, N>, RESPONSE = Vec<u8, N>>,
{
pub(crate) write: EndpointIn<'static, Bus>,
pub(crate) write: EndpointIn<'bus, Bus>,
// pub(crate) rpc: TransportEndpoint<'rpc>,
seq: u8,
state: State,
Expand All @@ -58,13 +58,13 @@ where
atr: Vec<u8, 32>,
}

impl<Bus, I, const N: usize> Pipe<Bus, I, N>
impl<'bus, Bus, I, const N: usize> Pipe<'bus, Bus, I, N>
where
Bus: 'static + UsbBus,
I: 'static + Interchange<REQUEST = Vec<u8, N>, RESPONSE = Vec<u8, N>>,
{
pub(crate) fn new(
write: EndpointIn<'static, Bus>,
write: EndpointIn<'bus, Bus>,
request_pipe: Requester<I>,
card_issuers_data: Option<&[u8]>,
) -> Self {
Expand Down Expand Up @@ -128,7 +128,7 @@ where
}
}

impl<Bus, I, const N: usize> Pipe<Bus, I, N>
impl<'bus, Bus, I, const N: usize> Pipe<'bus, Bus, I, N>
where
Bus: 'static + UsbBus,
I: 'static + Interchange<REQUEST = Vec<u8, N>, RESPONSE = Vec<u8, N>>,
Expand Down

0 comments on commit c9d9a06

Please sign in to comment.