Skip to content

Provide GenericQueuePair and GenericCompletionQueue for dynamic dispatch #36

@dragonJACson

Description

@dragonJACson

If users want to implement a function returns either a BasicQueuePair or an ExtendedQueuePair, they cannot use Box<dyn QueuePair> in return position, as the function start_post_send in trait QueuePair would return BasicPostSendGuard and ExtendedPostSendGuard for the corresponding QueuePair type, which makes it impossible to consturct a Box<dyn QueuePair> type.

Thus, we need to provide a GenericQueuePair to users, it may look like this

pub enum GenericQueuePair {
    Basic(BasicQueuePair),
    Extended(ExtendedQueuePair),
}

impl QueuePair for GenericQueuePair {
    todo!();
}

impl From<BasicQueuePair> for GenericQueuePair {
    todo!();
}

impl From<ExtendedQueuePair> for GenericQueuePair {
    todo!();
}

Which should align the usage for both ExtendedQueuePair and BasicQueuePair

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions