Better size
This commit is contained in:
+46
-43
@@ -9,77 +9,80 @@ export const mistShowcase = [
|
|||||||
title: "Hello World",
|
title: "Hello World",
|
||||||
description:
|
description:
|
||||||
"Mist starts with familiar syntax, designed to feel immediately readable while compiling into efficient Rust code.",
|
"Mist starts with familiar syntax, designed to feel immediately readable while compiling into efficient Rust code.",
|
||||||
code: `fn main() {
|
code: `void main() {
|
||||||
println("Hello, world!");
|
println!("Hello, world!");
|
||||||
}`,
|
}`,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
title: "Rust Compatibility",
|
title: "C-Style Pointers & Strings",
|
||||||
description:
|
description:
|
||||||
"Mist compiles directly into Rust, meaning you can use existing Rust libraries without breaking your workflow.",
|
"Mist introduces ergonomics for string handling and pointers while maintaining Rust's underlying safety.",
|
||||||
code: `use std::fs;
|
code: `public void greet(str* name) {
|
||||||
|
String greeting = name.to_string();
|
||||||
fn main() {
|
println!("Hello, {}!", greeting);
|
||||||
let data = fs::read_to_string("file.txt");
|
|
||||||
println(data);
|
|
||||||
}`,
|
}`,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
title: "Structs",
|
title: "Modern Classes",
|
||||||
description:
|
description:
|
||||||
"Mist keeps Rust’s struct model intact while making declaration more ergonomic.",
|
"Classes provide a familiar authoring style with explicit visibility modifiers and constructor logic.",
|
||||||
code: `struct User {
|
code: `public class User {
|
||||||
name: String,
|
String name;
|
||||||
age: int
|
i32 age;
|
||||||
}`,
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
public constructor(str* name, i32 age) {
|
||||||
title: "Classes (Syntax Sugar)",
|
self.name = name.to_string();
|
||||||
description:
|
self.age = age;
|
||||||
"Classes provide a familiar authoring style over Rust structs without introducing a runtime object model.",
|
|
||||||
code: `class Logger {
|
|
||||||
String prefix;
|
|
||||||
|
|
||||||
fn info(self, msg: String) {
|
|
||||||
println(self.prefix + msg);
|
|
||||||
}
|
}
|
||||||
}`,
|
}`,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
title: "Inheritance-style Composition",
|
title: "Explicit Self & Mutability",
|
||||||
description:
|
description:
|
||||||
"Extends provides inheritance-like syntax while compiling down to Rust-style composition.",
|
"Method signatures clearly define access patterns using self pointers, making memory intent obvious.",
|
||||||
code: `struct B extends A {
|
code: `public void update_age(self mut*, i32 new_age) {
|
||||||
extra: String
|
self.age = new_age;
|
||||||
|
self.logger.info("Age updated");
|
||||||
}`,
|
}`,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
title: "Zero-cost Abstractions",
|
title: "Pattern Matching",
|
||||||
description:
|
description:
|
||||||
"Mist preserves Rust’s performance model — abstractions compile away entirely at runtime.",
|
"Full support for Rust-style enums and pattern matching for robust control flow.",
|
||||||
code: `fn map<T, U>(arr: Vec<T>, f: fn(T) -> U) -> Vec<U> {
|
code: `void handle_event(self*, event::Event e) {
|
||||||
let mut out = Vec::new();
|
match(e) {
|
||||||
for x in arr {
|
event::Event::Startup => self.boot(),
|
||||||
out.push(f(x));
|
event::Event::Error(msg) => println!("Error: {}", msg),
|
||||||
|
_ => {}
|
||||||
}
|
}
|
||||||
out
|
|
||||||
}`,
|
}`,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
title: "Ecosystem Integration",
|
title: "Type Inference & Vectors",
|
||||||
description:
|
description:
|
||||||
"All Rust crates work directly in Mist, keeping the ecosystem fully intact.",
|
"Mist combines strong typing with keyword-based inference for a streamlined developer experience.",
|
||||||
code: `use serde_json::json;
|
code: `public void init_system(self mut*) {
|
||||||
|
var task = task::create_task("init");
|
||||||
|
self.tasks = new Vec();
|
||||||
|
self.tasks.push(task);
|
||||||
|
}`,
|
||||||
|
},
|
||||||
|
|
||||||
fn main() {
|
{
|
||||||
let data = json!({ "hello": "mist" });
|
title: "Module Interop",
|
||||||
println(data);
|
description:
|
||||||
|
"Use super-relative imports to easily navigate project hierarchies and external crates.",
|
||||||
|
code: `use <super::logger>;
|
||||||
|
use <std::fs>;
|
||||||
|
|
||||||
|
public void log_to_file(logger::Logger log) {
|
||||||
|
let data = fs::read_to_string("log.txt");
|
||||||
|
log.info(data);
|
||||||
}`,
|
}`,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@@ -137,7 +140,7 @@ export default function HomePage() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="w-[40vw] h-svh sticky top-0 flex items-center justify-center">
|
<div className="w-[40vw] h-svh sticky top-0 flex items-center justify-center">
|
||||||
<Card className="w-full max-w-md h-[calc(100vh-300px)]" title>
|
<Card className="w-full max-w-md h-100" title>
|
||||||
<code className="whitespace-pre-wrap">
|
<code className="whitespace-pre-wrap">
|
||||||
<MorphText text={currentText} />
|
<MorphText text={currentText} />
|
||||||
</code>
|
</code>
|
||||||
|
|||||||
Reference in New Issue
Block a user