diff options
author | 2019-11-22 19:36:57 +0100 | |
---|---|---|
committer | 2019-11-22 19:36:57 +0100 | |
commit | a7dba612f03e58d7bd9527499d893987986b347c (patch) | |
tree | b8c3d8f997b714aa368bd6eaecf14065f7645c77 /native/src/widget/text.rs | |
parent | ba56a561b254c9a5f3d23cb54d23dc311759ab4c (diff) | |
download | iced-a7dba612f03e58d7bd9527499d893987986b347c.tar.gz iced-a7dba612f03e58d7bd9527499d893987986b347c.tar.bz2 iced-a7dba612f03e58d7bd9527499d893987986b347c.zip |
Write docs for `iced` and `iced_native`
Diffstat (limited to 'native/src/widget/text.rs')
-rw-r--r-- | native/src/widget/text.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/native/src/widget/text.rs b/native/src/widget/text.rs index c4ab88d3..cf0701b9 100644 --- a/native/src/widget/text.rs +++ b/native/src/widget/text.rs @@ -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, |