Make the set_description API a bit nicer.
This commit is contained in:
parent
feee2bacc3
commit
f7f87104f6
2 changed files with 6 additions and 3 deletions
|
|
@ -47,12 +47,14 @@ impl LabeledItem {
|
||||||
.send(LabeledItemMessage::Title(title.to_string()));
|
.send(LabeledItemMessage::Title(title.to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_description<S>(&self, title: Option<S>)
|
pub fn set_description<S, O>(&self, description: O)
|
||||||
where
|
where
|
||||||
S: ToString,
|
S: ToString,
|
||||||
|
O: Into<Option<S>>,
|
||||||
{
|
{
|
||||||
|
let description = description.into();
|
||||||
self._sender
|
self._sender
|
||||||
.send(LabeledItemMessage::Desc(title.map(|s| s.to_string())));
|
.send(LabeledItemMessage::Desc(description.map(|s| s.to_string())));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_alignment(&self, align: Align) {
|
pub fn set_alignment(&self, align: Align) {
|
||||||
|
|
|
||||||
|
|
@ -45,9 +45,10 @@ impl LabeledItem {
|
||||||
self.inner().model.set_title(title)
|
self.inner().model.set_title(title)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_description<S>(&self, description: Option<S>)
|
pub fn set_description<S, O>(&self, description: O)
|
||||||
where
|
where
|
||||||
S: ToString,
|
S: ToString,
|
||||||
|
O: Into<Option<S>>,
|
||||||
{
|
{
|
||||||
self.inner().model.set_description(description)
|
self.inner().model.set_description(description)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue