Write documentation for the new canvas API

This commit is contained in:
Héctor Ramón Jiménez 2020-04-30 07:38:46 +02:00
parent 1501a93915
commit d4c4198f72
8 changed files with 122 additions and 17 deletions

View file

@ -1,5 +1,13 @@
use crate::Primitive;
/// A bunch of shapes that can be drawn.
///
/// [`Geometry`] can be easily generated with a [`Frame`] or stored in a
/// [`Cache`].
///
/// [`Geometry`]: struct.Geometry.html
/// [`Frame`]: struct.Frame.html
/// [`Cache`]: struct.Cache.html
#[derive(Debug, Clone)]
pub struct Geometry(Primitive);
@ -8,6 +16,12 @@ impl Geometry {
Self(primitive)
}
/// Turns the [`Geometry`] into a [`Primitive`].
///
/// This can be useful if you are building a custom widget.
///
/// [`Geometry`]: struct.Geometry.html
/// [`Primitive`]: ../enum.Primitive.html
pub fn into_primitive(self) -> Primitive {
self.0
}