class io.UsbEndpoint

class UsbEndpoint {
    // fields

    io.UsbInterface* const m_parentInterface;
    io.UsbEndpointDescriptor const* const m_endpointDescriptor;
    io.UsbEndpointEvents readonly volatile m_activeEvents;
    std.Error const* readonly volatile m_ioError;
    bool readonly m_isOpen;

    // properties

    uint_t autoget property m_transferTimeout;
    uint_t autoget property m_readParallelism;
    size_t autoget property m_readBlockSize;
    size_t autoget property m_readBufferSize;
    size_t autoget property m_writeBufferSize;
    io.UsbEndpointOptions autoget property m_options;

    // construction

    construct();
    destruct();

    // methods

    void close();
    void unsuspend();

    size_t errorcode read(
        void* p,
        size_t size
    );

    size_t errorcode write(
        void const* p,
        size_t size
    );

    long errorcode wait(
        io.UsbEndpointEvents eventMask,
        void function* handler(io.UsbEndpointEvents triggeredEvents)
    );

    bool errorcode cancelWait(long handle);

    io.UsbEndpointEvents blockingWait(
        io.UsbEndpointEvents eventMask,
        uint_t timeout = -1
    );

    io.UsbEndpointEvents async asyncWait(io.UsbEndpointEvents eventMask);

    // aliases

    alias dispose = close;
};