Skip to content

u/lazyear

In this archive from Sep 2016 to Sep 2020

2
posts
11
comments
0
media
93
score

Once it clicks, I have found rust to be a joy to write. Been using it for around 3 years. It gets much easier - I can imagine coming from JS makes it difficult too.

You want

let mut list = ...
for x in list.iter_mut() {
    *x = sort(max, *x);
}

--- or ----

for i in 0..list.len() {
    list[i] = sort(max, list[i])
}
2 points

No need to clone a usize. It's a Copy type :)

Actually... there are multiple other errors in your code as well, I suspect it doesn't compile. list not declared as mutable, attempted iterator invalidation, etc etc

2 points

I (and many others) wanted a way to have the bitwarden browser extension/phone apps to have a way to auto-log out in addition to auto-lock after a timeout - the difference being that you need to use 2FA every time you log out, but not after locking. I have a yubikey, and wanted to have bitwarden authenticate against my identity more frequently, since by default you are never logged out.

So I authored an extension to the browser plugin and backing library that added in the "Vault timeout action". My exact code wasn't merged into master since I believe they wanted to make some architectural changes to support this, rather than the workaround I implemented.

11 points

End of this list.

Back to top

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.