import{$ as e,B as t,P as n,_ as r,f as i,g as a,h as o,l as s}from"./runtime-core.esm-bundler-CZvn3YaB.js";import{t as c}from"./plugin-vue_export-helper-CxTVcLa7.js";var l=JSON.parse(`{"path":"/en/guide/repl/rust/","title":"Rust | Guide","lang":"en-US","frontmatter":{"title":"Rust","icon":"simple-icons:rust","createTime":"2025/10/08 09:44:43","permalink":"/en/guide/repl/rust/","description":"Overview The theme provides Rust code demonstration functionality, supporting online execution of Rust code. Important This functionality works by submitting code to a server fo...","head":[["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"Rust\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2025-10-09T07:46:05.000Z\\",\\"author\\":[]}"],["meta",{"property":"og:url","content":"https://theme-plume.vuejs.press/en/guide/repl/rust/"}],["meta",{"property":"og:site_name","content":"Plume Theme"}],["meta",{"property":"og:title","content":"Rust"}],["meta",{"property":"og:description","content":"Overview The theme provides Rust code demonstration functionality, supporting online execution of Rust code. Important This functionality works by submitting code to a server fo..."}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"en-US"}],["meta",{"property":"og:locale:alternate","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2025-10-09T07:46:05.000Z"}],["meta",{"property":"article:modified_time","content":"2025-10-09T07:46:05.000Z"}],["link",{"rel":"alternate","hreflang":"zh-cn","href":"https://theme-plume.vuejs.press/guide/repl/rust/"}]]},"readingTime":{"minutes":1.08,"words":323},"git":{"createdTime":1713956557000,"updatedTime":1759995965000,"contributors":[{"name":"pengzhanbo","username":"pengzhanbo","email":"volodymyr@foxmail.com","commits":6,"avatar":"https://avatars.githubusercontent.com/pengzhanbo?v=4","url":"https://github.com/pengzhanbo"},{"name":"zhenghaoyang24","username":"zhenghaoyang24","email":"95458562+zhenghaoyang24@users.noreply.github.com","commits":1,"avatar":"https://avatars.githubusercontent.com/zhenghaoyang24?v=4","url":"https://github.com/zhenghaoyang24"}],"changelog":[{"hash":"385059f214cb07fc9a098859e889432fb81f998b","time":1759995965000,"email":"volodymyr@foxmail.com","author":"pengzhanbo","message":"docs: update en docs (#708)"},{"hash":"4d2361a7046214fe0f4e4af01831107fd00e38ad","time":1759849989000,"email":"volodymyr@foxmail.com","author":"pengzhanbo","message":"feat(theme)!: add collections support (#704)"},{"hash":"b07426dfc6142c10db34618a8fadb6feb5c0d4ce","time":1745564695000,"email":"volodymyr@foxmail.com","author":"pengzhanbo","message":"refactor(plugin-md-power): improve md plugins (#562)"},{"hash":"0fd6cac57412002f4d72dc10378789b529adc357","time":1742063370000,"email":"volodymyr@foxmail.com","author":"pengzhanbo","message":"refactor(theme): improve types and flat config (#524)"},{"hash":"607aaf453382030e07b299480c170dc2d72c06f8","time":1740630135000,"email":"95458562+zhenghaoyang24@users.noreply.github.com","author":"Hoey","message":"fix(docs): incorrect rust icon display in dark mode"},{"hash":"5addb31e9181be0b7ddfdb431a5f7634ed97057f","time":1714843964000,"email":"volodymyr@foxmail.com","author":"pengzhanbo","message":"feat(plugin-md-power): 支持可编辑的代码演示"},{"hash":"428b8eea587ff39169f9bfa4174df11320a5ab4f","time":1713956557000,"email":"volodymyr@foxmail.com","author":"pengzhanbo","message":"docs: update code online repl doc"}]},"autoDesc":true,"filePathRelative":"en/guide/repl/rust.md","headers":[],"bulletin":false}`),u={name:`rust.md`},d={class:`code-block-title`,"data-title":`.vuepress/config.ts`},f={class:`code-block-title-bar`},p={class:`title`};function m(c,l,u,m,h,g){let _=t(`VPIcon`),v=t(`CodeRepl`);return n(),i(`div`,null,[l[6]||=o(`
The theme provides Rust code demonstration functionality, supporting online execution of Rust code.
Important
This functionality works by submitting code to a server for compilation and execution, and only a single code file can be submitted at a time.
Therefore, please do not use this feature to execute overly complex code, and avoid making execution requests too frequently.
This feature is disabled by default. You can enable it through configuration.
`,5),s(`div`,d,[s(`div`,f,[s(`span`,p,[r(_,{provider:`iconify`,name:`vscode-icons:file-type-typescript`}),l[0]||=a(`.vuepress/config.ts`,-1)])]),l[1]||=o(`export default defineUserConfig({
theme: plumeTheme({
markdown: {
repl: {
rust: true,
},
},
})
})Use the ::: rust-repl container syntax to wrap Rust code blocks. The theme will detect the code blocks and add execution buttons.
Rust code demos are read-only by default and cannot be edited.
::: rust-repl title="Custom Title"\n```rust\n// your rust code\n```\n:::For online editing and execution, wrap the code block in the ::: rust-repl editable container syntax.
::: rust-repl editable title="Custom Title"\n```rust\n// your rust code\n```\n:::Input:
::: rust-repl title="Print Content"\n```rust\nfn main() {\n println!("Hello, world!");\n}\n```\n:::Output:
',13),r(v,{title:`Print Content`},{default:e(()=>[...l[2]||=[s(`div`,{class:`language-rust`,"data-highlighter":`shiki`,"data-ext":`rust`,style:{"--shiki-light":`#393a34`,"--shiki-dark":`#dbd7caee`,"--shiki-light-bg":`#ffffff`,"--shiki-dark-bg":`#121212`}},[s(`pre`,{class:`shiki shiki-themes vitesse-light vitesse-dark vp-code`},[s(`code`,{class:`language-rust`},[s(`span`,{class:`line`},[s(`span`,{style:{"--shiki-light":`#1E754F`,"--shiki-dark":`#4D9375`}},`fn`),s(`span`,{style:{"--shiki-light":`#59873A`,"--shiki-dark":`#80A665`}},` main`),s(`span`,{style:{"--shiki-light":`#999999`,"--shiki-dark":`#666666`}},`()`),s(`span`,{style:{"--shiki-light":`#999999`,"--shiki-dark":`#666666`}},` {`)]),a(` `),s(`span`,{class:`line`},[s(`span`,{style:{"--shiki-light":`#59873A`,"--shiki-dark":`#80A665`}},` println!`),s(`span`,{style:{"--shiki-light":`#999999`,"--shiki-dark":`#666666`}},`(`),s(`span`,{style:{"--shiki-light":`#B5695977`,"--shiki-dark":`#C98A7D77`}},`"`),s(`span`,{style:{"--shiki-light":`#B56959`,"--shiki-dark":`#C98A7D`}},`Hello, world!`),s(`span`,{style:{"--shiki-light":`#B5695977`,"--shiki-dark":`#C98A7D77`}},`"`),s(`span`,{style:{"--shiki-light":`#999999`,"--shiki-dark":`#666666`}},`);`)]),a(` `),s(`span`,{class:`line`},[s(`span`,{style:{"--shiki-light":`#999999`,"--shiki-dark":`#666666`}},`}`)])])])],-1)]]),_:1}),l[8]||=o(`Click the Execute button to run the code.
Input:
::: rust-repl
\`\`\`rust
fn main() {
printlnl!("Hello, world!");
}
\`\`\`
:::Output:
`,5),r(v,{title:`rust playground`},{default:e(()=>[...l[3]||=[s(`div`,{class:`language-rust`,"data-highlighter":`shiki`,"data-ext":`rust`,style:{"--shiki-light":`#393a34`,"--shiki-dark":`#dbd7caee`,"--shiki-light-bg":`#ffffff`,"--shiki-dark-bg":`#121212`}},[s(`pre`,{class:`shiki shiki-themes vitesse-light vitesse-dark vp-code`},[s(`code`,{class:`language-rust`},[s(`span`,{class:`line`},[s(`span`,{style:{"--shiki-light":`#1E754F`,"--shiki-dark":`#4D9375`}},`fn`),s(`span`,{style:{"--shiki-light":`#59873A`,"--shiki-dark":`#80A665`}},` main`),s(`span`,{style:{"--shiki-light":`#999999`,"--shiki-dark":`#666666`}},`()`),s(`span`,{style:{"--shiki-light":`#999999`,"--shiki-dark":`#666666`}},` {`)]),a(` `),s(`span`,{class:`line`},[s(`span`,{style:{"--shiki-light":`#59873A`,"--shiki-dark":`#80A665`}},` printlnl!`),s(`span`,{style:{"--shiki-light":`#999999`,"--shiki-dark":`#666666`}},`(`),s(`span`,{style:{"--shiki-light":`#B5695977`,"--shiki-dark":`#C98A7D77`}},`"`),s(`span`,{style:{"--shiki-light":`#B56959`,"--shiki-dark":`#C98A7D`}},`Hello, world!`),s(`span`,{style:{"--shiki-light":`#B5695977`,"--shiki-dark":`#C98A7D77`}},`"`),s(`span`,{style:{"--shiki-light":`#999999`,"--shiki-dark":`#666666`}},`);`)]),a(` `),s(`span`,{class:`line`},[s(`span`,{style:{"--shiki-light":`#999999`,"--shiki-dark":`#666666`}},`}`)])])])],-1)]]),_:1}),l[9]||=o(`Input:
::: rust-repl
\`\`\`rust
use std::process::Command;
fn main() {
let mut child = Command::new("sleep").arg("5").spawn().unwrap();
let _result = child.wait().unwrap();
println!("reached end of main");
}
\`\`\`
:::Output:
`,4),r(v,{title:`rust playground`},{default:e(()=>[...l[4]||=[s(`div`,{class:`language-rust`,"data-highlighter":`shiki`,"data-ext":`rust`,style:{"--shiki-light":`#393a34`,"--shiki-dark":`#dbd7caee`,"--shiki-light-bg":`#ffffff`,"--shiki-dark-bg":`#121212`}},[s(`pre`,{class:`shiki shiki-themes vitesse-light vitesse-dark vp-code`},[s(`code`,{class:`language-rust`},[s(`span`,{class:`line`},[s(`span`,{style:{"--shiki-light":`#1E754F`,"--shiki-dark":`#4D9375`}},`use`),s(`span`,{style:{"--shiki-light":`#59873A`,"--shiki-dark":`#80A665`}},` std`),s(`span`,{style:{"--shiki-light":`#AB5959`,"--shiki-dark":`#CB7676`}},`::`),s(`span`,{style:{"--shiki-light":`#59873A`,"--shiki-dark":`#80A665`}},`process`),s(`span`,{style:{"--shiki-light":`#AB5959`,"--shiki-dark":`#CB7676`}},`::`),s(`span`,{style:{"--shiki-light":`#2E8F82`,"--shiki-dark":`#5DA994`}},`Command`),s(`span`,{style:{"--shiki-light":`#999999`,"--shiki-dark":`#666666`}},`;`)]),a(` `),s(`span`,{class:`line`}),a(` `),s(`span`,{class:`line`},[s(`span`,{style:{"--shiki-light":`#1E754F`,"--shiki-dark":`#4D9375`}},`fn`),s(`span`,{style:{"--shiki-light":`#59873A`,"--shiki-dark":`#80A665`}},` main`),s(`span`,{style:{"--shiki-light":`#999999`,"--shiki-dark":`#666666`}},`()`),s(`span`,{style:{"--shiki-light":`#999999`,"--shiki-dark":`#666666`}},` {`)]),a(` `),s(`span`,{class:`line`},[s(`span`,{style:{"--shiki-light":`#AB5959`,"--shiki-dark":`#CB7676`}},` let`),s(`span`,{style:{"--shiki-light":`#AB5959`,"--shiki-dark":`#CB7676`}},` mut`),s(`span`,{style:{"--shiki-light":`#B07D48`,"--shiki-dark":`#BD976A`}},` child`),s(`span`,{style:{"--shiki-light":`#999999`,"--shiki-dark":`#666666`}},` =`),s(`span`,{style:{"--shiki-light":`#2E8F82`,"--shiki-dark":`#5DA994`}},` Command`),s(`span`,{style:{"--shiki-light":`#AB5959`,"--shiki-dark":`#CB7676`}},`::`),s(`span`,{style:{"--shiki-light":`#59873A`,"--shiki-dark":`#80A665`}},`new`),s(`span`,{style:{"--shiki-light":`#999999`,"--shiki-dark":`#666666`}},`(`),s(`span`,{style:{"--shiki-light":`#B5695977`,"--shiki-dark":`#C98A7D77`}},`"`),s(`span`,{style:{"--shiki-light":`#B56959`,"--shiki-dark":`#C98A7D`}},`sleep`),s(`span`,{style:{"--shiki-light":`#B5695977`,"--shiki-dark":`#C98A7D77`}},`"`),s(`span`,{style:{"--shiki-light":`#999999`,"--shiki-dark":`#666666`}},`)`),s(`span`,{style:{"--shiki-light":`#AB5959`,"--shiki-dark":`#CB7676`}},`.`),s(`span`,{style:{"--shiki-light":`#59873A`,"--shiki-dark":`#80A665`}},`arg`),s(`span`,{style:{"--shiki-light":`#999999`,"--shiki-dark":`#666666`}},`(`),s(`span`,{style:{"--shiki-light":`#B5695977`,"--shiki-dark":`#C98A7D77`}},`"`),s(`span`,{style:{"--shiki-light":`#B56959`,"--shiki-dark":`#C98A7D`}},`5`),s(`span`,{style:{"--shiki-light":`#B5695977`,"--shiki-dark":`#C98A7D77`}},`"`),s(`span`,{style:{"--shiki-light":`#999999`,"--shiki-dark":`#666666`}},`)`),s(`span`,{style:{"--shiki-light":`#AB5959`,"--shiki-dark":`#CB7676`}},`.`),s(`span`,{style:{"--shiki-light":`#59873A`,"--shiki-dark":`#80A665`}},`spawn`),s(`span`,{style:{"--shiki-light":`#999999`,"--shiki-dark":`#666666`}},`()`),s(`span`,{style:{"--shiki-light":`#AB5959`,"--shiki-dark":`#CB7676`}},`.`),s(`span`,{style:{"--shiki-light":`#59873A`,"--shiki-dark":`#80A665`}},`unwrap`),s(`span`,{style:{"--shiki-light":`#999999`,"--shiki-dark":`#666666`}},`();`)]),a(` `),s(`span`,{class:`line`},[s(`span`,{style:{"--shiki-light":`#AB5959`,"--shiki-dark":`#CB7676`}},` let`),s(`span`,{style:{"--shiki-light":`#B07D48`,"--shiki-dark":`#BD976A`}},` _result`),s(`span`,{style:{"--shiki-light":`#999999`,"--shiki-dark":`#666666`}},` =`),s(`span`,{style:{"--shiki-light":`#B07D48`,"--shiki-dark":`#BD976A`}},` child`),s(`span`,{style:{"--shiki-light":`#AB5959`,"--shiki-dark":`#CB7676`}},`.`),s(`span`,{style:{"--shiki-light":`#59873A`,"--shiki-dark":`#80A665`}},`wait`),s(`span`,{style:{"--shiki-light":`#999999`,"--shiki-dark":`#666666`}},`()`),s(`span`,{style:{"--shiki-light":`#AB5959`,"--shiki-dark":`#CB7676`}},`.`),s(`span`,{style:{"--shiki-light":`#59873A`,"--shiki-dark":`#80A665`}},`unwrap`),s(`span`,{style:{"--shiki-light":`#999999`,"--shiki-dark":`#666666`}},`();`)]),a(` `),s(`span`,{class:`line`}),a(` `),s(`span`,{class:`line`},[s(`span`,{style:{"--shiki-light":`#59873A`,"--shiki-dark":`#80A665`}},` println!`),s(`span`,{style:{"--shiki-light":`#999999`,"--shiki-dark":`#666666`}},`(`),s(`span`,{style:{"--shiki-light":`#B5695977`,"--shiki-dark":`#C98A7D77`}},`"`),s(`span`,{style:{"--shiki-light":`#B56959`,"--shiki-dark":`#C98A7D`}},`reached end of main`),s(`span`,{style:{"--shiki-light":`#B5695977`,"--shiki-dark":`#C98A7D77`}},`"`),s(`span`,{style:{"--shiki-light":`#999999`,"--shiki-dark":`#666666`}},`);`)]),a(` `),s(`span`,{class:`line`},[s(`span`,{style:{"--shiki-light":`#999999`,"--shiki-dark":`#666666`}},`}`)])])])],-1)]]),_:1}),l[10]||=o(`Input:
::: rust-repl editable
\`\`\`rust
fn main() {
println!("Hello, world!");
}
\`\`\`
:::Output:
`,4),r(v,{editable:``,title:`rust playground`},{default:e(()=>[...l[5]||=[s(`div`,{class:`language-rust`,"data-highlighter":`shiki`,"data-ext":`rust`,style:{"--shiki-light":`#393a34`,"--shiki-dark":`#dbd7caee`,"--shiki-light-bg":`#ffffff`,"--shiki-dark-bg":`#121212`}},[s(`pre`,{class:`shiki shiki-themes vitesse-light vitesse-dark vp-code`},[s(`code`,{class:`language-rust`},[s(`span`,{class:`line`},[s(`span`,{style:{"--shiki-light":`#1E754F`,"--shiki-dark":`#4D9375`}},`fn`),s(`span`,{style:{"--shiki-light":`#59873A`,"--shiki-dark":`#80A665`}},` main`),s(`span`,{style:{"--shiki-light":`#999999`,"--shiki-dark":`#666666`}},`()`),s(`span`,{style:{"--shiki-light":`#999999`,"--shiki-dark":`#666666`}},` {`)]),a(` `),s(`span`,{class:`line`},[s(`span`,{style:{"--shiki-light":`#59873A`,"--shiki-dark":`#80A665`}},` println!`),s(`span`,{style:{"--shiki-light":`#999999`,"--shiki-dark":`#666666`}},`(`),s(`span`,{style:{"--shiki-light":`#B5695977`,"--shiki-dark":`#C98A7D77`}},`"`),s(`span`,{style:{"--shiki-light":`#B56959`,"--shiki-dark":`#C98A7D`}},`Hello, world!`),s(`span`,{style:{"--shiki-light":`#B5695977`,"--shiki-dark":`#C98A7D77`}},`"`),s(`span`,{style:{"--shiki-light":`#999999`,"--shiki-dark":`#666666`}},`);`)]),a(` `),s(`span`,{class:`line`},[s(`span`,{style:{"--shiki-light":`#999999`,"--shiki-dark":`#666666`}},`}`)])])])],-1)]]),_:1})])}var h=c(u,[[`render`,m]]);export{l as _pageData,h as default};