mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-25 20:38:36 +00:00
Add this back.
Still don't seem to need the import std::convert::From, maybe it's implicit.
This commit is contained in:
parent
2d9f63a1b8
commit
05cb9ccc3f
10
src/lib.rs
10
src/lib.rs
@ -92,6 +92,16 @@ impl<'a> ImStr<'a> {
|
|||||||
fn as_ptr(&self) -> *const c_char { self.bytes.as_ptr() as *const c_char }
|
fn as_ptr(&self) -> *const c_char { self.bytes.as_ptr() as *const c_char }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'a> From<&'a str> for ImStr<'a> {
|
||||||
|
fn from(value: &'a str) -> ImStr<'a> {
|
||||||
|
let mut bytes: Vec<u8> = value.bytes().collect();
|
||||||
|
bytes.push(0);
|
||||||
|
ImStr {
|
||||||
|
bytes: Cow::Owned(bytes)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl From<String> for ImStr<'static> {
|
impl From<String> for ImStr<'static> {
|
||||||
fn from(mut value: String) -> ImStr<'static> {
|
fn from(mut value: String) -> ImStr<'static> {
|
||||||
value.push('\0');
|
value.push('\0');
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user