Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/tomevault-io/skills-registry --skill rust-dioxus명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SOC 직업 분류 기준
SKILL.md 표시 중
| name | rust-dioxus |
| description | | Use when this capability is needed. |
A comprehensive guide to building beautiful, performant, and reactive user interfaces in Rust targeting WASM, Native Desktop, Mobile, and Server-Side Rendering (SSR).
# Install the cargo helper utility
cargo install dioxus-cli
# Initialize a project template
dx new my-app --template fullstack
dx serve
# Cargo.toml
[dependencies]
dioxus = { version = "0.6", features = ["web"] } # or "desktop", "fullstack"
Dioxus components are regular functions annotated with #[component] returning an Element:
use dioxus::prelude::*;
#[component]
pub fn App() -> Element {
rsx! {
div {
class: "app-container",
Header { title: "Dioxus Dashboard" }
MainContent {}
}
}
}
#[component]
fn Header(title: String) -> Element {
rsx! {
header { class: "nav-header", h1 { "{title}" } }
}
}
key attribute when rendering dynamic lists inside loops.rsx! {
ul {
for user in users.read().iter() {
li { key: "{user.id}", "{user.name}" }
}
}
}
Dioxus handles state tracking automatically via thread-safe Signals.
#[component]
fn Counter() -> Element {
let mut count = use_signal(|| 0);
rsx! {
button {
onclick: move |_| count += 1, // Mutates value and triggers re-render
"Count: {count}"
}
}
}
Use use_memo to cache computations and prevent wasteful recalculations when dependencies haven't changed.
let value = use_signal(|| 10);
let doubled = use_memo(move || value() * 2);
Provide and consume structured context globally down the virtual DOM tree without prop-drilling.
#[derive(Clone, Copy)]
struct AppState {
authenticated: Signal<bool>,
}
// Parent Component
use_context_provider(|| AppState {
authenticated: Signal::new(false),
});
// Child Component
let state = use_context::<AppState>();
Use use_resource to run async fetching routines.
let posts = use_resource(move || async move {
reqwest::get("https://api.example.com/posts")
.await?
.json::<Vec<Post>>()
.await
});
match &*posts.read_unchecked() {
None => rsx! { "Loading..." },
Some(Err(e)) => rsx! { "Error: {e}" },
Some(Ok(list)) => rsx! {
for post in list {
p { "{post.title}" }
}
}
}
Define APIs that compile to RPC endpoints automatically.
#[server(GetDatabaseStats)]
pub async fn get_stats() -> Result<Stats, ServerFnError> {
// This code executes purely on the backend server
Ok(db::fetch_stats().await?)
}
Ensure you configure Window preferences elegantly on desktop launches:
fn main() {
dioxus::LaunchBuilder::desktop()
.with_cfg(
dioxus::desktop::Config::default()
.with_window(
dioxus::desktop::WindowBuilder::new()
.with_title("App")
.with_inner_size(dioxus::desktop::LogicalSize::new(1280, 720))
)
)
.launch(App);
}
Keep component logic in pure functions or hooks so behavior can be tested without a browser.
fn format_count(count: i32) -> String {
match count {
0 => "No items".to_string(),
1 => "1 item".to_string(),
n => format!("{n} items"),
}
}
#[test]
fn formats_count() {
assert_eq!(format_count(2), "2 items");
}
rsx!; pass IDs or Arc when appropriate.let filtered = use_memo(move || {
let query = query.read().to_lowercase();
items.read()
.iter()
.filter(|item| item.name.to_lowercase().contains(&query))
.cloned()
.collect::<Vec<_>>()
});
Represent loading, error, and success states explicitly. Do not unwrap in render paths.
#[derive(Clone)]
enum LoadState<T> {
Idle,
Loading,
Loaded(T),
Failed(String),
}
Source: adxptived/Rust-Skills — distributed by TomeVault.