Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pcsc: Allow a transaction to own the underlying card. #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nwalfield
Copy link

  • Since Rust's support for self-referencial data structures is weak,
    there are cases where it is useful for a transaction to own the card
    and not just for it to hold a mutable reference. In these cases,
    the caller needs to explicitly end the transaction to recover the
    underlying card, but that is acceptable.

  • Generalize Transaction to be generic over a BorrowMut<Card>.
    Add new functions Card::begin_transaction_owned and
    Card::begin_transaction2_owned to create this type of transaction.
    Change Transaction::end to return the underlying card. And, add a
    variant, Transaction::end2, to unconditionally return the
    underlying card independent of whether ending the transaction
    succeeded.

  - Since Rust's support for self-referencial data structures is weak,
    there are cases where it is useful for a transaction to own the card
    and not just for it to hold a mutable reference.  In these cases,
    the caller needs to explicitly end the transaction to recover the
    underlying card, but that is acceptable.

  - Generalize `Transaction` to be generic over a `BorrowMut<Card>`.
    Add new functions `Card::begin_transaction_owned` and
    `Card::begin_transaction2_owned` to create this type of transaction.
    Change `Transaction::end` to return the underlying card.  And, add a
    variant, `Transaction::end2`, to unconditionally return the
    underlying card independent of whether ending the transaction
    succeeded.

  - Fixes bluetech#28.
@bluetech
Copy link
Owner

bluetech commented Mar 5, 2022

I left a comment regarding this PR here: #28 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants