Struct railroad::Diagram

source ·
pub struct Diagram<T: RailroadNode> { /* private fields */ }

Implementations

Create a diagram using the given root-element.

let mut seq = railroad::Sequence::default();
seq.push(Box::new(railroad::Start))
   .push(Box::new(railroad::Terminal::new("Foobar".to_owned())))
   .push(Box::new(railroad::End));
let mut dia = railroad::Diagram::new(seq);
dia.add_element(railroad::svg::Element::new("style")
                .set("type", "text/css")
                .raw_text(railroad::DEFAULT_CSS));
println!("{}", dia);

Create a diagram which has this library’s default CSS style included.

Add the default CSS as an additional <style> element.

Set an attribute on the -tag.

Add an additional svg::Element which is written before the root-element

Return the root-element this diagram’s root element

Trait Implementations

Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
The vertical distance from this element’s top to where the entering, connecting path is drawn. Read more
This primitives’s total height.
This primitive’s total width.
Draw this element as an svg::Element.
source

fn height_below_entry(&self) -> i64

The vertical distance from the height of the connecting path to the bottom.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.