Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tui-big-text)!: make BigText builder infallible #14

Merged
merged 1 commit into from
Jul 25, 2024
Merged

Conversation

joshka
Copy link
Owner

@joshka joshka commented Jul 25, 2024

BigTextBuilder.build() no longer returns a Result. Instead it returns
the BigText widget directly. This change is made to simplify rendering
code which often otherwise doesn't have any error conditions.

This also makes the fields on BigText public (marked as non-exhaustive)

BREAKING CHANGE: BigTextBuilder.build() no longer returns a Result.

Remove the ? / expect / unwrap calls code which calls the build
method.

 let big_text = BigText::builder()
     .lines(vec![Line::from("SingleLine")])
-    .build()?;
+    .build();

BigTextBuilder.build() no longer returns a Result. Instead it returns
the BigText widget directly. This change is made to simplify rendering
code which often otherwise doesn't have any error conditions.

BREAKING CHANGE: BigTextBuilder.build() no longer returns a Result.

Remove the `?` / `expect` / `unwrap` calls code which calls the build
method.

```diff
 let big_text = BigText::builder()
     .lines(vec![Line::from("SingleLine")])
-    .build()?;
+    .build();
```
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 0.00%. Comparing base (fd88898) to head (283249b).

Additional details and impacted files
@@          Coverage Diff          @@
##            main     #14   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files          2       2           
  Lines        136     136           
=====================================
  Misses       136     136           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@joshka joshka merged commit db32ec2 into main Jul 25, 2024
11 checks passed
@joshka joshka deleted the build-result branch July 25, 2024 07:56
@github-actions github-actions bot mentioned this pull request Jul 25, 2024
joshka pushed a commit that referenced this pull request Jul 25, 2024
## 🤖 New release
* `tui-big-text`: 0.4.7 -> 0.5.0
* `tui-widgets`: 0.1.5 -> 0.2.0

<details><summary><i><b>Changelog</b></i></summary><p>

## `tui-big-text`
<blockquote>

## [0.5.0] - 2024-07-25

### 🚀 Features

- *(tui-big-text)* Add alignment helper methods
> Adds helper methods to the `BigTextBuilder` struct to set the
alignment
  > of the text. This makes it simpler to set the alignment of the text.
  >
  > ```rust
  > let left = BigText::builder()
  >     .left_aligned()
  >     .lines(vec!["Left".white().into()])
  >     .build()?;
  >
  > let right = BigText::builder()
  >     .right_aligned()
  >     .lines(vec!["Right".green().into()])
  >     .build()?;
  >
  > let centered = BigText::builder()
  >     .centered()
  >     .lines(vec!["Centered".red().into()])
  >     .build()?;
  > ```

- *(tui-big-text)* [**breaking**] Make `BigText` builder infallible
([#14](#14))
> BigTextBuilder.build() no longer returns a Result. Instead it returns
> the BigText widget directly. This change is made to simplify rendering
  > code which often otherwise doesn't have any error conditions.
  >
> This also makes the fields on BigText public (marked as
non-exhaustive)
  >
  > BREAKING CHANGE:BigTextBuilder.build() no longer returns a Result.
  >
> Remove the `?` / `expect` / `unwrap` calls code which calls the build
  > method.
  >
  > ```diff
  >  let big_text = BigText::builder()
  >      .lines(vec![Line::from("SingleLine")])
  > -    .build()?;
  > +    .build();
  > ```

### 📚 Documentation

- Simplify tui-big-text examples

<!-- generated by git-cliff -->
</blockquote>

## `tui-widgets`
<blockquote>

## [0.2.0] - 2024-07-25

### 🚀 Features

- *(tui-big-text)* Add alignment helper methods
> Adds helper methods to the `BigTextBuilder` struct to set the
alignment
  > of the text. This makes it simpler to set the alignment of the text.
  >
  > ```rust
  > let left = BigText::builder()
  >     .left_aligned()
  >     .lines(vec!["Left".white().into()])
  >     .build()?;
  >
  > let right = BigText::builder()
  >     .right_aligned()
  >     .lines(vec!["Right".green().into()])
  >     .build()?;
  >
  > let centered = BigText::builder()
  >     .centered()
  >     .lines(vec!["Centered".red().into()])
  >     .build()?;
  > ```

- *(tui-big-text)* [**breaking**] Make `BigText` builder infallible
([#14](#14))
> BigTextBuilder.build() no longer returns a Result. Instead it returns
> the BigText widget directly. This change is made to simplify rendering
  > code which often otherwise doesn't have any error conditions.
  >
> This also makes the fields on BigText public (marked as
non-exhaustive)
  >
  > BREAKING CHANGE:BigTextBuilder.build() no longer returns a Result.
  >
> Remove the `?` / `expect` / `unwrap` calls code which calls the build
  > method.
  >
  > ```diff
  >  let big_text = BigText::builder()
  >      .lines(vec![Line::from("SingleLine")])
  > -    .build()?;
  > +    .build();
  > ```

### 📚 Documentation

- Fixup readme

- Simplify tui-big-text examples

### ⚙️ Miscellaneous Tasks

- Include commit body in changelog

<!-- generated by git-cliff -->
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/MarcoIeni/release-plz/).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants