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

Is there interest for heapless::CString? #330

Open
vrmiguel opened this issue Dec 26, 2022 · 2 comments · May be fixed by #342
Open

Is there interest for heapless::CString? #330

vrmiguel opened this issue Dec 26, 2022 · 2 comments · May be fixed by #342

Comments

@vrmiguel
Copy link

vrmiguel commented Dec 26, 2022

I believe there's an interesting use-case for heapless::Vec to represent always null-terminated strings for FFI purposes

I've done something like this before in unixstring so I believe I could make a PR for this if the maintainers would like this functionality

// How it could look

let mut path = heapless::CString<128>;

path.append("/home/")?;
path.append(get_username())?;
path.append("/.config/my_app")?;

let config_dir_exists = nix::unistd::access(path.as_cstr(), AccessFlags::F_OK).is_ok();
@jeandudey
Copy link
Contributor

I'd be in favor of something like this, FFI helper types are pretty much lacking in bare-metal environments

@vrmiguel vrmiguel linked a pull request Jan 31, 2023 that will close this issue
@t-moe
Copy link

t-moe commented Sep 26, 2023

I would also be interested in this...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants