pub(crate) fn from_committed_proposals(
        ciphersuite: &Ciphersuite,
        backend: &impl OpenMlsCryptoProvider,
        committed_proposals: &'a [ProposalOrRef],
        proposals_by_reference: &[&'a MlsPlaintext],
        sender: Sender,
    ) -> Result<Self, ProposalQueueError> {
        // Feed the `proposals_by_reference` in a `HashMap` so that we can easily
        // extract then by reference later
        let mut proposals_by_reference_queue: HashMap<ProposalReference, QueuedProposal> =
            HashMap::new();
        for mls_plaintext in proposals_by_reference {
            let queued_proposal =
                QueuedProposal::from_mls_plaintext(ciphersuite, backend, mls_plaintext)?;
            proposals_by_reference_queue
                .insert(queued_proposal.proposal_reference(), queued_proposal);
        }

        // Build the actual queue
        let mut proposal_queue = ProposalQueue::default();

        // Iterate over the committed proposals and insert the proposals in the queue
        for proposal_or_ref in committed_proposals.iter() {
            let queued_proposal = match proposal_or_ref {
                ProposalOrRef::Proposal(proposal) => QueuedProposal::from_proposal_and_sender(
                    ciphersuite,
                    backend,
                    proposal,
                    sender,
                )?,
                ProposalOrRef::Reference(proposal_reference) => {
                    match proposals_by_reference_queue.get(proposal_reference) {
                        Some(queued_proposal) => queued_proposal.clone(),
                        None => return Err(ProposalQueueError::ProposalNotFound),
                    }
                }
            };
            proposal_queue.add(queued_proposal);
        }
        Ok(proposal_queue)
    }
/// Returns a new `ProposalQueue` from proposals that were committed and
/// don't need filtering
Returns a new `ProposalQueue` from proposals that were committed and
don't need filtering
Returns a new ` ProposalQueue ` from proposals that were committed and don ' t need filtering
pub(crate) fn from_committed_proposals(
        ciphersuite: &Ciphersuite,
        backend: &impl OpenMlsCryptoProvider,
        committed_proposals: &'a [ProposalOrRef],
        proposals_by_reference: &[&'a MlsPlaintext],
        sender: Sender,
    ) -> Result<Self, ProposalQueueError> {
        // Feed the `proposals_by_reference` in a `HashMap` so that we can easily
        // extract then by reference later
        let mut proposals_by_reference_queue: HashMap<ProposalReference, QueuedProposal> =
            HashMap::new();
        for mls_plaintext in proposals_by_reference {
            let queued_proposal =
                QueuedProposal::from_mls_plaintext(ciphersuite, backend, mls_plaintext)?;
            proposals_by_reference_queue
                .insert(queued_proposal.proposal_reference(), queued_proposal);
        }
        // Build the actual queue
        let mut proposal_queue = ProposalQueue::default();
        // Iterate over the committed proposals and insert the proposals in the queue
        for proposal_or_ref in committed_proposals.iter() {
            let queued_proposal = match proposal_or_ref {
                ProposalOrRef::Proposal(proposal) => QueuedProposal::from_proposal_and_sender(
                    ciphersuite,
                    backend,
                    proposal,
                    sender,
                )?,
                ProposalOrRef::Reference(proposal_reference) => {
                    match proposals_by_reference_queue.get(proposal_reference) {
                        Some(queued_proposal) => queued_proposal.clone(),
                        None => return Err(ProposalQueueError::ProposalNotFound),
                    }
                }
            };
            proposal_queue.add(queued_proposal);
        }
        Ok(proposal_queue)
    }
pub ( crate ) fn from_committed_proposals ( ciphersuite : & Ciphersuite , backend : & impl OpenMlsCryptoProvider , committed_proposals : & ' a [ ProposalOrRef ] , proposals_by_reference : & [ & ' a MlsPlaintext ] , sender : Sender , ) -> Result < Self , ProposalQueueError > { // Feed the `proposals_by_reference` in a `HashMap` so that we can easily // extract then by reference later let mut proposals_by_reference_queue : HashMap < ProposalReference , QueuedProposal > = HashMap :: new ( ) ; for mls_plaintext in proposals_by_reference { let queued_proposal = QueuedProposal :: from_mls_plaintext ( ciphersuite , backend , mls_plaintext ) ? ; proposals_by_reference_queue . insert ( queued_proposal . proposal_reference ( ) , queued_proposal ) ; } // Build the actual queue let mut proposal_queue = ProposalQueue :: default ( ) ; // Iterate over the committed proposals and insert the proposals in the queue for proposal_or_ref in committed_proposals . iter ( ) { let queued_proposal = match proposal_or_ref { ProposalOrRef :: Proposal ( proposal ) => QueuedProposal :: from_proposal_and_sender ( ciphersuite , backend , proposal , sender , ) ? , ProposalOrRef :: Reference ( proposal_reference ) => { match proposals_by_reference_queue . get ( proposal_reference ) { Some ( queued_proposal ) => queued_proposal . clone ( ) , None => return Err ( ProposalQueueError :: ProposalNotFound ) , } } } ; proposal_queue . add ( queued_proposal ) ; } Ok ( proposal_queue ) }
Returns a new `ProposalQueue` from proposals that were committed and
don't need filtering
Returns a new ` ProposalQueue ` from proposals that were committed and don ' t need filtering
ciphersuite
&Ciphersuite
backend
&impl OpenMlsCryptoProvider
committed_proposals
&'a [ProposalOrRef]
proposals_by_reference
&[&'a MlsPlaintext]
sender
Sender
ciphersuite
&Ciphersuite
backend
&impl OpenMlsCryptoProvider
committed_proposals
&'a [ProposalOrRef]
proposals_by_reference
&[&'a MlsPlaintext]
sender
Sender