pub struct PlotParameters {
pub width: f64,
pub height: f64,
pub border: f64,
pub fill: String,
pub stroke: String,
pub stroke_width: f64,
pub background: Option<String>,
}Expand description
Provides specifications for SVG output.
The SVG will be rescaled to fit within the maximum width and height.
§Example
use l_system_fractals::paths::PlotParameters;
use l_system_fractals::num_validity::AlmostEq;
let json_string = r#"{
"width": 700.0,
"height": 700.0,
"border": 50.0,
"fill": "cyan",
"stroke": "blue",
"stroke_width": 0.5
}"#;
let param1: PlotParameters = serde_json::from_str(json_string).unwrap();
let param2 = PlotParameters {
width: 700.0,
height: 700.0,
border: 50.0,
fill: "cyan".into(),
stroke: "blue".into(),
stroke_width: 0.5,
background: None
};
assert!(param1.almost_eq(¶m2, 0.001));Fields§
§width: f64Maximum width of the SVG.
height: f64Maximum height of the SVG.
border: f64Width of space around plots.
fill: StringValue of the fill attribute in the SVG output (e.g. "none", "LimeGreen",
"#32CD32").
stroke: StringValue of the stroke attribute in the SVG output (e.g. "none", "LimeGreen",
"#32CD32").
stroke_width: f64Value of the stroke-width attribute in the SVG output.
background: Option<String>Value of the fill attribute in a background rectangle.
No background rectangle is drawn if None.
Trait Implementations§
Source§impl AlmostEq for PlotParameters
impl AlmostEq for PlotParameters
Source§impl Clone for PlotParameters
impl Clone for PlotParameters
Source§fn clone(&self) -> PlotParameters
fn clone(&self) -> PlotParameters
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PlotParameters
impl Debug for PlotParameters
Source§impl<'de> Deserialize<'de> for PlotParameters
impl<'de> Deserialize<'de> for PlotParameters
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for PlotParameters
impl PartialEq for PlotParameters
impl StructuralPartialEq for PlotParameters
Auto Trait Implementations§
impl Freeze for PlotParameters
impl RefUnwindSafe for PlotParameters
impl Send for PlotParameters
impl Sync for PlotParameters
impl Unpin for PlotParameters
impl UnwindSafe for PlotParameters
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