pub enum Direction {
LeftToRight,
TopToBottom,
RightToLeft,
BottomToTop,
}Expand description
The direction in which a flowchart flows.
Variants§
LeftToRight
Left-to-right (LR).
TopToBottom
Top-to-bottom (TD or TB).
RightToLeft
Right-to-left (RL).
BottomToTop
Bottom-to-top (BT).
Implementations§
Source§impl Direction
impl Direction
Sourcepub fn parse(s: &str) -> Option<Self>
pub fn parse(s: &str) -> Option<Self>
Parse a direction keyword, case-insensitive.
§Arguments
s— a direction token such as"LR","TD","TB","RL", or"BT".
§Returns
Some(Direction) if the keyword is recognised, None otherwise.
§Examples
use mermaid_text::Direction;
assert_eq!(Direction::parse("LR"), Some(Direction::LeftToRight));
assert_eq!(Direction::parse("td"), Some(Direction::TopToBottom)); // case-insensitive
assert_eq!(Direction::parse("TB"), Some(Direction::TopToBottom));
assert_eq!(Direction::parse("RL"), Some(Direction::RightToLeft));
assert_eq!(Direction::parse("BT"), Some(Direction::BottomToTop));
assert_eq!(Direction::parse("XX"), None);Sourcepub fn is_horizontal(self) -> bool
pub fn is_horizontal(self) -> bool
Returns true if the primary flow axis is horizontal (LR or RL).
§Examples
use mermaid_text::Direction;
assert!(Direction::LeftToRight.is_horizontal());
assert!(Direction::RightToLeft.is_horizontal());
assert!(!Direction::TopToBottom.is_horizontal());
assert!(!Direction::BottomToTop.is_horizontal());Trait Implementations§
impl Copy for Direction
impl Eq for Direction
impl StructuralPartialEq for Direction
Auto Trait Implementations§
impl Freeze for Direction
impl RefUnwindSafe for Direction
impl Send for Direction
impl Sync for Direction
impl Unpin for Direction
impl UnsafeUnpin for Direction
impl UnwindSafe for Direction
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