improv: section descriptions may now be stored as static strings
This commit is contained in:
parent
1460ab723d
commit
926692200d
14 changed files with 261 additions and 250 deletions
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
use derive_setters::Setters;
|
||||
use regex::Regex;
|
||||
use std::borrow::Cow;
|
||||
|
||||
use crate::{Binder, Page};
|
||||
|
||||
|
|
@ -29,7 +30,8 @@ pub type ViewFn<Message> = Box<
|
|||
pub struct Section<Message> {
|
||||
#[setters(into)]
|
||||
pub title: String,
|
||||
pub descriptions: Vec<String>,
|
||||
#[setters(into)]
|
||||
pub descriptions: Vec<Cow<'static, str>>,
|
||||
#[setters(skip)]
|
||||
pub show_while: Option<ShowWhileFn<Message>>,
|
||||
#[setters(skip)]
|
||||
|
|
@ -61,8 +63,8 @@ impl<Message: 'static> Section<Message> {
|
|||
return true;
|
||||
}
|
||||
|
||||
for description in &self.descriptions {
|
||||
if rule.is_match(description.as_str()) {
|
||||
for description in &*self.descriptions {
|
||||
if rule.is_match(description) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue