sephynox / xrpl-rust

A 100% Rust library to interact with the XRPL. XRPL Grant Winner
https://crates.io/crates/xrpl-rust
ISC License
16 stars 8 forks source link

add `Model` trait #9

Closed LimpidCrypto closed 1 year ago

LimpidCrypto commented 2 years ago

High Level Overview of Change

Add a Base trait that brings standard functionalities to all models. The Base trait also adds the get_errors method that checks a model for its unique errors.

Context of Change

7

11

Type of Change

Test Plan

TODO

sephynox commented 2 years ago

Rust does not really have a concept of inheritance. Maybe naming it to "Model" might be more appropriate. I see some repetition with the implementation of some of the trait's methods on structs. You can write default implementations in the trait definition and override it when necessary.

LimpidCrypto commented 2 years ago

Rust does not really have a concept of inheritance. Maybe naming it to "Model" might be more appropriate. I see some repetition with the implementation of some of the trait's methods on structs. You can write default implementations in the trait definition and override it when necessary.

Yes, I found that out too. They will be removed with the next commit :) "Model" is definitely a better name.