MCPcopy Index your code
hub / github.com/concoct-rs/concoct

github.com/concoct-rs/concoct @v0.18.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.18.0 ↗ · + Follow
70 symbols 129 edges 21 files 20 documented · 29%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Concoct

Crates.io version docs.rs docs CI status

Examples

Concoct is a framework for user-interfaces in Rust.

This crate provides a diffing-engine 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. Updates to state re-render your application top-down, starting at the state's parent component.

struct App;

impl ViewBuilder for App {
    fn build(&self) -> impl View {
        let (count, set_high) = use_state(|| 0);
        let set_low = set_high.clone();

        (
            format!("High five count: {}", count),
            html::button("Up high!").on_click(move |_| set_high(count + 1)),
            html::button("Down low!").on_click(move |_| set_low(count - 1)),
        )
    }
}

Components

struct Readme {
    crate_name: String,
    version: String,
}

impl ViewBuilder for Readme {
    fn build(&self) -> impl View {
        let (content, set_content) = use_state(|| None);

        use_effect(&self.crate_name, || {
            let name = self.crate_name.clone();
            let version = self.version.clone();
            spawn_local(async move {
                let readme = api::get_readme(&name, &version).await;
                set_content(Some(readme));
            })
        });

        content
            .map(|content| OneOf2::A(content))
            .unwrap_or_else(|| OneOf2::B("Loading..."))
    }
}

struct App;

impl ViewBuilder for App {
    fn build(&self) -> impl View {
        Readme {
            crate_name: String::from("concoct"),
            version: String::from("1.0"),
        }
    }
}

Installation

The easiest way to get started is using the full feature flag.

cargo add concoct --features full

To see a list of the available features flags that can be enabled, check our docs.

Extension points exported contracts — how you extend this code

View (Interface)
Viewable component of a user-interface. This trait creates a statically-typed tree of views for efficient state updates [6 …
crates/concoct/src/view/mod.rs
Tree (Interface)
Statically-typed view tree. This trait is unsafe and intended as the lower-level backend of [`View`](crate::View). [6 …
crates/concoct/src/tree/mod.rs
ViewBuilder (Interface)
Builder for a [`View`]. [`View`] is implemented for anything that implements this trait. [5 implementers]
crates/concoct/src/view_builder.rs
AnyTree (Interface)
(no doc) [1 implementers]
crates/concoct/src/view/cell.rs

Core symbols most depended-on inside this repo

clone
called by 31
crates/concoct/src/view/cell.rs
use_ref
called by 5
crates/concoct/src/hook/use_ref.rs
try_rebuild_with_limit_inner
called by 4
crates/concoct/src/vdom.rs
remove
called by 4
crates/concoct/src/tree/mod.rs
as_tree
called by 3
crates/concoct/src/view/cell.rs
use_provider
called by 3
crates/concoct/src/hook/use_context.rs
enter
called by 2
crates/concoct/src/rt.rs
build
called by 2
crates/concoct/src/vdom.rs

Shape

Method 41
Class 15
Function 10
Interface 4

Languages

Rust100%

Modules by API surface

crates/concoct/src/view/cell.rs10 symbols
crates/concoct/src/vdom.rs8 symbols
crates/concoct/src/view/memo.rs6 symbols
crates/concoct/src/rt.rs6 symbols
crates/concoct-web/src/html.rs6 symbols
crates/concoct/src/view/empty.rs5 symbols
crates/concoct/src/tree/node.rs5 symbols
crates/concoct/src/tree/mod.rs4 symbols
crates/concoct-web/src/lib.rs4 symbols
web_examples/counter/src/main.rs3 symbols
crates/concoct/src/lib.rs3 symbols
crates/concoct/src/view_builder.rs2 symbols

For agents

$ claude mcp add concoct \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page