pub enum Maybe<T> {
Value(T),
Nothing,
}Variants§
Implementations§
Source§impl<T> Maybe<T>
impl<T> Maybe<T>
pub fn value(value: T) -> Maybe<T>
Sourcepub fn update<S>(&mut self, value: S)where
S: Into<T>,
pub fn update<S>(&mut self, value: S)where
S: Into<T>,
Examples found in repository?
examples/demo_basic.rs (line 90)
78pub fn basic_plot() -> RenderResult<()> {
79
80 // initialize the plot
81 let mut plot = BasicPlot::new();
82
83 // configure where to save the output file (must be PNG at the moment)
84 plot.config().terminal().output().update("./.tmp/output.png");
85 plot.config().terminal().font().update("Helvetica", 9);
86 plot.config().terminal().size().update(1200, 800);
87
88 // update various fields
89 plot.x().label().update("X");
90 plot.y().label().update("Y");
91 plot.title().update("A basic plot");
92
93 // we need to generate some data into a `Serie` struct. At the moment, only f64 falues are allowed.
94 let mut data_1 = Serie::with_title("Data series 1");
95 let mut data_2 = Serie::with_title("Data series 2");
96 for i in 1..=20 {
97 data_1.add((i*i) as f64);
98 data_2.add(i as f64);
99 }
100
101 // data series are added individually at this time
102 plot.series().add(data_1);
103 plot.series().add(data_2);
104
105 plot.render()
106}pub fn unwrap(self) -> T
Trait Implementations§
Source§impl<T> GnuCommandFactory for Maybe<T>where
T: GnuCommandFactory,
impl<T> GnuCommandFactory for Maybe<T>where
T: GnuCommandFactory,
fn as_commands(&self) -> Result<VecDeque<GnuCommand>, GnuCommandFactoryError>
impl<T> Copy for Maybe<T>where
T: Copy,
impl<T> Eq for Maybe<T>where
T: Eq,
impl<T> StructuralPartialEq for Maybe<T>
Auto Trait Implementations§
impl<T> Freeze for Maybe<T>where
T: Freeze,
impl<T> RefUnwindSafe for Maybe<T>where
T: RefUnwindSafe,
impl<T> Send for Maybe<T>where
T: Send,
impl<T> Sync for Maybe<T>where
T: Sync,
impl<T> Unpin for Maybe<T>where
T: Unpin,
impl<T> UnwindSafe for Maybe<T>where
T: 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