Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
radicle: generic Transaction::initial
Merged fintohaps opened 1 year ago

The use of Transaction outside of the radicle crate requires that a newtype is used, if the upstream code wants to write methods, such as:

pub struct Transaction<R>(store::Transaction<MyCob, R>);

impl Transaction<R> {
  pub fn add_foo(&mut self, foo: Foo) -> Result<(), store::Error> { /* code */ }
  pub fn add_bar(&mut self, bar: Bar) -> Result<(), store::Error> { /* code */ }}

This works up until the point that it tries to re-use the Transaction::initial method.

To make this possible, the method needs to know that it can be converted to the upstream Transaction and back to radicle Transaction.

fintohaps opened with revision bf8676cb on base 3b5fac17 +6 -3 1 year ago

The use of Transaction outside of the radicle crate requires that a newtype is used, if the upstream code wants to write methods, such as:

pub struct Transaction<R>(store::Transaction<MyCob, R>);

impl Transaction<R> {
  pub fn add_foo(&mut self, foo: Foo) -> Result<(), store::Error> { /* code */ }
  pub fn add_bar(&mut self, bar: Bar) -> Result<(), store::Error> { /* code */ }}

This works up until the point that it tries to re-use the Transaction::initial method.

To make this possible, the method needs to know that it can be converted to the upstream Transaction and back to radicle Transaction.

fintohaps pushed revision 2 c3f4c54c on base 170915ff +6 -3 1 year ago

Rebased

lorenz accepted 1 year ago
fintohaps merged revision c3f4c54c at dd5f7396 1 year ago