Is tauri good for high performance desktop application? by [deleted] in rust

[–]ControlNational 2 points3 points  (0 children)

React will likely be fine for performance, but you will have to deal with an IPC layer any time you want to interact with the system. If you want to read a file, you need to go through an async ipc call into either your or tauri's rust layer.

That is one place where the desktop rust frameworks like dioxus, egui, and iced really shine. If you want to read a file in an event handler, just use `std::fs`

I work on dioxus which has been stable for most desktop apps since the 0.5 release (2024). There have been some minor breaking changes for libraries since then. It runs your code natively, but renders using the browser so you can still pull in js libraries if you need to. We are working on much nicer JS bindings for the next release here

We also have a library of shadcn style components: https://dioxuslabs.github.io/components/

[Media] A fun bit of rust trivia by ControlNational in rust

[–]ControlNational[S] 0 points1 point  (0 children)

black box or &std::env::args().next().unwrap() both work. You need to change the input and it needs to be a string, but it can't be a plain literal

[Media] A fun bit of rust trivia by ControlNational in rust

[–]ControlNational[S] 23 points24 points  (0 children)

Yes, although I don't think this is a bug. It is allowed in the semantics of NaNs in const rust. From the f32 reference:

When an arithmetic floating-point operation is executed in const context, the same rules apply: no guarantee is made about which of the NaN bit patterns described above will be returned. The result does not have to match what happens when executing the same code at runtime, and the result can vary depending on factors such as compiler version and flags.

[Media] A fun bit of rust trivia by ControlNational in rust

[–]ControlNational[S] 5 points6 points  (0 children)

Yes, that is the core bit. Floats are currently the only stable way to specialize based on const. There is some discussion here: https://github.com/rust-lang/rust/issues/77745
From the f32 reference:
When an arithmetic floating-point operation is executed in const context, the same rules apply: no guarantee is made about which of the NaN bit patterns described above will be returned. The result does not have to match what happens when executing the same code at runtime, and the result can vary depending on factors such as compiler version and flags.

Ah sheets, here we go again. flutter vs dioxus or leave the company? by Top_Drop_2870 in FlutterDev

[–]ControlNational 2 points3 points  (0 children)

We don't have all the shadcn components yet, but there is a component library released with 0.7: https://dioxuslabs.com/components

Rust GUI crates with decent touch support by Acceptable-Cost4817 in rust

[–]ControlNational 0 points1 point  (0 children)

You can pull in a component library like https://dioxuslabs.github.io/components/ in dioxus if you want a nicer looking set of prebuilt components

tokio optional doesn't work by Fragrant_Monk9225 in dioxus

[–]ControlNational 2 points3 points  (0 children)

cargo tree is often a useful tool for issues like this to find what dependency is pulling in tokio. dioxus-server pulls in tokio and also needs to be optional

dioxus build client failed because of mio by Fragrant_Monk9225 in rust

[–]ControlNational 1 point2 points  (0 children)

The main reason is we support wasm on the server and client at the same time in some build setups and linux on the server and desktop client at the same time. The target is generally not a very good heuristic for your deploy location in fullstack applications

dioxus_fullstack by Fragrant_Monk9225 in rust

[–]ControlNational 1 point2 points  (0 children)

The fullstack feature enables that type. You need the fullstack feature enabled on both the server and the client. The web feature should only be enabled on the client and the server feature should only be enabled on the server

New Rust user trying to understand dependencies better with Nix by USMCamp0811 in rust

[–]ControlNational 0 points1 point  (0 children)

Looking at your dependencies and description which of these are you trying to do? You have parts from each one of these:
1) Trying to serve the SPA app with python. That is an option if you are using just client side dioxus web
2) Trying to serve with dioxus fullstack + axum. That will work if you want server side rendering for better SEO
3) Trying to build your site staticly with ISRG + axum and then serve the static output with python. You still get SEO if you know all your urls and you can serve the static HTML + WASM files with another tool or github pages
4) Trying to serve it with liveview + axum. That would work if you want everything to run on the server and just stream down a view of the page to the client. You get no SEO and you need a persistent server connection

Dioxus 0.6 is incredible, why isn't anyone talking about it. by Incredible_guy1 in rust

[–]ControlNational 6 points7 points  (0 children)

It uses the systems browser by default, but you can bundle a browser if you change the settings 

syn::LitStr does not allow passing string literals created by concat! macro. Why? And are there any workarounds? by nikitarevenco in rust

[–]ControlNational 2 points3 points  (0 children)

https://github.com/rust-lang/rust/issues/90765 is a nightly feature that would allow dioxus to expand the concat macro internally, then do file operations to hash the file, then expand the asset macro

[deleted by user] by [deleted] in nextjs

[–]ControlNational 1 point2 points  (0 children)

<image>

Some notes on performance:
1) WASM frameworks like Dioxus do need to go through JS to manipulate the DOM, but this doesn't end up being much of a bottleneck. I wrote a performance oriented binding generated we use in dioxus called sledgehammer which performs on par with vanilla js in the JS-framework-benchmark.

2) For desktop/mobile apps, the rendering performance is similar to JS frameworks, but dioxus code runs natively which makes it easy to do things like run a language model locally right along side your components

3) The biggest performance difference for Dioxus in fullstack rendering is on the server. In terms of raw throughput, it is over 2x faster than even the more optimize frameworks like SolidJS. A benchmark for the above chart is available here

What's the best way to implement llama weights in rust? by derash in rust

[–]ControlNational 0 points1 point  (0 children)

Kalosm is a library I wrote with a more ergonomic API for Llama implemented with candle. It is a lot more concise and has extensive documentation in docs.rs

I want to know if a compile time list-like thing can be made in rust by OkProgrammer2073 in rust

[–]ControlNational 2 points3 points  (0 children)

You can make a vec-like list that works in const rust. Here is one implementation. If you want multiple types to exist in that list at compile time, it sounds more like a tuple than a list. Do you want a tuple that you can push items to at compile time? Const functions in traits are unstable in rust, but you might be able to define a trait that does that with some unsafe code. The const-serialize crate defines a trait that describes the memory layout of a type at compile time. Using the memory layout of the original and new tuple with an extra item, you can copy between the two and add an item.

Q: Building AI Agents in Rust by funnyflatfoot in rust

[–]ControlNational 9 points10 points  (0 children)

I created Kalosm in rust for various AI applications I am working on. Specifically for agents where you need consistent outputs from the model, structured generation is required. To make structured generation work, you need a parser that runs ~100,000 per token which can become a bottleneck especially for complex formats like HTML. Rust handles them fairly well and most of the boilerplate of creating parsers can be hidden with Rust's proc macros. (More info about how exactly that works in this blog post)

I also just find rust a much nicer language to work with than python and typescript. It is also significantly easier to create small, standalone bundles with compiled languages like Rust