heapless icon indicating copy to clipboard operation
heapless copied to clipboard

Is there interest for `heapless::CString`?

Open vrmiguel opened this issue 2 years ago • 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();

vrmiguel avatar Dec 26 '22 15:12 vrmiguel

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

jeandudey avatar Jan 20 '23 12:01 jeandudey

I would also be interested in this...

t-moe avatar Sep 26 '23 13:09 t-moe