Refactor Matter to be a Trait.
Closed this issue · 1 comments
m00sey commented
As commented in #72
Matter would be better used abstractly.
Currently the matter implementation uses member variables for code/raw etc and mutates them internally.
We should add get_code()
get_raw()
to a Matter Trait and move the member variables up to Diger/Cigar/Verfer.
A Matter Trait could look something like:
pub trait Matter {
pub fn qb64b(&self) -> Result<Vec<u8>> //with default impl
pub fn qb2(&self) -> Result<Vec<u8>> //with default impl
pub fn code(&self) -> String
pub fn raw(&self) -> Vec<u8>
fn infil(&self) -> Result<String> //with default impl
fn binfil(&self) -> Result<Vec<u8>> //with default impl
fn exfil(&mut self, qb64: &str) -> Result<()> //with default impl
fn bexfil(&mut self, qb2: &[u8]) -> Result<()> //with default impl
}
jasoncolburne commented
+1