mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-12 22:18:36 +00:00
Add capacity_with_nul to ImString
This commit is contained in:
parent
cf587e4de4
commit
cfd887d2ab
@ -152,10 +152,8 @@ impl<'ui, 'p> InputText<'ui, 'p> {
|
||||
pub fn build(self) -> bool {
|
||||
unsafe {
|
||||
imgui_sys::igInputText(self.label.as_ptr(),
|
||||
// TODO: this is evil.
|
||||
// Perhaps something else than &mut str is better
|
||||
self.buf.as_ptr() as *mut i8,
|
||||
self.buf.capacity() + 1,
|
||||
self.buf.capacity_with_nul(),
|
||||
self.flags,
|
||||
None,
|
||||
ptr::null_mut())
|
||||
|
||||
@ -35,6 +35,7 @@ impl ImString {
|
||||
self.0.push(b'\0');
|
||||
}
|
||||
pub fn capacity(&self) -> usize { self.0.capacity() - 1 }
|
||||
pub fn capacity_with_nul(&self) -> usize { self.0.capacity() }
|
||||
pub fn reserve(&mut self, additional: usize) {
|
||||
self.0.reserve(additional);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user