pub trait Context<'a, 'callback>: Copy + 'awhere
'callback: 'a,{
type View: Clone + 'callback;
type Handler<T: 'callback>: 'callback;
type MouseEvent: 'static;
Show 25 methods
// Required methods
fn props(self) -> MarkdownProps;
fn set_frontmatter(&mut self, frontmatter: String);
fn render_links(
self,
link: LinkDescription<Self::View>,
) -> Result<Self::View, String>;
fn call_handler<T>(callback: &Self::Handler<T>, input: T);
fn make_md_handler(
self,
position: Range<usize>,
stop_propagation: bool,
) -> Self::Handler<Self::MouseEvent>;
fn el_with_attributes(
self,
e: HtmlElement,
inside: Self::View,
attributes: ElementAttributes<Self::Handler<Self::MouseEvent>>,
) -> Self::View;
fn el_span_with_inner_html(
self,
inner_html: String,
attributes: ElementAttributes<Self::Handler<Self::MouseEvent>>,
) -> Self::View;
fn el_hr(
self,
attributes: ElementAttributes<Self::Handler<Self::MouseEvent>>,
) -> Self::View;
fn el_br(self) -> Self::View;
fn el_fragment(self, children: Vec<Self::View>) -> Self::View;
fn el_a(self, children: Self::View, href: String) -> Self::View;
fn el_img(self, src: String, alt: String) -> Self::View;
fn el_text(self, text: CowStr<'a>) -> Self::View;
fn el_input_checkbox(
self,
checked: bool,
attributes: ElementAttributes<Self::Handler<Self::MouseEvent>>,
) -> Self::View;
fn mount_dynamic_link(
self,
rel: &str,
href: &str,
integrity: &str,
crossorigin: &str,
);
fn has_custom_component(self, name: &str) -> bool;
fn render_custom_component(
self,
name: &str,
input: MdComponentProps<Self::View>,
) -> Result<Self::View, ComponentCreationError>;
fn has_custom_links(self) -> bool;
// Provided methods
fn el(self, e: HtmlElement, inside: Self::View) -> Self::View { ... }
fn el_empty(self) -> Self::View { ... }
fn render_tasklist_marker(
self,
m: bool,
position: Range<usize>,
) -> Self::View { ... }
fn render_rule(self, range: Range<usize>) -> Self::View { ... }
fn render_code(self, s: CowStr<'a>, range: Range<usize>) -> Self::View { ... }
fn render_text(self, s: CowStr<'a>, range: Range<usize>) -> Self::View { ... }
fn render_link(
self,
link: LinkDescription<Self::View>,
) -> Result<Self::View, String> { ... }
}Required Associated Types§
type View: Clone + 'callback
type Handler<T: 'callback>: 'callback
type MouseEvent: 'static
Required Methods§
Sourcefn props(self) -> MarkdownProps
fn props(self) -> MarkdownProps
get all the properties from the context
Sourcefn set_frontmatter(&mut self, frontmatter: String)
fn set_frontmatter(&mut self, frontmatter: String)
write the frontmatter (or metadata) string present at the top of the markdown source
fn render_links( self, link: LinkDescription<Self::View>, ) -> Result<Self::View, String>
Sourcefn call_handler<T>(callback: &Self::Handler<T>, input: T)
fn call_handler<T>(callback: &Self::Handler<T>, input: T)
calls a callback with the given input
Sourcefn make_md_handler(
self,
position: Range<usize>,
stop_propagation: bool,
) -> Self::Handler<Self::MouseEvent>
fn make_md_handler( self, position: Range<usize>, stop_propagation: bool, ) -> Self::Handler<Self::MouseEvent>
creates a callback that will fire when the user clicks on markdown
Sourcefn el_with_attributes(
self,
e: HtmlElement,
inside: Self::View,
attributes: ElementAttributes<Self::Handler<Self::MouseEvent>>,
) -> Self::View
fn el_with_attributes( self, e: HtmlElement, inside: Self::View, attributes: ElementAttributes<Self::Handler<Self::MouseEvent>>, ) -> Self::View
creates a html element
attributes contains the html attributes for this element
Sourcefn el_span_with_inner_html(
self,
inner_html: String,
attributes: ElementAttributes<Self::Handler<Self::MouseEvent>>,
) -> Self::View
fn el_span_with_inner_html( self, inner_html: String, attributes: ElementAttributes<Self::Handler<Self::MouseEvent>>, ) -> Self::View
renders raw html, inside a span
Sourcefn el_hr(
self,
attributes: ElementAttributes<Self::Handler<Self::MouseEvent>>,
) -> Self::View
fn el_hr( self, attributes: ElementAttributes<Self::Handler<Self::MouseEvent>>, ) -> Self::View
renders a hr element, with attributes
Sourcefn el_fragment(self, children: Vec<Self::View>) -> Self::View
fn el_fragment(self, children: Vec<Self::View>) -> Self::View
takes a vector of views and return a view
fn el_input_checkbox( self, checked: bool, attributes: ElementAttributes<Self::Handler<Self::MouseEvent>>, ) -> Self::View
Sourcefn mount_dynamic_link(
self,
rel: &str,
href: &str,
integrity: &str,
crossorigin: &str,
)
fn mount_dynamic_link( self, rel: &str, href: &str, integrity: &str, crossorigin: &str, )
add a styleshit to the markdown component
fn has_custom_component(self, name: &str) -> bool
fn render_custom_component( self, name: &str, input: MdComponentProps<Self::View>, ) -> Result<Self::View, ComponentCreationError>
fn has_custom_links(self) -> bool
Provided Methods§
Sourcefn el(self, e: HtmlElement, inside: Self::View) -> Self::View
fn el(self, e: HtmlElement, inside: Self::View) -> Self::View
creates a html element, with default attributes
fn render_tasklist_marker(self, m: bool, position: Range<usize>) -> Self::View
fn render_rule(self, range: Range<usize>) -> Self::View
fn render_code(self, s: CowStr<'a>, range: Range<usize>) -> Self::View
fn render_text(self, s: CowStr<'a>, range: Range<usize>) -> Self::View
fn render_link( self, link: LinkDescription<Self::View>, ) -> Result<Self::View, String>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.