Make naming scheme more consistent
Constructor functions that set/overwrite a value are called with_*, functions that add a value are called and_*.
This commit is contained in:
parent
0f21c3701e
commit
638a449343
7 changed files with 144 additions and 170 deletions
|
|
@ -16,12 +16,12 @@ impl Block {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn border(mut self, color: Srgba) -> Self {
|
||||
pub fn with_border(mut self, color: Srgba) -> Self {
|
||||
self.border = color;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn background(mut self, color: Srgba) -> Self {
|
||||
pub fn with_background(mut self, color: Srgba) -> Self {
|
||||
self.background = color;
|
||||
self
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,19 +96,19 @@ impl Text {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn chunk_plain<S: ToString>(mut self, text: S) -> Self {
|
||||
pub fn and_plain<S: ToString>(mut self, text: S) -> Self {
|
||||
let chunk = (self.default_attrs.clone(), text.to_string());
|
||||
self.chunks.push(chunk);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn chunk_rich<S: ToString>(mut self, attrs: Attrs<'_>, text: S) -> Self {
|
||||
pub fn and_rich<S: ToString>(mut self, attrs: Attrs<'_>, text: S) -> Self {
|
||||
let chunk = (AttrsOwned::new(attrs), text.to_string());
|
||||
self.chunks.push(chunk);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn chunks<I>(mut self, chunks: I) -> Self
|
||||
pub fn and_chunks<I>(mut self, chunks: I) -> Self
|
||||
where
|
||||
I: IntoIterator<Item = (AttrsOwned, String)>,
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue