[−][src]Struct pikchr::Pikchr
A rendered pikchr diagram
Pikchr renders diagrams as SVG. This SVG is a given width and height. The Pikchr derefs to the SVG string, or you can access it explicitly. The width and height are accessible as plain numbers.
Implementations
impl Pikchr
[src]
pub fn render(
source: &str,
class: Option<&str>,
flags: PikchrFlags
) -> Result<Pikchr, String>
[src]
source: &str,
class: Option<&str>,
flags: PikchrFlags
) -> Result<Pikchr, String>
Render some input pikchr source as an SVG
You can convert arbitrary pikchr source into an SVG using this function. The class name is optional, and the flags field controls the generation of errors. Since pikchr does not have a structured error format, the returned error is simply a string.
let image = Pikchr::render(r#" arrow right 200% "Markdown" "Source" box rad 10px "Markdown" "Formatter" "(markdown.c)" fit arrow right 200% "HTML+SVG" "Output" arrow <-> down 70% from last box.s box same "Pikchr" "Formatter" "(pikchr.c)" fit"#, None, PikchrFlags::default()) .unwrap(); assert!(image.contains("<svg"))
pub fn width(&self) -> isize
[src]
Retrieve the width of this Pikchr
println!("Picture is {} pixels wide", pic.width());
pub fn height(&self) -> isize
[src]
Retrieve the height of this Pikchr
println!("Picture is {} pixels tall", pic.height());
pub fn rendered(&self) -> &str
[src]
Retrieve the rendered pikchr (same as dereferencing)
println!("Picture content:\n{}", pic.rendered());
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Pikchr
impl !Send for Pikchr
impl !Sync for Pikchr
impl Unpin for Pikchr
impl UnwindSafe for Pikchr
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,