Usages of the Options struct #350
-
|
I'm trying to understand the The way I see it, the When calling the core functions separately, like in the WASM-example, the Is that correct? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
Hey @NeverGivinUp, yes, that sounds pretty accurate. My goal was to make the "top-level" functions easy to use for simple things, while also making it possible to customize things further when needed. So you can do let wrapped = textwrap::wrap(some_text, 80);or you can do let wrapped = textwrap::wrap(some_text, Options::new(80).break_words(false).initial_indent(" "));The If your point is that |
Beta Was this translation helpful? Give feedback.
-
Yes, I was mostly confused by the WASM demo using width in several places and wanted to make sure I'm not just overlooking the use of it. I like the simplicity of the use of the top-level function very much :) |
Beta Was this translation helpful? Give feedback.
Hey @NeverGivinUp, yes, that sounds pretty accurate.
My goal was to make the "top-level" functions easy to use for simple things, while also making it possible to customize things further when needed. So you can do
or you can do
The
Optionsstruct is the centralized place which holds the configuration options. When using thecorefunctions, you could just as well create asplitterandword_separatoryourself -- in the WASM demo, I just usedOptions::new(width)since it gives me the defaultsplitterandword_separatorin an easy way.If your point …