mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-11 13:38:35 +00:00
use &str instead of String
This commit is contained in:
parent
2d8ae7c9d0
commit
5f5450487f
@ -752,7 +752,7 @@ CTRL+click on individual component to input value.\n",
|
||||
}
|
||||
|
||||
for i in lines.iter() {
|
||||
if state.filter.pass_filter(String::from(*i)) {
|
||||
if state.filter.pass_filter(i) {
|
||||
ui.bullet_text(i);
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,7 +63,8 @@ impl TextFilter {
|
||||
/// Returns true if the buffer matches the filter.
|
||||
///
|
||||
/// [`draw()`](Self::draw) or [`build()`](Self::build) mut be called **before** this function.
|
||||
pub fn pass_filter(&self, mut buf: String) -> bool {
|
||||
pub fn pass_filter(&self, buf: &str) -> bool {
|
||||
let mut buf = String::from(buf);
|
||||
buf.push('\0');
|
||||
let ptr = buf.as_mut_ptr();
|
||||
unsafe {
|
||||
@ -71,7 +72,8 @@ impl TextFilter {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn pass_filter_with_end(&self, mut start: String, mut end: String) -> bool {
|
||||
pub fn pass_filter_with_end(&self, start: &str, end: &str) -> bool {
|
||||
let (mut start, mut end) = (String::from(start), String::from(end));
|
||||
start.push('\0');
|
||||
end.push('\0');
|
||||
let b_ptr = start.as_mut_ptr();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user