Skip to content

Conversation

kaidokert
Copy link

This adds a small convenience function for making ArrayStrings out of null-terminated C-style byte buffers, by truncating the result to first null-terminator, if present.

Of course this a pretty trivial utility to keep as a free-standing function in code that needs to deal with C input, so maybe not a great fit here.

@kaidokert kaidokert marked this pull request as ready for review January 15, 2023 20:39
@Callum-A
Copy link

@bluss anyway we could look to get this merged?

@bluss
Copy link
Owner

bluss commented Jul 19, 2024

Hm it kind of needs a better name or description, doesn't it? Nothing from the current name makes it clear what it does (that it will truncate at the null terminator).

@tbu-
Copy link
Collaborator

tbu- commented Jul 19, 2024

anyway we could look to get this merged?

You can create this function in your own crate, too, by creating an extension trait. You don't have to wait for this (or similar PRs).

@Callum-A
Copy link

anyway we could look to get this merged?

You can create this function in your own crate, too, by creating an extension trait. You don't have to wait for this (or similar PRs).

Yep have done so for now, little wrapper struct does this on our side. Would be a nice one to get merged.

@Callum-A
Copy link

Hm it kind of needs a better name or description, doesn't it? Nothing from the current name makes it clear what it does (that it will truncate at the null terminator).

Fair point, null terminated could be a bit of a misnomer here as it will break at the first null and truncates. Either way this doesn't have to be urgently looked at as we easily implemented this.

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.

4 participants