repo stringlengths 6 65 | file_url stringlengths 81 311 | file_path stringlengths 6 227 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:31:58 2026-01-04 20:25:31 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/rsx-rosetta/tests/web-component.rs | packages/rsx-rosetta/tests/web-component.rs | use html_parser::Dom;
#[test]
fn web_components_translate() {
let html = r#"
<div>
<my-component></my-component>
</div>
"#
.trim();
let dom = Dom::parse(html).unwrap();
let body = dioxus_rsx_rosetta::rsx_from_html(&dom);
let out = dioxus_autofmt::write_block_out(&body).unwrap(... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/rsx-rosetta/tests/simple.rs | packages/rsx-rosetta/tests/simple.rs | use html_parser::Dom;
#[test]
fn simple_elements() {
let html = r#"
<div>
<div class="asd">hello world!</div>
<div id="asd">hello world!</div>
<div id="asd">hello world!</div>
<div for="asd">hello world!</div>
<div async="asd">hello world!</div>
</div>
"#
.tr... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/rsx-rosetta/tests/raw.rs | packages/rsx-rosetta/tests/raw.rs | use html_parser::Dom;
#[test]
fn raw_attribute() {
let html = r#"
<div>
<div unrecognizedattribute="asd">hello world!</div>
</div>
"#
.trim();
let dom = Dom::parse(html).unwrap();
let body = dioxus_rsx_rosetta::rsx_from_html(&dom);
let out = dioxus_autofmt::write_block_out(&b... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/rsx-rosetta/tests/svgs.rs | packages/rsx-rosetta/tests/svgs.rs | use html_parser::Dom;
#[test]
fn svgs() {
let viewbox = dioxus_html::map_html_attribute_to_rsx("viewBox");
assert_eq!(viewbox, Some("view_box"));
let html = r###"
<svg xmlns="http://www.w3.org/2000/svg" id="flag-icons-fr" viewBox="0 0 640 480">
<path fill="#fff" d="M0 0h640v480H0z"/>
<path fill="#0000... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/rsx-rosetta/tests/escape.rs | packages/rsx-rosetta/tests/escape.rs | use html_parser::Dom;
// Regression test for https://github.com/DioxusLabs/dioxus/issues/3037
// We need to escape html entities as we translate html because rsx doesn't support them
#[test]
fn escaped_text() {
let html = r#"<div><div>⌛⌛⌛⌛</div>"#.trim();
let dom = Dom::parse... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/rsx-rosetta/examples/html.rs | packages/rsx-rosetta/examples/html.rs | use html_parser::Dom;
fn main() {
let html = r#"
<div>
<div class="asd">hello world!</div>
<div id="asd">hello world!</div>
<div id="asd">hello world!</div>
<div for="asd">hello world!</div>
<div async="asd">hello world!</div>
<div LargeThing="asd">hello world!</... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/ssr/src/config.rs | packages/ssr/src/config.rs | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false | |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/ssr/src/lib.rs | packages/ssr/src/lib.rs | #![doc = include_str!("../README.md")]
#![doc(html_logo_url = "https://avatars.githubusercontent.com/u/79236386")]
#![doc(html_favicon_url = "https://avatars.githubusercontent.com/u/79236386")]
mod cache;
pub mod config;
pub mod renderer;
pub mod template;
use dioxus_core::{Element, VirtualDom};
pub use crate::rende... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/ssr/src/renderer.rs | packages/ssr/src/renderer.rs | use super::cache::Segment;
use crate::cache::StringCache;
use dioxus_core::{
Attribute, AttributeValue, DynamicNode, Element, ScopeId, Template, VNode, VirtualDom,
};
use rustc_hash::FxHashMap;
use std::fmt::Write;
use std::sync::Arc;
type ComponentRenderCallback = Arc<
dyn Fn(&mut Renderer, &mut dyn Write, &... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/ssr/src/template.rs | packages/ssr/src/template.rs | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false | |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/ssr/src/cache.rs | packages/ssr/src/cache.rs | //! Dioxus SSR uses the design of templates to cache as much as possible about the HTML a block of rsx can render.
//!
//! The structure of templates can tell us what segments are rendered where and lets us cache segments in the output string.
//!
//! For example, in this code, we can cache the whole render:
//! ```rus... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/ssr/tests/hydration.rs | packages/ssr/tests/hydration.rs | use dioxus::prelude::*;
#[test]
fn root_ids() {
fn app() -> Element {
rsx! { div { width: "100px" } }
}
let mut dom = VirtualDom::new(app);
dom.rebuild(&mut dioxus_core::NoOpMutations);
assert_eq!(
dioxus_ssr::pre_render(&dom),
r#"<div style="width:100px;" data-node-hydrat... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/ssr/tests/bool_attr.rs | packages/ssr/tests/bool_attr.rs | use dioxus::prelude::*;
#[test]
fn static_boolean_attributes() {
fn app() -> Element {
rsx! {
div { hidden: "false" }
div { hidden: "true" }
}
}
let mut dom = VirtualDom::new(app);
dom.rebuild(&mut dioxus_core::NoOpMutations);
assert_eq!(
dioxus_ssr... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/ssr/tests/styles.rs | packages/ssr/tests/styles.rs | use dioxus::prelude::*;
#[test]
fn static_styles() {
fn app() -> Element {
rsx! { div { width: "100px" } }
}
let mut dom = VirtualDom::new(app);
dom.rebuild(&mut dioxus_core::NoOpMutations);
assert_eq!(
dioxus_ssr::render(&dom),
r#"<div style="width:100px;"></div>"#
);... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/ssr/tests/simple.rs | packages/ssr/tests/simple.rs | #![allow(non_snake_case)]
use dioxus::prelude::*;
#[test]
fn simple() {
fn App() -> Element {
rsx! { div { "hello!" } }
}
let mut dom = VirtualDom::new(App);
dom.rebuild(&mut dioxus_core::NoOpMutations);
assert_eq!(dioxus_ssr::render(&dom), "<div>hello!</div>");
assert_eq!(
... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/ssr/tests/forward_spreads.rs | packages/ssr/tests/forward_spreads.rs | use dioxus::prelude::*;
// Regression test for https://github.com/DioxusLabs/dioxus/issues/3844
#[test]
fn forward_spreads() {
#[derive(Props, Clone, PartialEq)]
struct Comp1Props {
#[props(extends = GlobalAttributes)]
attributes: Vec<Attribute>,
}
#[component]
fn Comp1(props: Comp... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/ssr/tests/spread.rs | packages/ssr/tests/spread.rs | use dioxus::prelude::*;
#[test]
fn spread() {
let dom = VirtualDom::prebuilt(app);
let html = dioxus_ssr::render(&dom);
assert_eq!(
html,
r#"<audio data-custom-attribute="value" style="width:10px;height:10px;left:1;">1: hello1
2: hello2</audio>"#
);
}
fn app() -> Element {
rsx! {
... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/ssr/tests/escape.rs | packages/ssr/tests/escape.rs | use dioxus::prelude::*;
#[test]
fn escape_static_values() {
fn app() -> Element {
rsx! { input { disabled: "\"><div>" } }
}
let mut dom = VirtualDom::new(app);
dom.rebuild(&mut dioxus_core::NoOpMutations);
assert_eq!(
dioxus_ssr::pre_render(&dom),
"<input disabled=\""&... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/ssr/tests/inner_html.rs | packages/ssr/tests/inner_html.rs | use dioxus::prelude::*;
#[test]
fn static_inner_html() {
fn app() -> Element {
rsx! { div { dangerous_inner_html: "<div>1234</div>" } }
}
let mut dom = VirtualDom::new(app);
dom.rebuild(&mut dioxus_core::NoOpMutations);
assert_eq!(dioxus_ssr::render(&dom), r#"<div><div>1234</div></div>"#)... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/wasm-split/wasm-split-macro/src/lib.rs | packages/wasm-split/wasm-split-macro/src/lib.rs | use proc_macro::TokenStream;
use digest::Digest;
use quote::{format_ident, quote};
use syn::{parse_macro_input, parse_quote, FnArg, Ident, ItemFn, ReturnType, Signature};
#[proc_macro_attribute]
pub fn wasm_split(args: TokenStream, input: TokenStream) -> TokenStream {
let module_ident = parse_macro_input!(args as... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/wasm-split/wasm-split/src/lib.rs | packages/wasm-split/wasm-split/src/lib.rs | use std::{
cell::Cell,
ffi::c_void,
future::Future,
pin::Pin,
rc::Rc,
task::{Context, Poll, Waker},
thread::LocalKey,
};
pub use wasm_split_macro::{lazy_loader, wasm_split};
pub type Result<T> = std::result::Result<T, SplitLoaderError>;
#[non_exhaustive]
#[derive(Debug, Clone)]
pub enum S... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/wasm-split/wasm-split-cli/src/lib.rs | packages/wasm-split/wasm-split-cli/src/lib.rs | use anyhow::{Context, Result};
use itertools::Itertools;
use rayon::prelude::{IntoParallelIterator, ParallelIterator};
use std::{
collections::{BTreeMap, BTreeSet, HashMap, HashSet, VecDeque},
hash::Hash,
ops::Range,
sync::{Arc, RwLock},
};
use walrus::{
ir::{self, dfs_in_order, Visitor},
ConstE... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | true |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/wasm-split/wasm-split-cli/src/main.rs | packages/wasm-split/wasm-split-cli/src/main.rs | use clap::Parser;
use std::path::PathBuf;
use wasm_split_cli::SplitModule;
fn main() {
tracing_subscriber::fmt()
.without_time()
.compact()
.with_env_filter("debug,walrus=info")
.init();
match Commands::parse() {
Commands::Split(split_args) => split(split_args),
... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/wasm-split/wasm-used/src/lib.rs | packages/wasm-split/wasm-used/src/lib.rs | use std::collections::HashSet;
use id_arena::Id;
use walrus::{ir::*, ExportId};
use walrus::{ConstExpr, Data, DataId, DataKind, Element, ExportItem, Function};
use walrus::{ElementId, ElementItems, ElementKind, Module, RefType, Type, TypeId};
use walrus::{FunctionId, FunctionKind, Global, GlobalId};
use walrus::{Globa... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/html-internal-macro/src/lib.rs | packages/html-internal-macro/src/lib.rs | use proc_macro::TokenStream;
use convert_case::{Case, Casing};
use proc_macro2::TokenStream as TokenStream2;
use quote::{quote, ToTokens, TokenStreamExt};
use syn::parse::{Parse, ParseStream};
use syn::punctuated::Punctuated;
use syn::{braced, parse_macro_input, Ident, Token};
#[proc_macro]
pub fn impl_extension_attr... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/html-internal-macro/tests/01-simple.rs | packages/html-internal-macro/tests/01-simple.rs | fn main() {}
| rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/html-internal-macro/tests/progress.rs | packages/html-internal-macro/tests/progress.rs | #[test]
fn tests() {
let t = trybuild::TestCases::new();
t.pass("tests/01-simple.rs");
}
| rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/desktop/build.rs | packages/desktop/build.rs | use std::{io::Write as _, path::PathBuf};
fn check_gnu() {
// WARN about wry support on windows gnu targets. GNU windows targets don't work well in wry currently
if std::env::var("CARGO_CFG_WINDOWS").is_ok()
&& std::env::var("CARGO_CFG_TARGET_ENV").unwrap() == "gnu"
&& !cfg!(feature = "gnu")
... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/desktop/headless_tests/rendering.rs | packages/desktop/headless_tests/rendering.rs | use dioxus::prelude::*;
use dioxus_desktop::DesktopContext;
#[path = "./utils.rs"]
mod utils;
fn main() {
#[cfg(not(windows))]
utils::check_app_exits(check_html_renders);
}
fn use_inner_html(id: &'static str) -> Option<String> {
let mut value = use_signal(|| None as Option<String>);
use_effect(move ... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/desktop/headless_tests/utils.rs | packages/desktop/headless_tests/utils.rs | #![allow(unused)] // for whatever reason, the compiler is not recognizing the use of these functions
use dioxus::prelude::*;
use dioxus_core::Element;
pub fn check_app_exits(app: fn() -> Element) {
use dioxus_desktop::tao::window::WindowBuilder;
use dioxus_desktop::Config;
// This is a deadman's switch to... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/desktop/headless_tests/eval.rs | packages/desktop/headless_tests/eval.rs | use dioxus::prelude::*;
use dioxus_desktop::window;
use serde::Deserialize;
#[path = "./utils.rs"]
mod utils;
pub fn main() {
#[cfg(not(windows))]
utils::check_app_exits(app);
}
static EVALS_RECEIVED: GlobalSignal<usize> = Signal::global(|| 0);
static EVALS_RETURNED: GlobalSignal<usize> = Signal::global(|| 0... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/desktop/headless_tests/forms.rs | packages/desktop/headless_tests/forms.rs | use dioxus::prelude::*;
use dioxus_desktop::DesktopContext;
use dioxus_document::eval;
#[path = "./utils.rs"]
mod utils;
fn main() {
#[cfg(not(windows))]
utils::check_app_exits(check_html_renders);
}
async fn inner_html(count: usize) -> String {
let html = document::eval(&format!(
r#"// Wait unti... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/desktop/headless_tests/events.rs | packages/desktop/headless_tests/events.rs | use dioxus::html::geometry::euclid::Vector3D;
use dioxus::prelude::*;
use dioxus_desktop::DesktopContext;
#[path = "./utils.rs"]
mod utils;
pub fn main() {
#[cfg(not(windows))]
utils::check_app_exits(app);
}
static RECEIVED_EVENTS: GlobalSignal<usize> = Signal::global(|| 0);
fn app() -> Element {
let de... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/desktop/src/desktop_context.rs | packages/desktop/src/desktop_context.rs | use crate::{
app::SharedContext,
assets::AssetHandlerRegistry,
file_upload::NativeFileHover,
ipc::UserWindowEvent,
query::QueryEngine,
shortcut::{HotKey, HotKeyState, ShortcutHandle, ShortcutRegistryError},
webview::PendingWebview,
AssetRequest, Config, WindowCloseBehaviour, WryEventHand... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/desktop/src/config.rs | packages/desktop/src/config.rs | use dioxus_core::{LaunchConfig, VirtualDom};
use std::path::PathBuf;
use std::{borrow::Cow, sync::Arc};
use tao::window::{Icon, WindowBuilder};
use tao::{
event_loop::{EventLoop, EventLoopWindowTarget},
window::Window,
};
use wry::http::{Request as HttpRequest, Response as HttpResponse};
use wry::{RequestAsyncR... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/desktop/src/app.rs | packages/desktop/src/app.rs | use crate::{
config::{Config, WindowCloseBehaviour},
edits::EditWebsocket,
event_handlers::WindowEventHandlers,
ipc::{IpcMessage, UserWindowEvent},
query::QueryResult,
shortcut::ShortcutRegistry,
webview::{PendingWebview, WebviewInstance},
};
use dioxus_core::VirtualDom;
use std::{
cell:... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/desktop/src/mobile.rs | packages/desktop/src/mobile.rs | /// Expose the `Java_dev_dioxus_main_WryActivity_create` function to the JNI layer.
/// We hardcode these to have a single trampoline for host Java code to call into.
///
/// This saves us from having to plumb the top-level package name all the way down into
/// this file. This is better for modularity (ie just call di... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/desktop/src/launch.rs | packages/desktop/src/launch.rs | use crate::Config;
use crate::{
app::App,
ipc::{IpcMethod, UserWindowEvent},
};
use dioxus_core::*;
use dioxus_document::eval;
use std::any::Any;
use tao::event::{Event, StartCause, WindowEvent};
/// Launch the WebView and run the event loop, with configuration and root props.
///
/// This will block the main ... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/desktop/src/element.rs | packages/desktop/src/element.rs | use std::rc::Rc;
use dioxus_core::ElementId;
use dioxus_html::{
geometry::{PixelsRect, PixelsSize, PixelsVector2D},
MountedResult, RenderedElementBacking,
};
use crate::{desktop_context::DesktopContext, query::QueryEngine, WeakDesktopContext};
#[derive(Clone)]
/// A mounted element passed to onmounted events... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/desktop/src/lib.rs | packages/desktop/src/lib.rs | #![doc = include_str!("readme.md")]
#![doc(html_logo_url = "https://avatars.githubusercontent.com/u/79236386")]
#![doc(html_favicon_url = "https://avatars.githubusercontent.com/u/79236386")]
#![deny(missing_docs)]
#![cfg_attr(docsrs, feature(doc_cfg))]
mod android_sync_lock;
mod app;
mod assets;
mod config;
mod deskto... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/desktop/src/shortcut.rs | packages/desktop/src/shortcut.rs | #[cfg(any(
target_os = "windows",
target_os = "macos",
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd"
))]
pub use global_hotkey::{
hotkey::{Code, HotKey},
Error as HotkeyError, GlobalHotKeyEvent, GlobalHotKeyManager, H... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/desktop/src/document.rs | packages/desktop/src/document.rs | use crate::{query::Query, DesktopContext, WeakDesktopContext};
use dioxus_core::queue_effect;
use dioxus_document::{
create_element_in_head, Document, Eval, EvalError, Evaluator, LinkProps, MetaProps,
ScriptProps, StyleProps,
};
use generational_box::{AnyStorage, GenerationalBox, UnsyncStorage};
/// Code for ... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/desktop/src/trayicon.rs | packages/desktop/src/trayicon.rs | //! tray icon
use dioxus_core::{provide_context, try_consume_context, use_hook};
#[cfg(not(any(target_os = "ios", target_os = "android")))]
pub use tray_icon::*;
/// tray icon menu type trait
#[cfg(not(any(target_os = "ios", target_os = "android")))]
pub type DioxusTrayMenu = tray_icon::menu::Menu;
#[cfg(any(target_... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/desktop/src/file_upload.rs | packages/desktop/src/file_upload.rs | #![allow(unused)]
use std::{any::Any, collections::HashMap};
#[cfg(feature = "tokio_runtime")]
use tokio::{fs::File, io::AsyncReadExt};
use dioxus_html::{
geometry::{ClientPoint, Coordinates, ElementPoint, PagePoint, ScreenPoint},
input_data::{MouseButton, MouseButtonSet},
point_interaction::{
In... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/desktop/src/edits.rs | packages/desktop/src/edits.rs | //! The internal edit queue facilitating native <-> webview communication.
//!
//! Originally, we used long-polling on the wry custom protocol to send edits to the webview.
//! Due to bugs in wry on android, we switched to a websocket connection that the webview connects to.
//! We use the sledgehammer crate to build b... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/desktop/src/event_handlers.rs | packages/desktop/src/event_handlers.rs | use crate::{ipc::UserWindowEvent, window};
use slab::Slab;
use std::cell::RefCell;
use tao::{event::Event, event_loop::EventLoopWindowTarget, window::WindowId};
/// The unique identifier of a window event handler. This can be used to later remove the handler.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub stru... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/desktop/src/hooks.rs | packages/desktop/src/hooks.rs | use std::rc::Rc;
use crate::{
assets::*, ipc::UserWindowEvent, shortcut::IntoAccelerator, window, DesktopContext,
HotKeyState, ShortcutHandle, ShortcutRegistryError, WryEventHandler,
};
use dioxus_core::{consume_context, use_hook, use_hook_with_cleanup, Runtime};
use dioxus_hooks::use_callback;
use tao::{even... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/desktop/src/android_sync_lock.rs | packages/desktop/src/android_sync_lock.rs | /// This is a hack to get around the fact that wry is currently not thread safe on android
///
/// We want to acquire this mutex before doing anything with the virtualdom directly
pub fn android_runtime_lock() -> std::sync::MutexGuard<'static, ()> {
use std::sync::{Mutex, OnceLock};
static RUNTIME_LOCK: OnceLo... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/desktop/src/menubar.rs | packages/desktop/src/menubar.rs | use tao::window::Window;
#[cfg(not(any(target_os = "ios", target_os = "android")))]
pub type DioxusMenu = muda::Menu;
#[cfg(any(target_os = "ios", target_os = "android"))]
pub type DioxusMenu = ();
/// Initializes the menu bar for the window.
#[allow(unused)]
pub fn init_menu_bar(menu: &DioxusMenu, window: &Window) {... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/desktop/src/waker.rs | packages/desktop/src/waker.rs | use crate::ipc::UserWindowEvent;
use futures_util::task::ArcWake;
use std::sync::Arc;
use tao::{event_loop::EventLoopProxy, window::WindowId};
/// Create a waker that will send a poll event to the event loop.
///
/// This lets the VirtualDom "come up for air" and process events while the main thread is blocked by the ... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/desktop/src/query.rs | packages/desktop/src/query.rs | use crate::{DesktopContext, WeakDesktopContext};
use futures_util::{FutureExt, StreamExt};
use generational_box::Owner;
use serde::{de::DeserializeOwned, Deserialize};
use serde_json::Value;
use slab::Slab;
use std::{cell::RefCell, rc::Rc};
use thiserror::Error;
/// Tracks what query ids are currently active
pub(crate... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/desktop/src/protocol.rs | packages/desktop/src/protocol.rs | use std::path::PathBuf;
use crate::{assets::*, webview::WebviewEdits};
use crate::{document::NATIVE_EVAL_JS, file_upload::FileDialogRequest};
use base64::prelude::BASE64_STANDARD;
use dioxus_core::AnyhowContext;
use dioxus_html::{SerializedFileData, SerializedFormObject};
use dioxus_interpreter_js::unified_bindings::S... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/desktop/src/events.rs | packages/desktop/src/events.rs | //! Convert a serialized event to an event trigger
use crate::{
element::DesktopElement,
file_upload::{DesktopFileDragEvent, DesktopFormData},
};
use dioxus_html::*;
pub(crate) struct SerializedHtmlEventConverter;
impl HtmlEventConverter for SerializedHtmlEventConverter {
/// This impl is special because... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/desktop/src/mobile_shortcut.rs | packages/desktop/src/mobile_shortcut.rs | #![allow(unused)]
use super::*;
use std::str::FromStr;
use tao::event_loop::EventLoopWindowTarget;
use dioxus_html::input_data::keyboard_types::Modifiers;
#[derive(Clone, Debug)]
pub struct Accelerator;
#[derive(Clone, Copy)]
pub struct HotKey;
impl HotKey {
pub fn new(mods: Option<Modifiers>, key: Code) -> Se... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/desktop/src/assets.rs | packages/desktop/src/assets.rs | use dioxus_core::Callback;
use rustc_hash::FxHashMap;
use std::{cell::RefCell, rc::Rc};
use wry::{http::Request, RequestAsyncResponder};
/// A request for an asset within dioxus-desktop.
pub type AssetRequest = Request<Vec<u8>>;
pub struct AssetHandler {
f: Callback<(AssetRequest, RequestAsyncResponder)>,
}
#[de... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/desktop/src/webview.rs | packages/desktop/src/webview.rs | use crate::file_upload::{DesktopFileData, DesktopFileDragEvent};
use crate::menubar::DioxusMenu;
use crate::PendingDesktopContext;
use crate::{
app::SharedContext, assets::AssetHandlerRegistry, edits::WryQueue,
file_upload::NativeFileHover, ipc::UserWindowEvent, protocol, waker::tao_waker, Config,
DesktopCo... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/desktop/src/ipc.rs | packages/desktop/src/ipc.rs | use serde::{Deserialize, Serialize};
use tao::window::WindowId;
#[non_exhaustive]
#[derive(Debug, Clone)]
pub enum UserWindowEvent {
/// A global hotkey event
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
GlobalHotKeyEvent(global_hotkey::GlobalHotKeyEvent),
#[cfg(any(tar... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/liveview/src/config.rs | packages/liveview/src/config.rs | use dioxus_core::{LaunchConfig, VirtualDom};
use crate::LiveviewRouter;
pub(crate) fn app_title() -> String {
dioxus_cli_config::app_title().unwrap_or_else(|| "Dioxus Liveview App".to_string())
}
/// A configuration for the LiveView server.
pub struct Config<R: LiveviewRouter> {
router: R,
address: std::... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/liveview/src/launch.rs | packages/liveview/src/launch.rs | use dioxus_core::*;
use std::any::Any;
pub type Config = crate::Config<axum::Router>;
/// Launches the WebView and runs the event loop, with configuration and root props.
pub fn launch(
root: fn() -> Element,
contexts: Vec<Box<dyn Fn() -> Box<dyn Any> + Send + Sync>>,
platform_configs: Vec<Box<dyn Any>>,
... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/liveview/src/element.rs | packages/liveview/src/element.rs | use dioxus_core::ElementId;
use dioxus_html::{
geometry::{PixelsRect, PixelsSize, PixelsVector2D},
MountedResult, RenderedElementBacking,
};
use crate::query::QueryEngine;
/// A mounted element passed to onmounted events
#[derive(Clone)]
pub struct LiveviewElement {
id: ElementId,
query: QueryEngine,
... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/liveview/src/lib.rs | packages/liveview/src/lib.rs | #![doc = include_str!("../README.md")]
#![doc(html_logo_url = "https://avatars.githubusercontent.com/u/79236386")]
#![doc(html_favicon_url = "https://avatars.githubusercontent.com/u/79236386")]
mod adapters;
#[allow(unused_imports)]
pub use adapters::*;
mod element;
pub mod pool;
mod query;
use dioxus_interpreter_js:... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/liveview/src/document.rs | packages/liveview/src/document.rs | use dioxus_core::queue_effect;
use dioxus_core::ScopeId;
use dioxus_document::{
create_element_in_head, Document, Eval, EvalError, Evaluator, LinkProps, MetaProps,
ScriptProps, StyleProps,
};
use dioxus_history::History;
use generational_box::{AnyStorage, GenerationalBox, UnsyncStorage};
use std::rc::Rc;
use c... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/liveview/src/history.rs | packages/liveview/src/history.rs | use dioxus_core::spawn;
use dioxus_document::Eval;
use dioxus_history::History;
use serde::{Deserialize, Serialize};
use std::rc::Rc;
use std::sync::{Mutex, RwLock};
use std::{collections::BTreeMap, sync::Arc};
/// A [`History`] that evaluates history through JS.
pub(crate) struct LiveviewHistory {
action_tx: toki... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/liveview/src/query.rs | packages/liveview/src/query.rs | use std::{cell::RefCell, rc::Rc};
use futures_util::FutureExt;
use generational_box::{Owner, UnsyncStorage};
use serde::{de::DeserializeOwned, Deserialize};
use serde_json::Value;
use slab::Slab;
use thiserror::Error;
use tokio::sync::broadcast::error::RecvError;
const DIOXUS_CODE: &str = r#"
let dioxus = {
recv:... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/liveview/src/events.rs | packages/liveview/src/events.rs | //! Convert a serialized event to an event trigger
use dioxus_html::*;
use crate::element::LiveviewElement;
pub(crate) struct SerializedHtmlEventConverter;
impl HtmlEventConverter for SerializedHtmlEventConverter {
fn convert_animation_data(&self, event: &PlatformEventData) -> AnimationData {
event
... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/liveview/src/pool.rs | packages/liveview/src/pool.rs | use crate::{
document::init_document,
element::LiveviewElement,
events::SerializedHtmlEventConverter,
query::{QueryEngine, QueryResult},
LiveViewError,
};
use dioxus_core::{provide_context, Element, Event, ScopeId, VirtualDom};
use dioxus_html::{EventData, HtmlEvent, PlatformEventData};
use dioxus_... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/liveview/src/adapters/mod.rs | packages/liveview/src/adapters/mod.rs | use std::future::Future;
use dioxus_core::{Element, VirtualDom};
#[cfg(feature = "axum")]
pub mod axum_adapter;
#[cfg(feature = "axum")]
pub use axum_adapter::*;
/// A trait for servers that can be used to host a LiveView app.
pub trait LiveviewRouter {
/// Create a new router.
fn create_default_liveview_rou... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/liveview/src/adapters/axum_adapter.rs | packages/liveview/src/adapters/axum_adapter.rs | use std::sync::Arc;
use crate::{interpreter_glue, LiveViewError, LiveViewSocket, LiveviewRouter};
use axum::{
extract::{
ws::{Message, WebSocket},
WebSocketUpgrade,
},
response::Html,
routing::*,
Router,
};
use futures_util::{SinkExt, StreamExt};
/// Convert an Axum WebSocket into ... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/liveview/examples/axum_stress.rs | packages/liveview/examples/axum_stress.rs | use axum::{extract::ws::WebSocketUpgrade, response::Html, routing::get, Router};
use dioxus::prelude::*;
fn app() -> Element {
let mut state = use_signal(|| 0);
use_future(move || async move {
loop {
state += 1;
tokio::time::sleep(std::time::Duration::from_millis(1)).await;
... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/liveview/examples/axum.rs | packages/liveview/examples/axum.rs | use axum::Router;
use dioxus::prelude::*;
use dioxus_liveview::LiveviewRouter;
fn app() -> Element {
let mut num = use_signal(|| 0);
rsx! {
div {
"hello axum! {num}"
button { onclick: move |_| num += 1, "Increment" }
}
}
}
#[tokio::main]
async fn main() {
dioxu... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/hooks/src/use_effect.rs | packages/hooks/src/use_effect.rs | use std::{cell::Cell, rc::Rc};
use dioxus_core::*;
use futures_util::StreamExt;
use crate::use_callback;
#[doc = include_str!("../docs/side_effects.md")]
#[doc = include_str!("../docs/rules_of_hooks.md")]
#[track_caller]
pub fn use_effect(mut callback: impl FnMut() + 'static) -> Effect {
let callback = use_callb... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/hooks/src/use_waker.rs | packages/hooks/src/use_waker.rs | use dioxus_core::use_hook;
use dioxus_signals::{ReadableExt, Signal, WritableExt};
use futures_channel::oneshot::{Canceled, Receiver, Sender};
use futures_util::{future::Shared, FutureExt};
/// A hook that provides a waker for other hooks to provide async/await capabilities.
///
/// This hook is a reactive wrapper ove... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/hooks/src/use_callback.rs | packages/hooks/src/use_callback.rs | use dioxus_core::{use_hook, Callback};
/// Create a callback that's always up to date. Whenever this hook is called the inner callback will be replaced with the new callback but the handle will remain.
///
/// There is *currently* no signal tracking on the Callback so anything reading from it will not be updated.
///
... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/hooks/src/use_action.rs | packages/hooks/src/use_action.rs | use crate::{use_callback, use_signal};
use dioxus_core::{use_hook, Callback, CapturedError, Result, Task};
use dioxus_signals::{ReadSignal, ReadableBoxExt, ReadableExt, Signal, WritableExt};
use futures_channel::oneshot::Receiver;
use futures_util::{future::Shared, FutureExt};
use std::{marker::PhantomData, pin::Pin, p... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/hooks/src/use_signal.rs | packages/hooks/src/use_signal.rs | use dioxus_core::use_hook;
use dioxus_signals::{Signal, SignalData, Storage, SyncStorage, UnsyncStorage};
/// Creates a new Signal. Signals are a Copy state management solution with automatic dependency tracking.
///
/// ```rust
/// use dioxus::prelude::*;
/// use dioxus_signals::*;
///
/// fn App() -> Element {
/// ... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/hooks/src/lib.rs | packages/hooks/src/lib.rs | #![doc = include_str!("../README.md")]
#![doc(html_logo_url = "https://avatars.githubusercontent.com/u/79236386")]
#![doc(html_favicon_url = "https://avatars.githubusercontent.com/u/79236386")]
#[macro_export]
/// A helper macro for cloning multiple values at once
///
/// # Usage
///
///
/// ```
/// # use dioxus::prel... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/hooks/src/use_collection.rs | packages/hooks/src/use_collection.rs | /*
a form of use_signal explicitly for map-style collections (BTreeMap, HashMap, etc).
Why?
---
Traditionally, it's possible to use the "use_state" hook for collections in the React world.
Adding a new entry would look something similar to:
```js
let (map, set_map) = useState({});
set_map({ ...map, [key]: value });
`... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/hooks/src/use_reactive.rs | packages/hooks/src/use_reactive.rs | use dioxus_signals::{ReadableExt, WritableExt};
use crate::use_signal;
/// A dependency is a trait that can be used to determine if a effect or selector should be re-run.
#[rustversion::attr(
since(1.78.0),
diagnostic::on_unimplemented(
message = "`Dependency` is not implemented for `{Self}`",
... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/hooks/src/use_on_destroy.rs | packages/hooks/src/use_on_destroy.rs | use dioxus_core::use_drop;
#[deprecated(note = "Use `use_drop` instead, which has the same functionality.")]
pub fn use_on_unmount<D: FnOnce() + 'static>(destroy: D) {
use_drop(destroy);
}
| rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/hooks/src/use_sorted.rs | packages/hooks/src/use_sorted.rs | use std::cmp::Ordering;
use std::ops::DerefMut;
use crate::use_memo;
use dioxus_signals::{ReadSignal, Signal};
pub fn use_sorted<V: 'static, T: PartialEq>(
collection: impl FnMut() -> Signal<V>,
) -> ReadSignal<Vec<T>>
// pub fn use_sorted<S, I, T>(iterable: impl FnMut() -> Signal<V>) -> ReadSignal<T>
// where
//... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/hooks/src/use_hook_did_run.rs | packages/hooks/src/use_hook_did_run.rs | use dioxus_core::{use_after_render, use_before_render, use_hook};
use dioxus_signals::{CopyValue, WritableExt};
/// A utility lifecycle hook that is intended to be used inside other hooks to determine if the outer hook has ran this render.
/// The provided callback is executed after each render.
/// The value will onl... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/hooks/src/use_future.rs | packages/hooks/src/use_future.rs | #![allow(missing_docs)]
use crate::{use_callback, use_hook_did_run, use_signal};
use dioxus_core::{use_hook, Callback, Subscribers, Task};
use dioxus_signals::*;
use std::future::Future;
use std::ops::Deref;
/// A hook that allows you to spawn a future the first time you render a component.
///
///
/// This future wil... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/hooks/src/use_set_compare.rs | packages/hooks/src/use_set_compare.rs | use dioxus_core::use_hook;
use dioxus_signals::{ReadSignal, SetCompare};
use std::hash::Hash;
/// Creates a new SetCompare which efficiently tracks when a value changes to check if it is equal to a set of values.
///
/// Generally, you shouldn't need to use this hook. Instead you can use [`crate::use_memo()`]. If you ... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/hooks/src/use_after_suspense_resolved.rs | packages/hooks/src/use_after_suspense_resolved.rs | use dioxus_core::{use_hook, Runtime};
/// Run a closure after the suspense boundary this is under is resolved. The
/// closure will be run immediately if the suspense boundary is already resolved
/// or the scope is not under a suspense boundary.
pub fn use_after_suspense_resolved(suspense_resolved: impl FnOnce() + 's... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/hooks/src/use_root_context.rs | packages/hooks/src/use_root_context.rs | use dioxus_core::{provide_root_context, try_consume_context, use_hook};
/// Try to get a value from the root of the virtual dom, if it doesn't exist, create a new one with the closure provided.
///
/// This is useful for global context inside of libraries. Instead of having the user provide context in the root of thei... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/hooks/src/use_coroutine.rs | packages/hooks/src/use_coroutine.rs | use crate::{use_context_provider, use_future, UseFuture};
use dioxus_core::Task;
use dioxus_core::{consume_context, use_hook};
use dioxus_signals::*;
pub use futures_channel::mpsc::{UnboundedReceiver, UnboundedSender};
use std::future::Future;
/// Maintain a handle over a future that can be paused, resumed, and cancel... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/hooks/src/use_resource.rs | packages/hooks/src/use_resource.rs | #![allow(missing_docs)]
use crate::{use_callback, use_signal, use_waker, UseWaker};
use dioxus_core::{
spawn, use_hook, Callback, IntoAttributeValue, IntoDynNode, ReactiveContext, RenderError,
Subscribers, SuspendedFuture, Task,
};
use dioxus_signals::*;
use futures_util::{
future::{self},
pin_mut, Fu... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/hooks/src/use_memo.rs | packages/hooks/src/use_memo.rs | use crate::use_callback;
use dioxus_core::use_hook;
use dioxus_signals::Memo;
#[doc = include_str!("../docs/derived_state.md")]
#[doc = include_str!("../docs/rules_of_hooks.md")]
#[doc = include_str!("../docs/moving_state_around.md")]
#[track_caller]
pub fn use_memo<R: PartialEq + 'static>(mut f: impl FnMut() -> R + '... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/hooks/src/use_context.rs | packages/hooks/src/use_context.rs | use dioxus_core::{consume_context, provide_context, try_consume_context, use_hook};
/// Consume some context in the tree, providing a sharable handle to the value
///
/// Does not regenerate the value if the value is changed at the parent.
#[doc = include_str!("../docs/rules_of_hooks.md")]
#[doc = include_str!("../doc... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/hooks/tests/effect.rs | packages/hooks/tests/effect.rs | #![allow(unused, non_upper_case_globals, non_snake_case)]
use std::cell::RefCell;
use std::collections::HashMap;
use std::rc::Rc;
use std::time::Duration;
use dioxus::prelude::*;
use dioxus_core::ElementId;
use dioxus_signals::*;
#[tokio::test]
async fn effects_rerun() {
#[derive(Default)]
struct RunCounter {... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/hooks/tests/memo.rs | packages/hooks/tests/memo.rs | use dioxus_core::generation;
#[tokio::test]
async fn memo_updates() {
use std::cell::RefCell;
use dioxus::prelude::*;
thread_local! {
static VEC_SIGNAL: RefCell<Option<Signal<Vec<usize>, SyncStorage>>> = const { RefCell::new(None) };
}
fn app() -> Element {
let mut vec = use_sign... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/depinfo/src/lib.rs | packages/depinfo/src/lib.rs | //! Parse the output of rustc's `.d` dep-info file.
//!
//! Used by the hot-reloading engine and other libraries to provide higher quality dependency analysis
//! for the user's project.
use std::path::{Path, PathBuf};
#[non_exhaustive]
#[derive(Debug, thiserror::Error)]
pub enum DepInfoParseError {
/// The input... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/lazy-js-bundle/src/lib.rs | packages/lazy-js-bundle/src/lib.rs | use std::collections::hash_map::DefaultHasher;
use std::path::{Path, PathBuf};
use std::{hash::Hasher, process::Command};
struct Binding {
input_path: PathBuf,
output_path: PathBuf,
}
/// A builder for generating TypeScript bindings lazily
#[derive(Default)]
pub struct LazyTypeScriptBindings {
binding: Ve... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/dx-wire-format/src/lib.rs | packages/dx-wire-format/src/lib.rs | use cargo_metadata::{diagnostic::Diagnostic, CompilerMessage};
use manganis_core::BundledAsset;
use serde::{Deserialize, Serialize};
use std::{borrow::Cow, collections::HashSet, path::PathBuf};
use subsecond_types::JumpTable;
pub use cargo_metadata;
/// The structured output for the CLI
///
/// This is designed such ... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/stores/src/lib.rs | packages/stores/src/lib.rs | #![doc = include_str!("../README.md")]
#![doc(html_logo_url = "https://avatars.githubusercontent.com/u/79236386")]
#![doc(html_favicon_url = "https://avatars.githubusercontent.com/u/79236386")]
#![warn(missing_docs)]
#![allow(clippy::type_complexity)]
mod impls;
mod store;
mod subscriptions;
pub use impls::*;
pub use ... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/stores/src/store.rs | packages/stores/src/store.rs | use crate::{
scope::SelectorScope,
subscriptions::{StoreSubscriptions, TinyVec},
};
use dioxus_core::{
use_hook, AttributeValue, DynamicNode, IntoAttributeValue, IntoDynNode, Subscribers, SuperInto,
};
use dioxus_signals::{
read_impls, write_impls, BorrowError, BorrowMutError, BoxedSignalStorage, CopyVa... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/stores/src/scope.rs | packages/stores/src/scope.rs | //! This module contains the `SelectorScope` type with raw access to the underlying store system. Most applications should
//! use the [`Store`](dioxus_stores_macro::Store) macro to derive stores for their data structures, which provides a more ergonomic API.
use std::{fmt::Debug, hash::Hash};
use crate::subscription... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/stores/src/subscriptions.rs | packages/stores/src/subscriptions.rs | use dioxus_core::{ReactiveContext, SubscriberList, Subscribers};
use dioxus_signals::{CopyValue, ReadableExt, SyncStorage, Writable, WritableExt};
use std::fmt::Debug;
use std::hash::BuildHasher;
use std::{
collections::{HashMap, HashSet},
hash::Hash,
ops::Deref,
sync::Arc,
};
/// A single node in the ... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/stores/src/impls/slice.rs | packages/stores/src/impls/slice.rs | use std::iter::FusedIterator;
use crate::{impls::index::IndexWrite, store::Store};
use dioxus_signals::{Readable, ReadableExt};
impl<Lens, I> Store<Vec<I>, Lens>
where
Lens: Readable<Target = Vec<I>> + 'static,
I: 'static,
{
/// Returns the length of the slice. This will only track the shallow state of th... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
DioxusLabs/dioxus | https://github.com/DioxusLabs/dioxus/blob/ec8f31dece5c75371177bf080bab46dff54ffd0e/packages/stores/src/impls/hashmap.rs | packages/stores/src/impls/hashmap.rs | //! Additional utilities for `HashMap` stores.
use std::{
borrow::Borrow,
collections::HashMap,
hash::{BuildHasher, Hash},
iter::FusedIterator,
panic::Location,
};
use crate::{store::Store, ReadStore};
use dioxus_signals::{
AnyStorage, BorrowError, BorrowMutError, ReadSignal, Readable, Readabl... | rust | Apache-2.0 | ec8f31dece5c75371177bf080bab46dff54ffd0e | 2026-01-04T15:32:28.012891Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.