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