-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
2 additions
and
695 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1 @@ | ||
//! Concoct is a framework for user-interfaces in Rust. | ||
//! | ||
//! This crate provides a virtual DOM and state management system for any backend. | ||
//! Concoct uses static typing to describe your UI at compile-time to create an efficient | ||
//! tree without allocations. | ||
//! | ||
//! ```ignore | ||
//! use concoct::{Scope, View}; | ||
//! use concoct_web::html; | ||
//! | ||
//! #[derive(Default)] | ||
//! struct Counter { | ||
//! count: i32, | ||
//! } | ||
//! | ||
//! impl View<Self> for Counter { | ||
//! fn body(&mut self, _cx: &Scope<Self>) -> impl View<Self> { | ||
//! ( | ||
//! format!("High five count: {}", self.count), | ||
//! html::button("Up high!").on_click(|_cx, state: &mut Self, _event| state.count += 1), | ||
//! html::button("Down low!").on_click(|_cx, state: &mut Self, _event| state.count -= 1), | ||
//! ) | ||
//! } | ||
//! } | ||
//! | ||
//! fn main() { | ||
//! concoct_web::launch(Counter::default()) | ||
//! } | ||
//! ``` | ||
//! | ||
|
||
#![deny(missing_docs)] | ||
|
||
use std::ops::DerefMut; | ||
|
||
mod action; | ||
pub use self::action::{Action, IntoAction}; | ||
|
||
mod handle; | ||
pub use self::handle::Handle; | ||
|
||
pub mod hook; | ||
|
||
mod vdom; | ||
pub use self::vdom::VirtualDom; | ||
|
||
pub mod view; | ||
pub use self::view::View; | ||
|
||
mod scope; | ||
pub use self::scope::Scope; | ||
|
||
/// Run a view on a new virtual dom. | ||
pub async fn run<T, V>(content: V) | ||
where | ||
T: 'static, | ||
V: View<T> + DerefMut<Target = T>, | ||
{ | ||
let mut vdom = VirtualDom::new(content); | ||
vdom.build(); | ||
|
||
loop { | ||
vdom.rebuild().await; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.