Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Posts tagged rust

Use this tag for questions about code written in Rust.

This tag doesn't have a detailed wiki yet.

75%
+4 −0
Q&A What is the purpose of grouping the tests in a `tests` module and is it possible to split them?

What is the purpose of grouping the tests in a tests module like this #[cfg(test)] mod tests { use super::*; #[test] fn test_function_1() { // test code for function 1 g...

1 answer  ·  posted 3mo ago by ShadowsRanger‭  ·  last activity 3mo ago by Moshi‭

Question rust testing
71%
+3 −0
Q&A How to correctly daemonize a Rocket-based app?

Summary I'm refactoring a Rust-based service/daemon to move away from gRPC and use a Rocket-based API instead. I'm also using the daemonize crate to turn the foreground process into a background p...

1 answer  ·  posted 9mo ago by ghost-in-the-zsh‭  ·  last activity 8mo ago by ghost-in-the-zsh‭

Question rust rocket daemon
81%
+7 −0
Q&A What allows a string slice (&str) to outlive its scope?

As a relative newcomer to Rust, I'm trying to understand the behaviour of lifetimes, but I am confused by the following code: let s: &amp;str = "first"; let mut r: &amp;str = s; println!("First ...

2 answers  ·  posted 9mo ago by InfiniteDissent‭  ·  last activity 9mo ago by Moshi‭

80%
+6 −0
Q&A Why is this symlink() call returning successfully while apparently failing to create the sym-link?

Summary I'm building an internal system (hardware simulator, using Rust) to help test some Python-based services that talk to hardware. (The services talk to hardware via TTYs.) To trick the Pytho...

1 answer  ·  posted 2y ago by ghost-in-the-zsh‭  ·  last activity 1y ago by ghost-in-the-zsh‭

Question rust linux
50%
+1 −1
Q&A Nannou model requires a function pointer: How to return a function pointer

Trying to make a nannou app from the template but with a customizable model() function. The template has this main(): fn main() { nannou::app(model).update(update).run(); } The model t...

0 answers  ·  posted 1y ago by telefza‭  ·  edited 1y ago by Alexei‭

80%
+6 −0
Q&A error[E0507]: cannot move out of X which is behind a shared reference.

Making a Nannou App that draws a line to the screen. My model only contains the window itself and a vector of tuples describing the points and color. Similar to this example(under Drawing Lines) ...

1 answer  ·  posted 1y ago by telefza‭  ·  last activity 1y ago by telefza‭

Question rust nannou
77%
+5 −0
Q&A updating a function within a struct

What I want: An object that contains a function that I can update after creation. I created a struct that contains a parameter b and a function(closure?) named Internal_Fn. struct MyThing { ...

1 answer  ·  posted 1y ago by telefza‭  ·  last activity 1y ago by Derek Elkins‭

Question rust lifetime
80%
+6 −0
Q&A Strange change of object lightness and colour in Nannou application

Building a Nannou App from their template. I want a circle to slowly fade in color and randomly change color when hitting the boundary of the window. But there is something strange going on when ...

1 answer  ·  posted 1y ago by telefza‭  ·  last activity 1y ago by telefza‭

Question rust nannou
77%
+5 −0
Q&A Handling JSON files in Rust without manually creating mapping classes

I have JSON that looks something like this: {"id":"n-fsdf-6b6", "name":"JohnSmith", "revisionDate":1591072274000} The JSON data is named CharacterInfo. It comes from a static external URL. The str...

1 answer  ·  posted 2y ago by dustytrash‭  ·  last activity 2y ago by r~~‭

Question rust json
80%
+6 −0
Q&A Are generic enums completely abstract?

When using Result or Option to get a value, the value is wrapped in a Ok or Some. For example, with pattern matching to get a Result: let var: Json = match serde_json::from_str(&amp;my_string) { ...

1 answer  ·  posted 2y ago by jla‭  ·  last activity 2y ago by Derek Elkins‭

Question rust enum
83%
+8 −0
Q&A How can I define a method on [&mut T] where T: MyTrait?

I'm trying to make a trait method callable on mutable slices of a type implementing that trait (see main). Rust doesn't like me for it. use core::convert::AsMut; trait A { type B; fn f(m: ...

1 answer  ·  posted 2y ago by wizzwizz4‭  ·  last activity 2y ago by r~~‭