Skip to content

Commit

Permalink
use API with lifetimes
Browse files Browse the repository at this point in the history
  • Loading branch information
rambip committed Nov 17, 2023
1 parent e536ecd commit 58db54d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub use rust_web_markdown::{
};


pub type MdComponentProps = WMdComponentProps<MarkdownContext>;
pub type MdComponentProps = WMdComponentProps<'static, MarkdownContext>;

use leptos::*;
use leptos::html::AnyElement;
Expand All @@ -26,7 +26,7 @@ pub mod debug {
pub struct EventInfo(pub WriteSignal<Vec<String>>);
}

impl WebFramework for MarkdownContext {
impl WebFramework<'static> for MarkdownContext {
type View = View;

type HtmlCallback<T: 'static> = Callback<T, leptos::HtmlElement<AnyElement>>;
Expand Down Expand Up @@ -56,7 +56,7 @@ impl WebFramework for MarkdownContext {
&self,
e: HtmlElement,
inside: Self::View,
attributes: ElementAttributes<Self>,
attributes: ElementAttributes<'static, Self>,
) -> Self::View {
let mut r: leptos::HtmlElement<AnyElement> = match e {
HtmlElement::Div => html::div().into_any(),
Expand Down Expand Up @@ -98,7 +98,7 @@ impl WebFramework for MarkdownContext {
r.into_view()
}

fn el_hr(&self, attributes: ElementAttributes<Self>) -> Self::View {
fn el_hr(&self, attributes: ElementAttributes<'static, Self>) -> Self::View {
let mut r = html::hr();

if let Some(s) = attributes.style {
Expand Down Expand Up @@ -149,7 +149,7 @@ impl WebFramework for MarkdownContext {
.append_child(&link).unwrap();
}

fn el_input_checkbox(&self, checked: bool, attributes: ElementAttributes<Self>) -> Self::View {
fn el_input_checkbox(&self, checked: bool, attributes: ElementAttributes<'static, Self>) -> Self::View {
let mut r = html::input()
.attr("type", "checkbox")
.attr("checked", checked)
Expand Down Expand Up @@ -196,7 +196,7 @@ pub fn Markdown(

///
#[prop(optional, into)]
render_links: Option<Callback<LinkDescription<MarkdownContext>, leptos::HtmlElement<AnyElement>>>,
render_links: Option<Callback<LinkDescription<'static, MarkdownContext>, leptos::HtmlElement<AnyElement>>>,

/// the name of the theme used for syntax highlighting.
/// Only the default themes of [syntect::Theme] are supported
Expand Down

0 comments on commit 58db54d

Please sign in to comment.