---
title: "Raphael Carubbi (@rcarubbi) | Hashnode"
description: "Web Developer and Kung Fu fighter. Read the latest articles by Raphael Carubbi on Hashnode."
url: "https://hashnode.com/@rcarubbi"
---

@rcarubbi

# Raphael Carubbi

@rcarubbi · Joined December 2023

Web Developer and Kung Fu fighter

## Comments

[you get by id first and then pass the current value to the new Todo instance: pub fn update\_todo\_by\_id(&self, id: &str, todo: Todo) -> Option<Todo> { let mut todos = self.todos.lock().unwrap(); let updated\_at = Utc::now(); let index = todos.iter().position(|todo| todo.id == Some(id.to\_string()))?; let todo = Todo { id: Some(id.to\_string()), updated\_at: Some(updated\_at), created\_at: todos\[index\].created\_at, ..todo }; todos\[index\] = todo.clone(); Some(todo) }](https://hashnode.com/posts/rust-development-creating-a-rest-api-with-actix-web-for-beginners/640c7acc0fc3ad7a73a9d4d5/comment/6562704429658b9b067c2934#reply-656ff322d65dd4cd71f39c48)

Reply · Article · Dec 6, 2023 · [Rust Development: Creating a REST API with Actix Web for Beginners](https://hashnode.com/posts/rust-development-creating-a-rest-api-with-actix-web-for-beginners/640c7acc0fc3ad7a73a9d4d5)
