pub struct Diagram<N> { /* private fields */ }
Implementations§
source§impl<N: Node> Diagram<N>
impl<N: Node> Diagram<N>
sourcepub fn new(root: N) -> Self
pub fn new(root: N) -> Self
Create a diagram using the given root-element.
use railroad::*;
let mut seq: Sequence::<Box<dyn Node>> = Sequence::default();
seq.push(Box::new(Start))
.push(Box::new(Terminal::new("Foobar".to_owned())))
.push(Box::new(End));
let mut dia = Diagram::new(seq);
dia.add_element(svg::Element::new("style")
.set("type", "text/css")
.raw_text(DEFAULT_CSS));
println!("{}", dia);
sourcepub fn with_default_css(root: N) -> Self
pub fn with_default_css(root: N) -> Self
Create a diagram which has this library’s default CSS style included.
sourcepub fn add_default_css(&mut self)
pub fn add_default_css(&mut self)
Add the default CSS as an additional <style>
element.
sourcepub fn add_element(&mut self, e: Element) -> &mut Self
pub fn add_element(&mut self, e: Element) -> &mut Self
Add an additional svg::Element
which is written before the root-element
sourcepub fn into_inner(self) -> N
pub fn into_inner(self) -> N
Return the root-element this diagram’s root element
Trait Implementations§
source§impl<N> Node for Diagram<N>where
N: Node,
impl<N> Node for Diagram<N>where N: Node,
source§fn entry_height(&self) -> i64
fn entry_height(&self) -> i64
The vertical distance from this element’s top to where the entering,
connecting path is drawn. Read more
source§fn height_below_entry(&self) -> i64
fn height_below_entry(&self) -> i64
The vertical distance from the height of the connecting path to the bottom.
Auto Trait Implementations§
impl<N> RefUnwindSafe for Diagram<N>where N: RefUnwindSafe,
impl<N> Send for Diagram<N>where N: Send,
impl<N> Sync for Diagram<N>where N: Sync,
impl<N> Unpin for Diagram<N>where N: Unpin,
impl<N> UnwindSafe for Diagram<N>where N: UnwindSafe,
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