pub struct LexiconKey(/* private fields */);Expand description
create it like:
let _ = bisection_key::LexiconKey::new("a");Implementations§
Source§impl LexiconKey
impl LexiconKey
Sourcepub fn new(s: &str) -> Result<Self, String>
pub fn new(s: &str) -> Result<Self, String>
Examples found in repository?
examples/debug_lexicon.rs (line 31)
5fn main() -> Result<(), String> {
6 // let a = LexiconKey::new("aV")?;
7 // let b = LexiconKey::new("b")?;
8 // println!("{}", a.bisect(&b)?);
9
10 // let mut base = LexiconKey::new("a")?;
11 // let next = LexiconKey::new("b")?;
12 // let mut ret: Vec<String> = vec![];
13 // for _ in 0..100 {
14 // base = base.bisect(&next)?;
15 // println!("{}", base);
16 // ret.push(base.to_string());
17 // }
18
19 // println!("{:?}", ret);
20
21 // let mut base = LexiconKey::new("a")?;
22 // let mut ret: Vec<String> = vec![];
23 // for _ in 0..100 {
24 // base = base.bisect_end()?;
25 // println!("{}", base);
26 // ret.push(base.to_string());
27 // }
28
29 // println!("{:?}", ret);
30
31 let mut base = LexiconKey::new("B")?;
32 let edge = LexiconKey::new("A")?;
33
34 for _ in 0..1000 {
35 base = base.bisect(&edge)?;
36 println!("{}", base);
37 }
38
39 Ok(())
40}Sourcepub fn bisect(&self, next: &Self) -> Result<Self, String>
pub fn bisect(&self, next: &Self) -> Result<Self, String>
Examples found in repository?
examples/debug_lexicon.rs (line 35)
5fn main() -> Result<(), String> {
6 // let a = LexiconKey::new("aV")?;
7 // let b = LexiconKey::new("b")?;
8 // println!("{}", a.bisect(&b)?);
9
10 // let mut base = LexiconKey::new("a")?;
11 // let next = LexiconKey::new("b")?;
12 // let mut ret: Vec<String> = vec![];
13 // for _ in 0..100 {
14 // base = base.bisect(&next)?;
15 // println!("{}", base);
16 // ret.push(base.to_string());
17 // }
18
19 // println!("{:?}", ret);
20
21 // let mut base = LexiconKey::new("a")?;
22 // let mut ret: Vec<String> = vec![];
23 // for _ in 0..100 {
24 // base = base.bisect_end()?;
25 // println!("{}", base);
26 // ret.push(base.to_string());
27 // }
28
29 // println!("{:?}", ret);
30
31 let mut base = LexiconKey::new("B")?;
32 let edge = LexiconKey::new("A")?;
33
34 for _ in 0..1000 {
35 base = base.bisect(&edge)?;
36 println!("{}", base);
37 }
38
39 Ok(())
40}pub fn bisect_end(&self) -> Result<Self, String>
pub fn bisect_beginning(&self) -> Result<Self, String>
pub fn promote_from( &self, idx: usize, change: NumberChange, ) -> Result<Self, String>
pub fn checked(self) -> Result<Self, String>
Trait Implementations§
Source§impl Debug for LexiconKey
impl Debug for LexiconKey
Source§impl Default for LexiconKey
impl Default for LexiconKey
Source§impl Display for LexiconKey
impl Display for LexiconKey
Source§impl Ord for LexiconKey
missing length are filled with 32s, then compare like a vector
impl Ord for LexiconKey
missing length are filled with 32s, then compare like a vector
Source§fn cmp(&self, other: &LexiconKey) -> Ordering
fn cmp(&self, other: &LexiconKey) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for LexiconKey
missing length are filled with 32s, then compare like a vector
impl PartialEq for LexiconKey
missing length are filled with 32s, then compare like a vector
Source§impl PartialOrd for LexiconKey
impl PartialOrd for LexiconKey
impl Eq for LexiconKey
Auto Trait Implementations§
impl Freeze for LexiconKey
impl RefUnwindSafe for LexiconKey
impl Send for LexiconKey
impl Sync for LexiconKey
impl Unpin for LexiconKey
impl UnwindSafe for LexiconKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more