Skip to content

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.
@nwalfield nwalfield force-pushed the transaction-owns-card branch from 351044a to 747c405 Compare February 16, 2022 16:50
@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