Questions tagged [rust]

Rust is a systems programming language focused on three goals: safety, speed, and concurrency. It maintains these goals without needing a garbage collector, making it a useful language for a number of use cases other languages aren't good at: embedding in other languages, programs with specific space and time requirements, and writing low-level code, like device drivers and operating systems.

Filter by
Sorted by
Tagged with
1
vote
0answers
13 views

A function for batch backpropagation of weight errors in a dense neural network layer

I'm switching my neural network library over to using ArrayFire for performance. One of the features I am losing moving from ndarray is ndarray_einsum_beta, as such I need to write my own function to ...
1
vote
0answers
22 views

Yet another Fahrenheit and Celsius converter

Introduction I am recently learning Rust by reading The Rust Programming Language (a.k.a. the book). I have finished the first three chapters so far, and this is my attempt for the first exercise ...
2
votes
0answers
17 views

Traversing a tree with two types of nodes, while keeping track of all ancestors

I wrote code that stores an AWS Organization tree in a tree data structure in Rust. From the tree, I use a slightly modified preorder traversal algorithm to print all of the accounts in the ...
1
vote
0answers
19 views

JSONSchema validation implementation in Rust

I'm developing a Rust library that implements JSONSchema validation (Drafts 7 fully works at the moment). I have Rust-specific questions and concerns about my implementation. It works by compiling ...
1
vote
0answers
52 views

Basic Rust HTTP request as a learning exercise

For work, we have to use Atlassian Jira, which is depressing. To make my life a bit easier, I decided to write a cli application to get ticket summaries, and I thought it would make a good first ...
1
vote
0answers
35 views

Implementing A File and Directory Traversal Iterator in Rust

Background Traversing the file hierarchy, going through files and sub-directories from a directory, is a quite common task when doing file system search operations of some sorts. I have already ...
3
votes
0answers
39 views

Function composition in rust

In rust fp-core crate there is a compose function, but it is very limited for my liking. So I made a macro which uses the function composition syntax of Haskell. I would like to know why fp-core didn'...
3
votes
0answers
38 views

Simple beginner Rust CLI file reader that prints to stdout

Q: Am I approaching writing idiomatic Rust code correctly? Hi CodeReview, I'm a beginner Rustacean coming from Python going through Rust books (The Rust Book, Rust in Action). A lot of the beginner ...
1
vote
0answers
20 views

Filtering two dimensional vector in Rust

Recently started writing more rust code and interested in how anyone may get around using .clone() within a map of a referenced data structure. I've included a test ...
0
votes
2answers
130 views

Largest product in a grid: Project Euler 11

Project Euler 11 — Largest product in a grid: In the \$20 × 20\$ grid below, four numbers along a diagonal line have been marked in red. ...
3
votes
1answer
34 views

Generic Cache struct

I've came up with the following implementation of a very simple cache: ...
14
votes
2answers
2k views

Web crawler in Rust

I am learning Rust. I have written a web crawler that would scrape all the pages from my own blog (which is running on Ghost) and would generate a static version of it. Because of this, I'm not ...
2
votes
0answers
25 views

Rotational Symmetry Indexing in a 1D “Square” Array

I managed to find a way to rotate a slice in-place (previous question on SO). The slice is linear, but represents a 2d square of elements. Is this approach efficient? Please check the previous ...
3
votes
0answers
32 views

Conjugate gradient method for a sparse matrix

I am very new to Rust. I have written a conjugate gradient algorithm function for CsMatrix structure from nalgebra ...
2
votes
1answer
69 views

Quick sort algorithm in Rust

I have written this Rust code to implement the quick sort algorithm. Could you review it and tell me if it is idiomatic or not? Especially about my use of the slices? ...
3
votes
0answers
64 views

HTTP download function in Rust (async/await)

Why am I fighting the compiler? - Wrote this, which works, but I feel like I'm breaking every rule in the book: ...
3
votes
0answers
68 views

Implement a micro service in Rust

Last year I tried to implement a micro service architecture in Rust. The imagined use case was a small izakaya-shop where digital orders could be given to the kitchen tracked or deleted. Looking for ...
4
votes
1answer
80 views

Lexer written in Rust

So I ported a lexer I wrote in C++ over to rust, as I'm starting to learn rust. Since I'm very new though, I don't know any Idioms and good practices in rust. So if anyone could point out some (...
1
vote
0answers
31 views

color and canvas implementations in Rust for Ray Tracer Challenge

I'm learning Rust by working through Jamis Buck's The Ray Tracer Challenge. The book instructs the reader on what to build in what order, and provides all required test cases. Included here are my ...
2
votes
2answers
90 views

Encrypt data before sending it to server in a way that makes it unreadable to anyone except the user who sent it

I don't have any experience in cryptography and I've written some crypto code that seem to be working, but I'm not sure if it safe and if the tools and methods I used are right. Objective Make it ...
3
votes
1answer
54 views

Find a file in current or parent directories

As a Rust beginner, I would like to know how I could improve the following points considering the function below: Handling Path and ...
2
votes
0answers
106 views

Rust/WebAssembly VS pure JavaScript benchmark in Node.js

I've wanted to try Rust and WebAssembly for a while. I recently realized that I could try both at the same time by compiling Rust to WebAssembly. I wanted to know what the performances of something ...
2
votes
0answers
48 views

recursive-file-watcher in rust

hello guys i made a file watcher in rust using notify crate that watches a directory and if it detects file changes it will copy all of the files within the directory to another directory,i wanted you ...
1
vote
1answer
39 views

Target src/main.rs::main()? [closed]

