Skip to content

Comments

Improve GenericStringBuilder documentation#6372

Merged
alamb merged 2 commits intoapache:masterfrom
alamb:alamb/buidler_docs
Sep 11, 2024
Merged

Improve GenericStringBuilder documentation#6372
alamb merged 2 commits intoapache:masterfrom
alamb:alamb/buidler_docs

Conversation

@alamb
Copy link
Contributor

@alamb alamb commented Sep 9, 2024

Which issue does this PR close?

Closes #6347

Rationale for this change

I couldn't quickly discover that it was possible to incrementally build up strings with GenericStringBuilder from the documentation

What changes are included in this PR?

  • Improve documentation and split example of using GenericStringBuilder into 2
  • some small drive by improvements

Are there any user-facing changes?

Documentation change only, no functional changes

Screenshot 2024-09-09 at 10 01 52 AM

@github-actions github-actions bot added the arrow Changes to the arrow crate label Sep 9, 2024
///
/// Additionally, implements [`std::fmt::Write`] with any written data included in the next
/// appended value. This allows use with [`std::fmt::Display`] without intermediate allocations
/// This builder also implements [`std::fmt::Write`] with any written data
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The point of the PR was to make this feature clearer

/// with standard Rust idioms like `write!` and `writeln!` to write data
/// directly to the builder without intermediate allocations.
///
/// # Example writing strings with `append_value`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This style is by far the most common in DataFusion (and I think in other systems)

/// assert_eq!(array.value(1), "v2");
/// ```
///
/// # Example incrementally writing strings with `std::fmt::Write`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This style could be used for certain kernels, so I think it is better t have it as its own example

@alamb
Copy link
Contributor Author

alamb commented Sep 9, 2024

Thank you for the (quick) review @tustvold

@alamb alamb merged commit 6fb59d0 into apache:master Sep 11, 2024
@alamb alamb deleted the alamb/buidler_docs branch September 11, 2024 15:30
@alamb alamb added the documentation Improvements or additions to documentation label Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow Changes to the arrow crate documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ability to append non contiguous strings to StringBuilder

2 participants