Struct SvgOutput

Source
pub struct SvgOutput<'w> { /* private fields */ }
Expand description

Output to SVG file format!

Implementations§

Source§

impl<'w> SvgOutput<'w>

Source

pub fn new(file: &'w mut dyn Write) -> Self

Examples found in repository?
examples/plot.rs (line 15)
8fn main() {
9    simple_logger::init().unwrap();
10
11    let x = vec![1.0, 2.0, 3.0, 4.0, 5.0, 8.0];
12    let y = vec![9.0, 2.2, 5.5, 2.2, 1.2, 1.7];
13
14    let mut buffer = File::create("plot.svg").unwrap();
15    let mut canvas = SvgOutput::new(&mut buffer);
16
17    let size = Size::new(1000.0, 1000.0);
18    plot(&mut canvas, x, y, size);
19}

Trait Implementations§

Source§

impl<'w> Canvas for SvgOutput<'w>

Implement the canvas API for svg output!

Source§

fn draw_line(&mut self, points: &[Point])

Draw a line between points.

Source§

fn set_pen(&mut self, color: Color)

Source§

fn print_text(&mut self, p: &Point, text: &str)

Source§

fn draw_polygon(&mut self, points: &[Point])

Source§

fn fill_polygon(&mut self, points: &[Point])

Source§

impl<'w> Drop for SvgOutput<'w>

Implement drop destructor so we can write the closing svg tag.

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'w> Freeze for SvgOutput<'w>

§

impl<'w> !RefUnwindSafe for SvgOutput<'w>

§

impl<'w> !Send for SvgOutput<'w>

§

impl<'w> !Sync for SvgOutput<'w>

§

impl<'w> Unpin for SvgOutput<'w>

§

impl<'w> !UnwindSafe for SvgOutput<'w>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.