-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add and Expose Methods of easily Creating and Mutating `ColoredString…
…`'s and `Style`'s for Users (#154) * Initial change (Deref<Target = String> + DerefMut for ColoredString). * Add an example of modifying a ColoredString's text content with DerefMut<Target = String>. * Add methods copy_fgcolor, copy_bgcolor, and copy_style to ColoredString. * Create traits Colorized and CopyColorize, moved style copying functions from ColoredString into CopyColorize, and add StyleTemplate struct to assist with CopyColorize. * Create, implement, and expose methods of creating and modifying Style values for the user. * Fmt + add new_from method to StyleTemplate. * Since Style now implements default, move Default impls for ColoredString and StyleTemplate to derive. * Improve docs for StyleTemplate and espeically Style to be more helpful. * Add builder pattern methods to Style to make them easier to construct and modify. * Add ColorizedMut trait for univeral direct color and style setting. * Impl FromIterator<Styles> for Style and update docs to mention and use that. * Fix docs (remove mention in docs for Style of CLEAR which is private). * Move tests for Style bitwise operations into their own testing submodule. * Fix typos introduced in this branch. * Add big docs for ColoredString in light of all the new implementations as a guide for rustling users. * Make doc examples for Style more readable. * Add impls of bitwise logic ops for Styles for quick creation of Style's. Also, add doc for Styles and improve tests. * Remove StyleTemplate as it didn't really serve enough purpose to justify it existing. * Add clearing methods to ColorizedMut, updated docs to not use 'set to None' and generally improve ColorizedMut docs. * Change section headers for Style docs to be h2's because they look nicer and change the wording on the first section (renamed to "Creation") * Touch up doc for CopyColorize. * Touch up ColorizedMut doc and fix some typos. * Expose fields of ColoredString, remove Colored, ColoredMut, and CopyColorize as they are now unnesecary, and modify docs to reflect the new idioms. * Add note in crate root docs about ColoredString and to see its docs for more info. * Remove modifying_colored_strings example as it was perfectly well explained in the ColoredString docs. * Update CHANGELOG.md * Remove ColoredString.input.[str method] antipattern from docs. * Oops. diff.txt was temp and not supposed to be in there * Add missing assign ops involving Styles and add missing tests for ops. * Add with_style and with_color_and_style methods to Colorize (I can't wait for another PR tbh). * Reset <ColoredString as Deref>::Target to str and change docs and changelog to reflect this. Also, mark ColoredString as non_exhaustive. * Remove with_style and with_color_and_style from Colorize (they might be back in some form in the future). * Somehow the merge messed some formatting up.
- Loading branch information
1 parent
682adf8
commit 949f601
Showing
4 changed files
with
795 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.