You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: descriptor_reader.rs
    path of file: ./repos/embassy/embassy-usb/src
    
    the code of the file until where you have to start completion: use crate::descriptor::descriptor_type;
use crate::driver::EndpointAddress;
use crate::types::InterfaceNumber;

#[derive(Copy, Clone, PartialEq, Eq, Debug)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct ReadError;

pub struct Reader<'a> {
    data: &'a [u8],
}

impl<'a> Reader<'a> {
    pub const fn new(data: &'a [u8]) -> Self {
        Self { data }
    }

    pub const fn eof(&self) -> bool {
        self.data.is_empty()
    }

    pub fn read<const N: usize>(&mut self) -> Result<[u8; N], ReadError> {
        let n = self.data.get(0..N).ok_or(ReadError)?;
        self.data = &self.data[N..];
        Ok(n.try_into().unwrap())
    }

    pub fn read_u8(&mut self) -> Result<u8, ReadError> {
        Ok(u8::from_le_bytes(self.read()?))
    }
    pub fn read_u16(&mut self) -> Result<u16, ReadError> {
        Ok(u16::from_le_bytes(self.read()?))
    }

    pub fn read_slice(&mut self, len: usize) -> Resul
    
pub fn foreach_endpoint(data: &[u8], mut f: impl FnMut(EndpointInfo)) -> Result<(), ReadError> {
    let mut ep = EndpointInfo {
        configuration: 0,
        interface: InterfaceNumber(0),
        interface_alt: 0,
        ep_address: EndpointAddress::from(0),
    };
    for res in Reader::new(data).read_descriptors() {
        let (kind, mut r) = res?;
        match kind {
            descriptor_type::CONFIGURATION => {
                let _total_length = r.read_u16()?;
                let _total_length = r.read_u8()?;
                ep.configuration = r.read_u8()?;
            }
            descriptor_type::INTERFACE => {
                ep.interface = InterfaceNumber(r.read_u8()?);
                ep.interface_alt = r.read_u8()?;
            }
            descriptor_type::ENDPOINT => {
                ep.ep_address = EndpointAddress::from(r.read_u8()?);
                f(ep);
            }
            _ => {}
        }
    }
    Ok(())
}