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(table): accept Into<Constraint> for widths #745

Merged
merged 1 commit into from
Jan 5, 2024

Conversation

joshka
Copy link
Member

@joshka joshka commented Jan 5, 2024

This allows Table constructors to accept any type that implements
Into instead of just AsRef. This is useful when
you want to specify a fixed size for a table columns, but don't want to
explicitly create a Constraint::Length yourself.

Table::new(rows, [1,2,3])
Table::default().widths([1,2,3])

PR includes #744 - merge that first

Copy link

codecov bot commented Jan 5, 2024

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (659460e) 92.3% compared to head (bb73aa2) 92.3%.
Report is 2 commits behind head on main.

❗ Current head bb73aa2 differs from pull request most recent head 46c62e1. Consider uploading reports for the commit 46c62e1 to get more accurate results

Files Patch % Lines
src/layout/constraint.rs 50.0% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main    #745     +/-   ##
=======================================
- Coverage   92.3%   92.3%   -0.1%     
=======================================
  Files         52      52             
  Lines      14806   14811      +5     
=======================================
+ Hits       13672   13674      +2     
- Misses      1134    1137      +3     

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

@joshka joshka force-pushed the table-accept-into-constraint branch from 455c140 to bb73aa2 Compare January 5, 2024 05:54
This allows Table constructors to accept any type that implements
Into<Constraint> instead of just AsRef<Constraint>. This is useful when
you want to specify a fixed size for a table columns, but don't want to
explicitly create a Constraint::Length yourself.

```rust
Table::new(rows, [1,2,3])
Table::default().widths([1,2,3])
```
@joshka joshka force-pushed the table-accept-into-constraint branch from bb73aa2 to 46c62e1 Compare January 5, 2024 06:37
@joshka joshka marked this pull request as ready for review January 5, 2024 06:37
@joshka joshka merged commit 803a72d into main Jan 5, 2024
31 checks passed
@joshka joshka deleted the table-accept-into-constraint branch January 5, 2024 06:41
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.

None yet

2 participants