-
Notifications
You must be signed in to change notification settings - Fork 16
pre-RFC: suggestion of Trits implementation #5
Comments
Hashing can be implemented on top of the high-level API (i.e: on the |
Some thoughts about this. It seems like we are aiming at supporting the following trit encodings.
They should all share a common interface and should provide a way to convert from one to another. |
Trytes are an encoding of trits, 3 trits per byte. The question is if we want to make them an exception or have them as part of the trits interface. Pros:
Cons:
|
Regarding conversions from one to another we have two ways:
|
At this rate, do we still want an inner structure? I feel like they can be individual type with same trait. pub trait Trits {
fn to_trits(n: &[u8]) -> Self;
...
}
pub struct 1TritPerByte {
trits: ...,
}
impl 1TritPerByte {
// Its own methods and can be public
...
}
impl Trits for 1TritPerByte {
...
} |
@wusyong While this is possible, it does mean that the raw |
@iotaledger/bee-devs With some conversation on #4, we should better start figuring out the basic layout of type
Trits
and open its RFC at the meantime. Here's proposal of @zesterer in trit's manner:So it can have default type something like
struct Trits<T: RawTrits = RawTritPerByte>
in this way. We still have a couple of questions remain and I would like to see if some one wish to take it and start a RFC with this.RawTrits
?The text was updated successfully, but these errors were encountered: