dter

Function dter 

Source
pub fn dter(from: &str) -> DataTernary
Expand description

Creates a DataTernary object from a string representation of a balanced ternary number.

This function converts the provided string representation of a balanced ternary number into a DataTernary object. It first parses the input string into a Ternary using the ter function, and then constructs the DataTernary.

§Arguments

  • from - A string slice that contains a valid balanced ternary number. Valid characters are +, 0, and -.

§Panics

  • Panics if the input contains invalid balanced ternary characters.

§Returns

A DataTernary object constructed from the input string.

§Example

use balanced_ternary::{dter, DataTernary};

let data_ternary = dter("+-0-");
assert_eq!(data_ternary.to_string(), "0+-0-");