pub struct MarkupParser<B: Backend> {
pub path: String,
pub failed: bool,
pub error: Option<String>,
pub root: Option<Rc<RefCell<MarkupElement>>>,
pub storage: Option<Rc<RefCell<RendererStorage<B>>>>,
pub current: i32,
pub indexed_elements: Vec<MarkupElement>,
pub contexts: Vec<(String, Vec<MarkupElement>)>,
pub state: HashMap<String, String>,
pub actions: ActionsStorage,
pub global_styles: StylesStorage,
/* private fields */
}
Expand description
To use specific features you can use the macro:
- #[cfg(feature = “test”)] also you can negate something:
- #[cfg(not(test))] To enable something only for test use:
- #[cfg(test)] To allow make a struct printable for debug use:
- #[derive(Debug)]
Fields§
§path: String
§failed: bool
§error: Option<String>
§root: Option<Rc<RefCell<MarkupElement>>>
§storage: Option<Rc<RefCell<RendererStorage<B>>>>
§current: i32
§indexed_elements: Vec<MarkupElement>
§contexts: Vec<(String, Vec<MarkupElement>)>
§state: HashMap<String, String>
§actions: ActionsStorage
§global_styles: StylesStorage
Implementations§
Source§impl<B: Backend> MarkupParser<B>
impl<B: Backend> MarkupParser<B>
pub fn new( path: String, optional_storage: Option<RendererStorage<B>>, initial_state: Option<HashMap<String, String>>, ) -> MarkupParser<B>
pub fn add_action( &mut self, name: &str, action: fn(HashMap<String, String>, Option<MarkupElement>) -> EventResponse, ) -> &mut Self
Sourcepub fn render_ui(&mut self, frame: &mut Frame<'_, B>) -> Result<bool, String>
pub fn render_ui(&mut self, frame: &mut Frame<'_, B>) -> Result<bool, String>
Render the current state of the tree
pub fn add_context(&mut self, node: &MarkupElement)
pub fn remove_context(&mut self, node: &MarkupElement)
pub fn test_check(&self, backend: B) -> Result<(), Box<dyn Error>>
Sourcepub fn ui_loop(
&mut self,
backend: B,
on_event: impl Fn(KeyEvent, HashMap<String, String>) -> EventResponse,
) -> Result<(), Box<dyn Error>>
pub fn ui_loop( &mut self, backend: B, on_event: impl Fn(KeyEvent, HashMap<String, String>) -> EventResponse, ) -> Result<(), Box<dyn Error>>
Starts a render loop. the loop receive a callback thar will return true if the loop must finish.
- on_event: callback thar receive a key event.
pub fn get_element(node: Option<Rc<RefCell<MarkupElement>>>) -> MarkupElement
pub fn extract_element(node: &Rc<RefCell<MarkupElement>>) -> MarkupElement
pub fn is_widget(node_name: &str) -> bool
pub fn is_layout(node_name: &str) -> bool
pub fn get_border(border_value: &str) -> Borders
pub fn get_constraint(constraint: String) -> Constraint
pub fn get_direction(node: &MarkupElement) -> Direction
pub fn get_alignment(node: &MarkupElement) -> Alignment
pub fn process_styles(node: MarkupElement) -> StylesStorage
pub fn get_styles(node: &MarkupElement, focus: bool, active: bool) -> Style
Trait Implementations§
Auto Trait Implementations§
impl<B> Freeze for MarkupParser<B>
impl<B> !RefUnwindSafe for MarkupParser<B>
impl<B> !Send for MarkupParser<B>
impl<B> !Sync for MarkupParser<B>
impl<B> Unpin for MarkupParser<B>
impl<B> !UnwindSafe for MarkupParser<B>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more