pub fn tryte(from: &str) -> TryteExpand description
Creates a Tryte object from a string representation of a balanced ternary number.
It contains approximately 9.5 bits of information.
This function first converts the input string representation into a Ternary object
using the ter function, and then constructs a Tryte from that Ternary.
§Panics
This function panics if the Ternary contains more than 6 digits or if an input character is invalid.
§Arguments
from- A string slice representing the balanced ternary number. It must contain valid balanced ternary characters (+,0, or-) only.- Panics if an input character is invalid.
§Returns
A Tryte object constructed from the provided balanced ternary string.
§Example
use balanced_ternary::{tryte, Tryte};
let tryte_value = tryte("+0+0");
assert_eq!(tryte_value.to_string(), "00+0+0");