equal
deleted
inserted
replaced
362 } else { |
362 } else { |
363 edge |
363 edge |
364 } |
364 } |
365 } |
365 } |
366 } |
366 } |
|
367 |
|
368 impl<T: AsRef<str>> From<T> for EdgeDescription { |
|
369 fn from(val: T) -> Self { |
|
370 use std::cmp::Ordering; |
|
371 |
|
372 let reversed = val.as_ref().chars().rev().collect::<String>(); |
|
373 |
|
374 match val.as_ref().cmp(&reversed) { |
|
375 Ordering::Less => EdgeDescription { |
|
376 name: val.as_ref().to_owned(), |
|
377 symmetrical: Some(false), |
|
378 reversed: Some(false), |
|
379 }, |
|
380 Ordering::Equal => EdgeDescription { |
|
381 name: reversed, |
|
382 symmetrical: Some(true), |
|
383 reversed: Some(false), |
|
384 }, |
|
385 Ordering::Greater => EdgeDescription { |
|
386 name: reversed, |
|
387 symmetrical: Some(false), |
|
388 reversed: Some(true), |
|
389 }, |
|
390 } |
|
391 } |
|
392 } |