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,
}
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>

source

pub fn new( path: String, optional_storage: Option<RendererStorage<B>>, initial_state: Option<HashMap<String, String>> ) -> MarkupParser<B>

source

pub fn add_action( &mut self, name: &str, action: fn(_: HashMap<String, String>) -> EventResponse ) -> &mut Self

source

pub fn render_ui(&mut self, frame: &mut Frame<'_, B>)

Render the current state of the tree

source

pub fn add_context(&mut self, node: &MarkupElement)

source

pub fn remove_context(&mut self, node: &MarkupElement)

source

pub fn test_check(&self, backend: B) -> Result<(), Box<dyn Error>>

source

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.
source

pub fn get_element(node: Option<Rc<RefCell<MarkupElement>>>) -> MarkupElement

source

pub fn is_widget(node_name: &str) -> bool

source

pub fn is_layout(node_name: &str) -> bool

source

pub fn get_border(border_value: &str) -> Borders

source

pub fn get_constraint(constraint: String) -> Constraint

source

pub fn get_direction(node: &MarkupElement) -> Direction

source

pub fn get_alignment(node: &MarkupElement) -> Alignment

source

pub fn process_styles(node: MarkupElement) -> StylesStorage

source

pub fn get_styles(node: &MarkupElement, focus: bool) -> Style

Trait Implementations§

source§

impl<B: Backend> Debug for MarkupParser<B>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.