I'm basically wondering what the optimal method for returning to the top of src/main.rs::main() is? Maybe something like this: ...
0
votes
1answer
94 views

Factorial number in Rust for learning purposes

I'm currently trying to learn the basics of the Rust programming language, to do this my first piece of code after the classic 'Hello World' was a simple recursive Factorial function. This is the ...
4
votes
1answer
124 views

Rust Iterator Fizzbuzz

Rust is one of my first forays on a strongly typed language, beginning to like it's strictness, and am looking to improve my comprehension. Rules Fizzbuzz is a programming challenge with the ...
5
votes
0answers
56 views

Brainf*** interpreter in Rust

I'm learning Rust coming from an intermediate background in Python. I've completed the first 8 chapters of the book and I wanted a project that would solidify the concepts I learned, so I made a ...
2
votes
1answer
44 views

Rust Hamming Code Quizzer

I am currently learning Rust. To allow myself to practice, I created the following program that helps the user to practice hamming codes (the goal is for the user to use this program to be able to ...
5
votes
0answers
87 views

almostIncreasingSequence

This is assignment from codesignal: Given a sequence of integers as an array, determine whether it is possible to obtain a strictly increasing sequence by removing no more than one element from the ...
3
votes
0answers
42 views

Rust List comprehension macro

I'm very new to Rust and as I've been going through the book I became very interested in its macros. To better understand them I tried to write something of a usable list comprehension like those in ...
4
votes
0answers
68 views

Rust Iterative and Recursive Merge Sort Implementation

I'm in the process of learning both Rust and algorithms after primarily focusing on web development. As such I've had a go at implementing merge sort both iteratively and recursively. I've looked for ...
2
votes
1answer
74 views

Rust dynamic programming : word break

I've solved this problem: https://leetcode.com/problems/word-break Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into ...
4
votes
1answer
60 views

Rust Spelling corrector

It's been about a day since I've started writing some Rust, and I'm looking for some code review on a simple spell checker I've written up ...
4
votes
1answer
108 views

12 Days of Christmas in Rust

I've recently been trying to learn more rust and I have just finished chapter 3 of the Rust book, which has a list of projects to do to practice. I have tried to write a program that prints the 12 ...
1
vote
0answers
20 views

UDP to HTTP/2 DNS proxy

I've written my first ever Rust application, I'm looking for advice and criticism. It is a very small application, using Tokio async, and is meant to be single threaded. Mostly I'd like to know if I ...
8
votes
1answer
61 views

Boggle solver in Rust - Looking for speedup

I recently made a boggle solver in Rust to compensate for the fact that I'm really bad at boggle. This has also been a good Rust learning experience. The code does what it's supposed to quite well but ...
1
vote
0answers
62 views

Printing random lines from a file and compiling it to WebAssembly for web view

I want to learn Wasm and Rust. This project can execute Wasm from GitHub Pages. The first attempts failed because of some policy error with the Wasm MIME type. When I tried Yew Framework then it ...
1
vote
0answers
55 views

String parsing algorithm in Rust

I have written a recursive parsing algorithm for strings with nested brackets (I needed it to solve a molecules to atoms task). I would love to see how I could make ...
2
votes
1answer
84 views

Creating a thumbnail of a PDF using Cairo, Poppler and Rust

I want to create thumbnails from PDF files – specifically, a thumbnail of the first page. Currently I use pdftocairo on the command line: ...
11
votes
4answers
920 views

Writing slice compare in a more compact way

I have this code snippet comparing two slice references: ...
2
votes
1answer
157 views

Advent of Code 2019 Day 2 in Rust

I'm also doing the fun little Advent of Code challenges in order to learn Rust. Until now things went quite smoothly, but while I'm proceeding with the tasks I'd love to learn where I can actually ...
5
votes
2answers
118 views

Advent of Code 2019 Day 6 - Beginner Rust solution

I am doing Advent of Code 2019 in order to learn Rust (it's been fun, but challenging!). I am looking for help and feedback from more experiences Rustaceans on my solution to Day 6: Universal Orbit ...
2
votes
1answer
39 views

Shortening function calls with closures

I wrote this code that makes a fairly long function call multiple times using some of the same parameters ...
3
votes
0answers
74 views

Wrapping a C API to be implemented in rust

I'm writing a Rust library to facilitate implementing the following C API in Rust. That is, it should be possible to create a Rust-idiomatic implementation by depending on my wrapper library. ...
5
votes
1answer
112 views

Cache implementation in Rust

I've started learning Rust recently using the Rust book. In one of the chapters, the authors encourage the reader to experiment with closures, and try to create a generic cache implementation. I've ...
2
votes
1answer
57 views

Lex Scheme in Rust

I'm writing a Scheme interpreter in Rust, and the first step is the parser. I've finished the lexer, and would like to see what people think of it before I go any further. ...
4
votes
1answer
50 views

Summation Over Lines in a File (Advent of Code 2018 Day 1)

Preface: I am learning Rust through the Advent of Code The task is to read lines from a file, parse each as an integer, then provide a summation of all the numbers. My solution looks like this: <...
3
votes
0answers
76 views

Rust 2D grid class

This is the first time I‘ve used Rust, and I'd like to have some feedback on this project. The Grid class should be able to store objects of any type; it's a simple ...
2
votes
1answer
43 views

Reporting progress using a Follower

My goal is to implement a function that accepts a Follower object that will be used to report progress through a complex function (a depth-first traversal of a ...
5
votes
1answer
138 views

Shoe shine shop model in Rust and C++ - Follow-up

I've just refactored my Rust and C++ code which simulates the shoeshine shop model from this question. What else can be improved? C++: ...

1
2 3 4 5
9