Write docs for iced and iced_native

This commit is contained in:
Héctor Ramón Jiménez 2019-11-22 19:36:57 +01:00
parent ba56a561b2
commit a7dba612f0
30 changed files with 877 additions and 214 deletions

View file

@ -32,9 +32,9 @@ impl Text {
/// Create a new fragment of [`Text`] with the given contents.
///
/// [`Text`]: struct.Text.html
pub fn new(label: &str) -> Self {
pub fn new<T: Into<String>>(label: T) -> Self {
Text {
content: String::from(label),
content: label.into(),
size: None,
color: None,
font: Font::Default,
@ -174,8 +174,15 @@ where
/// [renderer]: ../../renderer/index.html
/// [`UserInterface`]: ../../struct.UserInterface.html
pub trait Renderer: crate::Renderer {
/// Returns the default size of the [`Text`].
///
/// [`Text`]: struct.Text.html
fn default_size(&self) -> u16;
/// Measures the [`Text`] in the given bounds and returns the minimum
/// boundaries that can fit the contents.
///
/// [`Text`]: struct.Text.html
fn measure(
&self,
content: &str,