rust-embedded/heapless

Is there interest for `heapless::CString`?

vrmiguel opened this issue · 2 comments

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();

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

t-moe commented

I would also be interested in this...