WEBVTT

00:00:01.470 --> 00:00:06.210
<v Matthias>It's Rust in Production, a podcast about companies who use Rust to shape the

00:00:06.210 --> 00:00:07.150
<v Matthias>future of infrastructure.

00:00:07.490 --> 00:00:12.750
<v Matthias>I'm Matthias Endler from corrode, and today we talk to Andrew Burkhardt from

00:00:12.750 --> 00:00:16.010
<v Matthias>1Password about securing logins with Rust.

00:00:19.150 --> 00:00:23.810
<v Matthias>Andrew, thanks so much for being a guest today. Can you say a few words about

00:00:23.810 --> 00:00:25.450
<v Matthias>yourself and about 1Password?

00:00:26.410 --> 00:00:29.370
<v Andrew>Yeah, definitely. Thank you for having me. So I'm Andrew Burkhardt.

00:00:29.490 --> 00:00:34.170
<v Andrew>I'm a senior Rust developer at 1Password. I work on the product foundations

00:00:34.170 --> 00:00:37.030
<v Andrew>team, or in the org, I should say, on the frameworks team.

00:00:37.090 --> 00:00:41.590
<v Andrew>So we specifically focus mostly on async Rust frameworks.

00:00:41.910 --> 00:00:47.330
<v Andrew>I've been here about three years now and working on data synchronization mostly,

00:00:47.550 --> 00:00:50.350
<v Andrew>which has been pretty interesting as we grow.

00:00:50.650 --> 00:00:54.430
<v Andrew>We spread kind of to other products that have come in. You know,

00:00:54.510 --> 00:00:57.950
<v Andrew>the password manager has kind of historically been our core business,

00:00:57.950 --> 00:01:00.890
<v Andrew>and that's what people have known us for for almost 20 years now.

00:01:01.250 --> 00:01:04.730
<v Andrew>But, you know, over the last few years, especially, we've grown a lot and acquired

00:01:04.730 --> 00:01:10.270
<v Andrew>a few companies and so forth and really spread ourselves across the security space,

00:01:10.490 --> 00:01:13.650
<v Andrew>you know, with various things from the password manager to, you know,

00:01:13.730 --> 00:01:18.290
<v Andrew>developer tools and a lot of like enterprise password management features.

00:01:18.290 --> 00:01:21.810
<v Andrew>And we have things like connect servers and so forth that, you know,

00:01:22.090 --> 00:01:24.870
<v Andrew>skim bridges that help with identity management, all these things.

00:01:25.050 --> 00:01:29.050
<v Andrew>And then into the companies that we acquired, like Passage, which helps with

00:01:29.050 --> 00:01:33.870
<v Andrew>Passkeys, Collide, which does on-device health checking, Metrolika,

00:01:34.050 --> 00:01:36.270
<v Andrew>which handles provisioning and some things like that.

00:01:37.420 --> 00:01:40.460
<v Andrew>So, yeah, so across all those various areas, you know, sync has been a really,

00:01:40.620 --> 00:01:45.780
<v Andrew>really interesting use case to kind of combine all the various information we have in different ways.

00:01:46.440 --> 00:01:52.520
<v Matthias>And by sync, you mean actually combining all of the information from devices

00:01:52.520 --> 00:01:55.440
<v Matthias>or user profiles or what does that mean exactly?

00:01:56.100 --> 00:02:00.660
<v Andrew>Yeah, so the sort of summary, I guess, would probably be, you know,

00:02:00.800 --> 00:02:06.020
<v Andrew>federating or, you know, getting the data to be the same from clients to the

00:02:06.020 --> 00:02:10.260
<v Andrew>Rust core to the server and all the way back around to any clients that are relevant.

00:02:11.180 --> 00:02:14.680
<v Andrew>So that may be something as simple as, you know, you and I are on the same one

00:02:14.680 --> 00:02:18.680
<v Andrew>password account in the password manager and I add an item that you now need.

00:02:18.680 --> 00:02:23.520
<v Andrew>So we sync that data across, but it can also be other things like,

00:02:23.620 --> 00:02:25.060
<v Andrew>you know, if you're in the enterprise space,

00:02:25.300 --> 00:02:28.880
<v Andrew>just making sure that the data from one place talks to another and so forth,

00:02:28.940 --> 00:02:33.940
<v Andrew>so that if there is relevant context from one area, that is available, area, things like that.

00:02:34.520 --> 00:02:38.660
<v Matthias>Yeah i can totally relate to that because one of the worst

00:02:38.660 --> 00:02:41.800
<v Matthias>developer experiences is if data that

00:02:41.800 --> 00:02:44.920
<v Matthias>you expect to be there isn't there or is in

00:02:44.920 --> 00:02:51.080
<v Matthias>a sort of limbo and i think sync needs to be really reliable and that's the

00:02:51.080 --> 00:02:55.420
<v Matthias>core of the product if that is not reliable then well everything else is just

00:02:55.420 --> 00:03:00.760
<v Matthias>nice user experience but it's not really like i would say user interface but

00:03:00.760 --> 00:03:02.040
<v Matthias>not a great user experience.

00:03:02.040 --> 00:03:04.880
<v Andrew>Yeah definitely and that's you know it's created

00:03:04.880 --> 00:03:07.620
<v Andrew>a lot of you know patterns i guess you

00:03:07.620 --> 00:03:10.400
<v Andrew>would say that we hold pretty strongly to like you know sync

00:03:10.400 --> 00:03:13.280
<v Andrew>here conversations about this this morning actually sync here is

00:03:13.280 --> 00:03:16.320
<v Andrew>always sort of a background task so anything

00:03:16.320 --> 00:03:19.080
<v Andrew>that you're doing sync should essentially be a side effect

00:03:19.080 --> 00:03:23.880
<v Andrew>of it and it should happen asynchronously in the background and you know that

00:03:23.880 --> 00:03:28.880
<v Andrew>way you kind of always assume that the data you have is current because sync

00:03:28.880 --> 00:03:32.420
<v Andrew>has been happening in the background and therefore you have the expectation

00:03:32.420 --> 00:03:36.400
<v Andrew>that that data has already been brought locally to your device,

00:03:36.540 --> 00:03:40.220
<v Andrew>which gives the feature developers a little bit of freedom because you don't

00:03:40.220 --> 00:03:42.240
<v Andrew>have to go request things and wait for it and do this.

00:03:42.360 --> 00:03:45.300
<v Andrew>I mean, there are cases where that has to happen, but in general,

00:03:45.700 --> 00:03:49.840
<v Andrew>the vast majority of the data has already been brought locally and cached and so forth.

00:03:49.920 --> 00:03:53.500
<v Andrew>So I can just act on that cache as though, you know, I'm the only one using

00:03:53.500 --> 00:03:57.180
<v Andrew>this data or something, which is convenient in a lot of cases.

00:03:58.020 --> 00:04:02.440
<v Matthias>It's sort of funny that you need async in order for something to be synced,

00:04:02.520 --> 00:04:06.880
<v Matthias>but it does make sense if you think about it because, well, it happens in the background and,

00:04:08.120 --> 00:04:13.220
<v Matthias>A lot of things need to happen for it to look synchronous, but it's not easy.

00:04:14.220 --> 00:04:19.180
<v Andrew>Yeah, yeah, definitely. And you get into the nitty gritty details of like synchronous

00:04:19.180 --> 00:04:25.720
<v Andrew>versus synchronized and so forth. And we definitely overload the word sync probably way too much.

00:04:26.120 --> 00:04:31.680
<v Matthias>So take us back a couple of years ago when you started. You said you're at 1Password

00:04:31.680 --> 00:04:33.040
<v Matthias>for three years now, I guess.

00:04:33.760 --> 00:04:38.220
<v Matthias>What was your background back then? Where do you come from? And then what was

00:04:38.220 --> 00:04:41.400
<v Matthias>the state of Rust at 1Password when you started?

00:04:41.920 --> 00:04:48.580
<v Andrew>Yeah, so I had done mostly, my prior job had been a lot of Kotlin and Spring

00:04:48.580 --> 00:04:54.260
<v Andrew>Boot, which, you know, is kind of like, it's a framework for Kotlin doing server side stuff.

00:04:54.880 --> 00:04:58.400
<v Andrew>And I was doing a lot of that, like backend web programming.

00:04:58.660 --> 00:05:03.540
<v Andrew>I also worked on the front end a little bit with TypeScript and the Vue framework for UI.

00:05:03.800 --> 00:05:07.320
<v Andrew>But I wasn't really like a front end developer. I did, you know,

00:05:07.320 --> 00:05:10.040
<v Andrew>it's referred to, I think, as like the BFF pattern where like,

00:05:10.140 --> 00:05:13.080
<v Andrew>you have one server that manages a lot of different things.

00:05:13.220 --> 00:05:16.060
<v Andrew>And then you have all these front ends that manage pieces of that,

00:05:16.160 --> 00:05:19.260
<v Andrew>right? Like, for example, I worked on an app that did a lot of settings,

00:05:19.500 --> 00:05:20.640
<v Andrew>like behind the scenes settings.

00:05:20.880 --> 00:05:24.780
<v Andrew>And then we had a lot of other apps where actual end users would interact with

00:05:24.780 --> 00:05:27.300
<v Andrew>it. And the one main server powered it all.

00:05:27.480 --> 00:05:31.880
<v Andrew>But instead of muddying that server with, you know, all these either,

00:05:32.160 --> 00:05:34.020
<v Andrew>you know, like you could use something like GraphQL, I suppose.

00:05:34.180 --> 00:05:37.600
<v Andrew>But like instead of muddying it with all these APIs that supported vastly different

00:05:37.600 --> 00:05:42.560
<v Andrew>use cases, we created these BFF servers where each front end has its own back

00:05:42.560 --> 00:05:46.520
<v Andrew>end that then translates to the real sort of underlying back end.

00:05:46.680 --> 00:05:48.460
<v Andrew>So I'd always done kind of that mid layer.

00:05:49.180 --> 00:05:53.640
<v Andrew>Of development. And that was actually very helpful because it turns out,

00:05:54.000 --> 00:05:57.840
<v Andrew>you know, getting into the state of Rust and 1Password is that's kind of how Rust is used here.

00:05:58.040 --> 00:06:03.140
<v Andrew>So each of our apps, you know, obviously we have quite a few between iOS and

00:06:03.140 --> 00:06:06.800
<v Andrew>Android and Mac and Windows and Linux and web and extension and all these different places.

00:06:07.160 --> 00:06:09.180
<v Andrew>All of them are native clients.

00:06:09.580 --> 00:06:12.900
<v Andrew>So they operate, you know, the iOS app is in Swift and so forth.

00:06:12.960 --> 00:06:16.860
<v Andrew>And then they are bundled with kind of like an embedded backend,

00:06:17.160 --> 00:06:19.460
<v Andrew>which is a Rust, we call it the core.

00:06:19.700 --> 00:06:23.840
<v Andrew>So the Rust core is inside of all of these and that is doing as much of the

00:06:23.840 --> 00:06:28.620
<v Andrew>business logic as we can to leave those native clients to just be display layer,

00:06:28.780 --> 00:06:30.020
<v Andrew>essentially a presentation layer.

00:06:30.260 --> 00:06:33.300
<v Andrew>And then that communicates to the actual cloud server and so forth.

00:06:33.620 --> 00:06:37.140
<v Andrew>And so Rust got picked up here. I don't actually know when it was,

00:06:37.260 --> 00:06:42.420
<v Andrew>but my understanding is it was originally picked up for the Windows app that was being built.

00:06:42.960 --> 00:06:48.180
<v Andrew>And And over time, when we got from 1Password 7 to 1Password 8,

00:06:48.340 --> 00:06:51.980
<v Andrew>I think it was, again, it was slightly before me, but I think that was when

00:06:51.980 --> 00:06:55.080
<v Andrew>it was like, okay, we need more cross-platform functionality because we're building

00:06:55.080 --> 00:06:59.880
<v Andrew>so many features that were not originally just password management concerns.

00:06:59.880 --> 00:07:03.140
<v Andrew>We're building all these different things, and they need to work on all these

00:07:03.140 --> 00:07:05.720
<v Andrew>platforms, and we're implementing them over and over and over again.

00:07:05.720 --> 00:07:10.840
<v Andrew>And so when they decided they wanted to create sort of the singular core that

00:07:10.840 --> 00:07:14.120
<v Andrew>was going to power all the apps, they had already started to use Rust on Windows

00:07:14.120 --> 00:07:17.240
<v Andrew>and it had worked really well. And so a lot of it just got ported over.

00:07:17.480 --> 00:07:21.740
<v Andrew>And so when I got here, we were just in this kind of big growth phase back in

00:07:21.740 --> 00:07:28.100
<v Andrew>2022 and a ton of new people coming in. And so Rust was sort of proliferating

00:07:28.100 --> 00:07:31.220
<v Andrew>very quickly as the core was building, you know, all these developer features

00:07:31.220 --> 00:07:32.420
<v Andrew>and these different things.

00:07:32.820 --> 00:07:38.640
<v Andrew>And it was right about then we did a reorg of the development teams and created

00:07:38.640 --> 00:07:40.960
<v Andrew>the team that I'm now on, which is the frameworks team,

00:07:41.140 --> 00:07:45.180
<v Andrew>along with a few other teams that do, for example, like security specific development

00:07:45.180 --> 00:07:50.520
<v Andrew>or platform specific development, like handling the nuances of Windows or Android or whatever it might be.

00:07:51.320 --> 00:07:57.040
<v Andrew>And all of us kind of came together to design patterns and rules and so forth

00:07:57.040 --> 00:08:00.660
<v Andrew>around Rust development to try to sort of wrangle all these different things that were happening.

00:08:00.880 --> 00:08:04.760
<v Andrew>And that's kind of got us into the patterns that we have today,

00:08:04.980 --> 00:08:10.500
<v Andrew>which have been really nice to keep this giant core as maintainable as possible.

00:08:11.400 --> 00:08:15.980
<v Matthias>Nice. I want to get back to the patterns in a second. But before we do that,

00:08:16.380 --> 00:08:21.040
<v Matthias>what did you use before Rust? Was it very platform dependent?

00:08:21.400 --> 00:08:25.940
<v Matthias>Did you have this business logic in, for example, Kotlin and then Swift and so on?

00:08:26.760 --> 00:08:29.640
<v Andrew>Yeah, exactly. So, like I said, that was all before me.

00:08:29.720 --> 00:08:32.680
<v Andrew>But my understanding is that everything was basically built natively,

00:08:32.820 --> 00:08:35.940
<v Andrew>which gives you some benefits, right? There are pros and cons of that.

00:08:36.060 --> 00:08:41.180
<v Andrew>But at the scale that we're at now, it's just not feasible to have that much

00:08:41.180 --> 00:08:45.100
<v Andrew>code and have that many different implementations. And obviously,

00:08:45.260 --> 00:08:49.920
<v Andrew>just when you're building a security app, you don't, multiple implementations is a problem, right?

00:08:50.040 --> 00:08:54.340
<v Andrew>Anytime you have to do that, there is now the risk that one of these implementations

00:08:54.340 --> 00:08:56.560
<v Andrew>is vulnerable in some way that the other isn't.

00:08:56.720 --> 00:09:00.440
<v Andrew>And we're trying to compare, you know, Swift code to Kotlin code to TypeScript

00:09:00.440 --> 00:09:03.980
<v Andrew>to, you know, Go or whatever and so forth, and make sure that these are all

00:09:03.980 --> 00:09:05.020
<v Andrew>doing the exact same thing.

00:09:05.180 --> 00:09:09.500
<v Andrew>But those languages may have different underlying models for async or memory

00:09:09.500 --> 00:09:15.040
<v Andrew>management or whatever it is. And so it just wasn't feasible to continue on like that.

00:09:15.200 --> 00:09:19.520
<v Andrew>And so the REST core really helped us to, I mean, it just enabled features that

00:09:19.520 --> 00:09:22.060
<v Andrew>we really weren't, that weren't possible before.

00:09:22.660 --> 00:09:26.520
<v Matthias>In my idealized way to think about it,

00:09:26.840 --> 00:09:33.380
<v Matthias>what I hope would happen is that once you merge in all of that code into one

00:09:33.380 --> 00:09:35.480
<v Matthias>code base, into one Rust code base,

00:09:35.680 --> 00:09:41.180
<v Matthias>that you see how different platforms or different languages solve these problems

00:09:41.180 --> 00:09:46.040
<v Matthias>or different developers solve the same problem and some of them solve different edge cases.

00:09:46.240 --> 00:09:50.040
<v Matthias>And then when you merge that together, you get a thing that is stronger than

00:09:50.040 --> 00:09:52.320
<v Matthias>its parts. did that happen?

00:09:53.460 --> 00:09:56.420
<v Andrew>Yeah I think so I think and you get the opposite too

00:09:56.420 --> 00:09:59.160
<v Andrew>right where it's like you know we'll get one component and it's like what is

00:09:59.160 --> 00:10:01.980
<v Andrew>this thing doing it's like oh we ported that from this other version like

00:10:01.980 --> 00:10:05.380
<v Andrew>oh that was the worst version why did we pick that one you know and so you do

00:10:05.380 --> 00:10:09.480
<v Andrew>see that but yeah I think in a lot of ways you definitely get the benefit of

00:10:09.480 --> 00:10:13.600
<v Andrew>that and we see that having native clients I mean we've got developers who have

00:10:13.600 --> 00:10:17.320
<v Andrew>done Swift and Mac development for you know 20 years or whatever it might be

00:10:17.320 --> 00:10:21.100
<v Andrew>and so then they come at it and it's like okay hey hey, we need to build this feature.

00:10:21.460 --> 00:10:24.480
<v Andrew>You know, I need some help with the Rust side of it. And you see something and

00:10:24.480 --> 00:10:26.840
<v Andrew>you're like, that's not at all how I would have thought to do it.

00:10:26.880 --> 00:10:28.880
<v Andrew>And they're like, well, here's how we do it, you know, in Mac land.

00:10:29.160 --> 00:10:33.520
<v Andrew>And you start to get interesting new ideas, I think, about how you can handle,

00:10:34.040 --> 00:10:35.700
<v Andrew>you know, how you can tackle various problems.

00:10:35.980 --> 00:10:39.740
<v Andrew>So I think we get that just by nature of having all the different developers,

00:10:39.920 --> 00:10:46.020
<v Andrew>but we definitely saw it in the growth of the Rust core and trying to pull things together.

00:10:46.020 --> 00:10:50.800
<v Andrew>And now trying to add in some of the browser features that we had implemented

00:10:50.800 --> 00:10:54.860
<v Andrew>natively in the browser, now that we're trying to pull them into Rust and compile

00:10:54.860 --> 00:10:58.740
<v Andrew>them into Wasm, we're seeing some of those patterns again that we can learn

00:10:58.740 --> 00:11:00.480
<v Andrew>from and improve throughout.

00:11:01.200 --> 00:11:06.600
<v Matthias>Was the Rust ecosystem prepared for what 1Password asked it to do?

00:11:06.680 --> 00:11:11.120
<v Matthias>Or were there any gaps in the Crate ecosystem, for example?

00:11:11.420 --> 00:11:14.620
<v Andrew>I think there were probably some. I would say, in general, yes.

00:11:14.740 --> 00:11:17.160
<v Andrew>I think the ecosystem was growing so fast and.

00:11:17.840 --> 00:11:21.340
<v Andrew>There were so many people building interesting things that I think it gave us

00:11:21.340 --> 00:11:25.220
<v Andrew>a lot of freedom to innovate on top of those.

00:11:25.380 --> 00:11:29.120
<v Andrew>I think there were small gaps, which is where you've seen some of the crates that we've put out.

00:11:29.540 --> 00:11:33.440
<v Andrew>Gaps like, for example, having those native clients, there's no type safety

00:11:33.440 --> 00:11:35.400
<v Andrew>across the FFI necessarily.

00:11:35.400 --> 00:11:39.160
<v Andrew>If I'm writing Swift and then I send something into the FFI and then into the

00:11:39.160 --> 00:11:41.620
<v Andrew>Rust core, I'm just hoping the types line up.

00:11:41.620 --> 00:11:46.100
<v Andrew>So we created the type share crate, which is, it's not giving you necessarily

00:11:46.100 --> 00:11:49.880
<v Andrew>complete type safety, but it is at least making sure that you're not writing

00:11:49.880 --> 00:11:51.340
<v Andrew>the types on the client side.

00:11:51.520 --> 00:11:55.320
<v Andrew>They are generated from your Rust code so that if the Rust code changes,

00:11:55.540 --> 00:11:59.740
<v Andrew>the client side types change. You're not having to manually keep those in sync.

00:11:59.740 --> 00:12:01.740
<v Andrew>So I think that's been really helpful.

00:12:02.080 --> 00:12:05.180
<v Andrew>And then there are other little things. Another one we released somewhat recently

00:12:05.180 --> 00:12:06.780
<v Andrew>is called zeroizing alloc.

00:12:07.220 --> 00:12:12.020
<v Andrew>Which is like a wrapper around the global allocator that makes sure,

00:12:12.300 --> 00:12:15.820
<v Andrew>you know, if you're using this, whenever memory would normally be deallocated,

00:12:15.960 --> 00:12:18.080
<v Andrew>which in that case, you know, it's sort of just dropped, right?

00:12:18.140 --> 00:12:20.540
<v Andrew>It's free for the system to use for other things.

00:12:20.720 --> 00:12:24.420
<v Andrew>We don't want to just let that sit around in case the system doesn't need it.

00:12:24.480 --> 00:12:27.540
<v Andrew>And that memory sits there forever, right? We can't have that when you're dealing

00:12:27.540 --> 00:12:31.640
<v Andrew>with sensitive data. So the zeroizing alloc crate will help to just flip those

00:12:31.640 --> 00:12:34.660
<v Andrew>all back to zeros during that deallocation process.

00:12:34.860 --> 00:12:39.600
<v Andrew>So there were little things like that, that obviously Rust as a language was

00:12:39.600 --> 00:12:42.600
<v Andrew>ready for. There just hadn't been that use case necessarily.

00:12:42.880 --> 00:12:47.540
<v Andrew>And so I think it created nice gaps for us to fill with some of those things.

00:12:47.900 --> 00:12:51.980
<v Matthias>Yeah, I came across this zeroizing alloc crate.

00:12:52.500 --> 00:12:57.280
<v Matthias>Actually before that, because the link was purple. So this is how I know.

00:12:58.440 --> 00:13:02.800
<v Matthias>I'm surprised that no one else built such a crate before. Or did you look at

00:13:02.800 --> 00:13:04.280
<v Matthias>some and didn't really like them?

00:13:05.120 --> 00:13:07.760
<v Andrew>I don't know how we came across that. And I wonder to some degree,

00:13:07.860 --> 00:13:10.200
<v Andrew>like if you look at the crate, it's not particularly complex,

00:13:10.400 --> 00:13:12.540
<v Andrew>right? It's a fairly straightforward implementation.

00:13:13.000 --> 00:13:15.800
<v Andrew>And I've seen this in other cases where...

00:13:16.550 --> 00:13:19.670
<v Andrew>I think sometimes we look at a problem and we go, oh, it's so simple,

00:13:19.790 --> 00:13:22.010
<v Andrew>like I don't need to make a crate to deal with this problem.

00:13:22.170 --> 00:13:25.790
<v Andrew>You know, it's maybe a common problem, but it's like, I'll just throw this together.

00:13:27.430 --> 00:13:30.150
<v Andrew>And, you know, maybe people don't want the dependency or something like that.

00:13:30.150 --> 00:13:33.970
<v Andrew>I'll just kind of hand roll it very similarly or something along those lines.

00:13:34.090 --> 00:13:35.650
<v Andrew>I think sometimes that happens, right?

00:13:35.790 --> 00:13:39.710
<v Andrew>And people are obviously wary sometimes of dependencies, you know,

00:13:39.790 --> 00:13:42.330
<v Andrew>especially ones that do smaller things, right? We saw, I think,

00:13:42.330 --> 00:13:46.070
<v Andrew>in the TypeScript NPM world, there was like the left pad incident,

00:13:46.130 --> 00:13:48.790
<v Andrew>right? where like all this thing is doing is handling this left padding.

00:13:49.050 --> 00:13:52.670
<v Andrew>And it's so simple, but then when it's gone, now we have a big problem, you know.

00:13:52.750 --> 00:13:57.050
<v Andrew>And so that could be the reason that some of those things just don't get created.

00:13:57.130 --> 00:13:59.950
<v Andrew>It may not be, you know, I doubt we were the first people to think of it.

00:14:00.030 --> 00:14:02.830
<v Andrew>You know, it's probably something someone else had solved before.

00:14:03.030 --> 00:14:05.270
<v Andrew>They maybe just didn't make a crate for it or something like that.

00:14:05.330 --> 00:14:06.890
<v Andrew>Or maybe there is one out there and I just haven't seen.

00:14:07.690 --> 00:14:11.090
<v Matthias>What is the policy around creating crates at one password?

00:14:12.530 --> 00:14:17.050
<v Andrew>You know, there's, this has been an interesting thing that I've seen here,

00:14:17.150 --> 00:14:22.170
<v Andrew>right, is because one password, the password manager concept is 20 years old, right?

00:14:22.330 --> 00:14:25.450
<v Andrew>And conceptually, a lot of it is similar to what it was then.

00:14:25.890 --> 00:14:29.210
<v Andrew>And then the Rust app itself, you know, now is, you know, five,

00:14:29.350 --> 00:14:32.570
<v Andrew>six, seven years old. I don't know exactly how old, but it's been around a while.

00:14:34.010 --> 00:14:38.350
<v Andrew>You have these things that have grown so much and for the most part creating

00:14:38.350 --> 00:14:42.930
<v Andrew>new crates internally it's just a matter of code architecture does it make sense,

00:14:43.090 --> 00:14:47.530
<v Andrew>is it a necessary separation a lot of problems you deal with anywhere,

00:14:48.150 --> 00:14:53.750
<v Andrew>making crates public is sometimes tricky because one you have to figure out

00:14:53.750 --> 00:14:56.810
<v Andrew>does this make sense to make public like zeroizing alloc, we probably could

00:14:56.810 --> 00:14:59.090
<v Andrew>have left that internal but we figured it might help some people,

00:14:59.760 --> 00:15:05.180
<v Andrew>And it's not like a, you know, private, you know, secret thing that 1Password does.

00:15:05.300 --> 00:15:08.500
<v Andrew>I think a lot of people know that, you know, we have to deal with memory this way.

00:15:10.020 --> 00:15:14.140
<v Andrew>So you have some of those initial concerns about whether or not we should make this public.

00:15:14.340 --> 00:15:18.940
<v Andrew>And then it's like untangling it from everything else you've built over the last few years, right?

00:15:19.040 --> 00:15:23.920
<v Andrew>And, you know, there are things like our, you know, clipboard manager,

00:15:23.920 --> 00:15:26.280
<v Andrew>it's called Rboard, that's made public, you know, and you got to go,

00:15:26.280 --> 00:15:29.740
<v Andrew>okay, well, we had all these, you know, 1Password specific assumptions.

00:15:30.700 --> 00:15:35.120
<v Andrew>Now we have to pull those out and make this just a dependency as though it were

00:15:35.120 --> 00:15:39.600
<v Andrew>a third party dependency to us as well, you know, and so a lot of it is just,

00:15:39.700 --> 00:15:42.880
<v Andrew>just small bits of process of untangling things.

00:15:43.120 --> 00:15:48.520
<v Andrew>But, but as far as deciding to make it public, that's pretty case specific,

00:15:48.520 --> 00:15:50.220
<v Andrew>I guess, or situation specific.

00:15:50.520 --> 00:15:53.980
<v Andrew>And I think we've been trying to, to get more and more out there.

00:15:53.980 --> 00:15:58.160
<v Andrew>You know, we released, for example, the passkey RS crate, which I think is only

00:15:58.160 --> 00:16:00.020
<v Andrew>valuable to other password managers.

00:16:00.520 --> 00:16:03.300
<v Andrew>Like, I don't know if there's anybody because it really just validates,

00:16:03.480 --> 00:16:07.440
<v Andrew>like, does verification of passkeys. And so I don't know that anyone else would ever need it.

00:16:08.120 --> 00:16:10.580
<v Andrew>But, you know, we released it because, one, it might help them.

00:16:10.660 --> 00:16:12.940
<v Andrew>And we really want to see passkeys get adopted in more places,

00:16:12.940 --> 00:16:15.120
<v Andrew>even if that's, you know, in a competing app.

00:16:15.280 --> 00:16:18.400
<v Andrew>We want to make sure that that's available and so forth. And it's also just

00:16:18.400 --> 00:16:21.900
<v Andrew>interesting, you know, rust that people might be able to learn from and so forth.

00:16:21.900 --> 00:16:26.960
<v Andrew>So, yeah, it definitely depends on the situation, but it's a bit of a process either way.

00:16:28.160 --> 00:16:33.220
<v Matthias>Maybe one of the listeners checks out that crate and builds a thing that we

00:16:33.220 --> 00:16:34.280
<v Matthias>both haven't anticipated.

00:16:34.400 --> 00:16:38.180
<v Matthias>It happens more often than I expect.

00:16:38.480 --> 00:16:41.920
<v Matthias>And the other thing is open sourcing software.

00:16:43.000 --> 00:16:48.180
<v Matthias>Whether it's Rust or not is a huge lift for every company, because what a lot

00:16:48.180 --> 00:16:52.580
<v Matthias>of people forget is everything other than the code, versioning,

00:16:52.780 --> 00:16:57.380
<v Matthias>documentation, testing, CI, communication, and so on.

00:16:57.700 --> 00:17:04.940
<v Matthias>And also, to some extent, exposing how you build things at a certain company.

00:17:05.160 --> 00:17:10.000
<v Matthias>And also, a lot of developers are afraid to share how they write code.

00:17:10.000 --> 00:17:15.400
<v Matthias>And did you ever get any external contributions to make it worth it?

00:17:16.500 --> 00:17:20.360
<v Andrew>Yeah, I mean, especially like with TypeShare, I think I'm trying to think of what language it was.

00:17:20.680 --> 00:17:24.860
<v Andrew>I want to say like Scala or something like that. Like some, you know, we don't use Scala.

00:17:25.040 --> 00:17:28.880
<v Andrew>And so we never built, you know, a TypeShare integration with Scala,

00:17:29.060 --> 00:17:30.280
<v Andrew>but someone from the community did.

00:17:30.420 --> 00:17:33.180
<v Andrew>And so now I want to say it's Scala. Now there is, you know,

00:17:33.240 --> 00:17:36.200
<v Andrew>the capability to convert your Rust types into Scala and so forth.

00:17:36.280 --> 00:17:40.220
<v Andrew>And I think those are nice. We don't, I don't know that we've ever really open

00:17:40.220 --> 00:17:44.220
<v Andrew>sourced anything with the hope that people would build features that we need.

00:17:44.440 --> 00:17:47.560
<v Andrew>You know, we generally are trying to do it sort of the other way around,

00:17:47.680 --> 00:17:50.600
<v Andrew>like, you know, make sure that our work is helping people where we can.

00:17:50.740 --> 00:17:55.260
<v Andrew>Like you said, it can be tricky, especially just from an operational standpoint, right?

00:17:55.360 --> 00:18:00.480
<v Andrew>There's, I think I saw some, we have like 150,000 businesses that use 1Password

00:18:00.480 --> 00:18:01.940
<v Andrew>or something like that or more than that.

00:18:02.280 --> 00:18:02.400
<v Matthias>Wow.

00:18:02.600 --> 00:18:06.460
<v Andrew>So when you have that number of people, the number of needs is pretty high,

00:18:06.540 --> 00:18:11.200
<v Andrew>right? We have a lot of, this company needs this thing and this company needs this thing and so forth.

00:18:11.340 --> 00:18:15.660
<v Andrew>And if you open source something, you lose the ability to make breaking changes quickly.

00:18:16.220 --> 00:18:19.520
<v Andrew>You don't want to, I mean, I guess you technically could, but that's not a very

00:18:19.520 --> 00:18:22.140
<v Andrew>good open source project if you're just breaking all the time.

00:18:23.420 --> 00:18:26.880
<v Andrew>So that's one of the harder parts is when you're making that decision,

00:18:27.200 --> 00:18:29.100
<v Andrew>is this something we can open source?

00:18:29.440 --> 00:18:33.000
<v Andrew>And can we give, like you said, versioning, can we give any kind of guarantee

00:18:33.000 --> 00:18:36.760
<v Andrew>that if we make version one, And version one is stable and safe and it's good.

00:18:37.270 --> 00:18:40.970
<v Andrew>That's fine. But now if we need to make version two a breaking change because

00:18:40.970 --> 00:18:46.150
<v Andrew>we need it for something we're trying to build, well, now version one kind of becomes unsupported.

00:18:46.290 --> 00:18:48.430
<v Andrew>So if version two doesn't work for what you're trying to do,

00:18:48.610 --> 00:18:51.170
<v Andrew>well, now what if there's a security vulnerability with version one?

00:18:51.290 --> 00:18:55.070
<v Andrew>Now you've created these two branches that should be maintained by someone.

00:18:55.230 --> 00:18:58.910
<v Andrew>And if that happens a second time and a third time, you just create this web

00:18:58.910 --> 00:19:03.270
<v Andrew>of challenges. So, you know, it would be great if we could open source everything,

00:19:03.510 --> 00:19:05.670
<v Andrew>you know, and let everyone see all that.

00:19:05.730 --> 00:19:09.170
<v Andrew>And I'm sure there are paths to that. It just doesn't, it's not very easy.

00:19:09.370 --> 00:19:12.170
<v Andrew>Like you said, it's very challenging. It's not as simple as like,

00:19:12.270 --> 00:19:12.950
<v Andrew>well, just make it public.

00:19:13.150 --> 00:19:16.450
<v Andrew>You know, you've got to do a lot of management to make that work.

00:19:16.590 --> 00:19:21.650
<v Andrew>And, you know, as things ebb and flow, that can be really hard to keep up with,

00:19:21.830 --> 00:19:23.350
<v Andrew>you know, responsibly and reliably.

00:19:24.190 --> 00:19:29.710
<v Matthias>Yeah. And even if you didn't open source it, and even if you just used a crate

00:19:29.710 --> 00:19:34.990
<v Matthias>across different teams, that is still a challenge. Do you have a monorepo?

00:19:35.450 --> 00:19:37.850
<v Matthias>What does the structure look like right now?

00:19:38.390 --> 00:19:44.310
<v Andrew>Yeah, so it is a monorepo. We have various repos for services and things like

00:19:44.310 --> 00:19:48.550
<v Andrew>that, but the Rust core itself and all of the client apps built on it is a monorepo,

00:19:48.790 --> 00:19:54.250
<v Andrew>which gives us some benefits from sort of a build and release avenue, right?

00:19:54.250 --> 00:19:57.270
<v Andrew>Where everything, you don't have to bring in other, you know,

00:19:57.350 --> 00:20:00.170
<v Andrew>repos and so forth to keep everything up to date. It's all in one place.

00:20:00.510 --> 00:20:04.690
<v Andrew>But like you said, that means that, you know, you know, merge conflicts can

00:20:04.690 --> 00:20:09.810
<v Andrew>be a problem and all these different things that are reliant on what you're working on.

00:20:10.270 --> 00:20:13.810
<v Andrew>And that's, that's tricky, especially from, you know, a team sitting where we

00:20:13.810 --> 00:20:16.670
<v Andrew>do kind of at the very bottom of the whole stack.

00:20:17.070 --> 00:20:20.550
<v Andrew>You know, when we make a change, there tends to be a very significant ripple

00:20:20.550 --> 00:20:24.830
<v Andrew>effect that, you know, and you get into challenges like, how do we manage that, right?

00:20:24.910 --> 00:20:26.950
<v Andrew>Does our team, you know, if you have code that depends on that,

00:20:27.130 --> 00:20:30.010
<v Andrew>do we just tell you, hey, we're going to break this and you need to be ready

00:20:30.010 --> 00:20:32.850
<v Andrew>to work with us to do the new thing or do we fix it for you,

00:20:33.270 --> 00:20:39.170
<v Andrew>you know, and so forth. And there can be a lot of communication that needs to occur as you grow.

00:20:39.390 --> 00:20:43.990
<v Andrew>And, you know, you talk about like the mythical man month, you know, concept, right?

00:20:44.110 --> 00:20:45.890
<v Andrew>Of like throwing two more people

00:20:45.890 --> 00:20:48.970
<v Andrew>onto a project does not give you two more people's worth of time, right?

00:20:49.150 --> 00:20:53.290
<v Andrew>You have extra communication. There's all these new channels that have been

00:20:53.290 --> 00:20:56.410
<v Andrew>created between those people and the other people and so forth.

00:20:56.450 --> 00:20:58.350
<v Andrew>And it will test your processes and

00:20:58.350 --> 00:21:02.110
<v Andrew>your org structure and your code architecture, you know, at every turn.

00:21:02.250 --> 00:21:06.350
<v Andrew>And so when you get to hundreds of developers working on sometimes completely

00:21:06.350 --> 00:21:10.110
<v Andrew>different, you know, things, right? They're not even password management concepts.

00:21:10.290 --> 00:21:14.990
<v Andrew>They are, you know, they may be related to secrets, right? Like the SSH agent that 1Password has.

00:21:15.130 --> 00:21:18.670
<v Andrew>Well, that's related to some amount of secret, but it is not at all related,

00:21:18.930 --> 00:21:22.270
<v Andrew>you know, to profiles or settings in the password manager or things like that.

00:21:22.270 --> 00:21:27.090
<v Andrew>So you can get into challenging situations where you're trying to coordinate

00:21:27.090 --> 00:21:32.170
<v Andrew>underlying frameworks across completely different feature teams and,

00:21:32.960 --> 00:21:36.480
<v Andrew>Yeah, that's problematic at times, and it definitely can slow things down,

00:21:36.600 --> 00:21:39.400
<v Andrew>but it also becomes a strength when you're learning from things.

00:21:40.180 --> 00:21:43.440
<v Matthias>Let's talk scale, because people like numbers.

00:21:43.820 --> 00:21:51.400
<v Matthias>Can you share some of the, let's say, I would say more interesting numbers about

00:21:51.400 --> 00:21:56.960
<v Matthias>the code size and the number of people working with Rust and crates maintained and so on?

00:21:57.480 --> 00:22:02.960
<v Andrew>Yeah, so we are, I think I just looked the other day and we were at like five

00:22:02.960 --> 00:22:08.560
<v Andrew>or 600,000 lines of rust in the core across like 600-ish crates.

00:22:08.780 --> 00:22:12.680
<v Andrew>I think we're just shy of 600 crates internal plus dependencies.

00:22:13.660 --> 00:22:18.880
<v Andrew>So it's a pretty big code base, right? And like I said, that core makes up as

00:22:18.880 --> 00:22:22.220
<v Andrew>much of the business logic as we can get it to.

00:22:22.540 --> 00:22:26.840
<v Andrew>So I don't know the exact spread of all of it because, you know,

00:22:26.900 --> 00:22:30.320
<v Andrew>when you're implementing a feature, you have to also implement it in the native clients, right?

00:22:30.580 --> 00:22:34.220
<v Andrew>So some amount, you know, every feature is going to have some Swift and some

00:22:34.220 --> 00:22:36.440
<v Andrew>Kotlin and TypeScript and all these different things.

00:22:36.860 --> 00:22:39.400
<v Andrew>So I would say, you know, and then you've got server-side stuff,

00:22:39.500 --> 00:22:44.260
<v Andrew>which not all of our server-side stuff is in Rust. There's a lot of Go on the server side.

00:22:44.400 --> 00:22:48.240
<v Andrew>So I would say probably 50% of everything new that we write is in Rust,

00:22:48.400 --> 00:22:51.580
<v Andrew>but it's definitely spread across all those other things.

00:22:51.760 --> 00:22:55.820
<v Andrew>You know, writing an end-to-end feature will involve Go and Rust.

00:22:56.080 --> 00:23:00.380
<v Andrew>And Swift and Kotlin and TypeScript and possibly go on the CLI side and so forth.

00:23:00.540 --> 00:23:05.140
<v Andrew>So there's quite a bit that goes into that. But there's probably,

00:23:05.320 --> 00:23:08.660
<v Andrew>I think we have a couple hundred developers now working across all the different

00:23:08.660 --> 00:23:13.360
<v Andrew>products that 1Password and Collide and Passage and Trelica and so forth have.

00:23:13.680 --> 00:23:18.380
<v Andrew>But we probably have, I don't know, I'd say 100 people that work pretty heavily

00:23:18.380 --> 00:23:24.160
<v Andrew>in Rust or maybe 50% or more in Rust, something like that. But that's definitely a bit of a guess.

00:23:25.940 --> 00:23:32.540
<v Matthias>Awesome which ffi bridge works the least well for you right now like what gives

00:23:32.540 --> 00:23:34.440
<v Matthias>you the most headaches at the moment.

00:23:34.440 --> 00:23:42.240
<v Andrew>It depends i think as far as the actual ffi goes the most challenging ones are

00:23:42.240 --> 00:23:46.800
<v Andrew>probably well i guess android can be a little bit tricky sometimes,

00:23:47.860 --> 00:23:50.800
<v Andrew>you know, especially just Android, the ecosystem's a little bit different.

00:23:50.980 --> 00:23:54.160
<v Andrew>You know, we were built originally as a macOS app. And so I think there's still

00:23:54.160 --> 00:23:58.200
<v Andrew>a little bit of that sort of, you know, Apple product DNA built in,

00:23:58.380 --> 00:24:01.980
<v Andrew>which, you know, we've tried to spread to all these different platforms and

00:24:01.980 --> 00:24:05.680
<v Andrew>make everything work equally well. But I'm sure there's still a little bit of that in there.

00:24:05.860 --> 00:24:09.080
<v Andrew>And then the Wasm boundaries can be tough.

00:24:09.300 --> 00:24:11.860
<v Andrew>I didn't know anything about Wasm until about a year ago, right?

00:24:11.900 --> 00:24:15.180
<v Andrew>I don't think I'd ever really touched it at all. I'd heard of it and knew nothing about it.

00:24:15.340 --> 00:24:19.040
<v Andrew>And then you find out little things like, I think there's like no built-in clock

00:24:19.040 --> 00:24:20.580
<v Andrew>in Wasm or something like that.

00:24:20.580 --> 00:24:24.340
<v Andrew>So you're like faking all these time-based things that you used to do.

00:24:24.560 --> 00:24:30.320
<v Andrew>And so that can be a little bit tough when you have concepts baked into how

00:24:30.320 --> 00:24:34.340
<v Andrew>the native clients communicate across the FFI that just don't work in Wasm.

00:24:34.420 --> 00:24:37.180
<v Andrew>And we end up with a lot of abstractions.

00:24:37.300 --> 00:24:39.500
<v Andrew>Like we have, you know, there's send and sync traits in Rust,

00:24:39.600 --> 00:24:43.060
<v Andrew>but we have a maybe send and maybe sync trait that handles, you know,

00:24:43.120 --> 00:24:46.340
<v Andrew>four people translating between, oh, is this going to be single threaded or

00:24:46.340 --> 00:24:47.720
<v Andrew>multi-threaded and so forth?

00:24:47.860 --> 00:24:51.520
<v Andrew>And so the WASM boundaries are probably the toughest, to be honest.

00:24:52.520 --> 00:24:57.400
<v Matthias>Okay. Yeah. The maybe send and maybe sync sounds interesting.

00:24:58.560 --> 00:25:01.840
<v Matthias>Wouldn't that be a question mark send and question mark sync?

00:25:02.280 --> 00:25:07.300
<v Andrew>I think it could be. Yeah, I think what we have, so the way we've broken this

00:25:07.300 --> 00:25:11.380
<v Andrew>out, right, is because we want, you know, code to be reusable across platforms, right?

00:25:11.700 --> 00:25:15.460
<v Andrew>But it may not necessarily work quite the same. Let's say for pass keys,

00:25:15.700 --> 00:25:19.600
<v Andrew>you know, or autofill, like, that happens completely differently on iOS than

00:25:19.600 --> 00:25:23.280
<v Andrew>it does on Android than it does on, you know, Windows or wherever.

00:25:23.440 --> 00:25:24.960
<v Andrew>And so there's all these different implementations.

00:25:25.420 --> 00:25:29.820
<v Andrew>But you want to do the same process. It's just that all the underlying calls,

00:25:30.040 --> 00:25:33.240
<v Andrew>you know, there may be syscalls or things like that, we reaching back out in

00:25:33.240 --> 00:25:34.320
<v Andrew>the OS, they work different.

00:25:34.500 --> 00:25:37.480
<v Andrew>Or, you know, some of them, you have to do it in the moment,

00:25:37.640 --> 00:25:41.060
<v Andrew>some of them, you have to seed some operation at unlock, you know, or whatever.

00:25:41.220 --> 00:25:45.820
<v Andrew>And so what we try to do is we have these, you know, we have FFIs by platform.

00:25:46.120 --> 00:25:51.580
<v Andrew>And then we have like an app level, where you could have multiple platforms

00:25:51.580 --> 00:25:54.200
<v Andrew>that use the same app level crate.

00:25:54.460 --> 00:25:58.060
<v Andrew>But then what that does, that reaches out to services. And the service level

00:25:58.060 --> 00:26:01.220
<v Andrew>is where all of your actual functionality comes in.

00:26:01.300 --> 00:26:04.840
<v Andrew>For example, sync, there is a service that handles sync, and there's,

00:26:04.900 --> 00:26:06.980
<v Andrew>you know, a different service that handles autofill and so forth.

00:26:07.340 --> 00:26:10.520
<v Andrew>And then those reach out into underlying implementations of things.

00:26:10.720 --> 00:26:14.800
<v Andrew>And so what we do is we try and make a trait that is like, okay,

00:26:14.900 --> 00:26:18.620
<v Andrew>here is, you know, let's say, I don't know, pass keys or something like that.

00:26:19.160 --> 00:26:21.560
<v Andrew>And then underneath that, it's like, all right, get the pass keys.

00:26:22.040 --> 00:26:25.400
<v Andrew>But then below that, it's like, well, what do we need to get?

00:26:25.480 --> 00:26:26.400
<v Andrew>Which data are we getting?

00:26:26.840 --> 00:26:29.660
<v Andrew>When are we getting this? You know, how is it being provided?

00:26:29.840 --> 00:26:32.980
<v Andrew>Do we need to get anything from, you know, the enclave or the operating system

00:26:32.980 --> 00:26:36.600
<v Andrew>or whatever it is? and those get implemented by platform.

00:26:36.880 --> 00:26:41.820
<v Andrew>And that gives us a little bit of flexibility into how we.

00:26:42.600 --> 00:26:47.620
<v Andrew>Build up things. But what that means is, if I'm doing something that is generally,

00:26:47.920 --> 00:26:50.140
<v Andrew>you know, we have built this and have used it, you know, let's say four or five

00:26:50.140 --> 00:26:52.340
<v Andrew>years now, completely async, right?

00:26:52.420 --> 00:26:55.460
<v Andrew>And we've been using, you know, we've spent up a ton of threads to do this thing

00:26:55.460 --> 00:26:58.820
<v Andrew>or whatever, or it's got to be on a background task or something like that.

00:26:59.100 --> 00:27:00.820
<v Andrew>Well, now maybe that doesn't work in wasm.

00:27:01.120 --> 00:27:04.380
<v Andrew>And so I think maybe send and maybe sync have been our easy,

00:27:04.940 --> 00:27:08.620
<v Andrew>traits to kind of layer in to be like, all right, put this on there to make sure,

00:27:08.620 --> 00:27:11.380
<v Andrew>you know we can sort of keep these things

00:27:11.380 --> 00:27:14.360
<v Andrew>moving forward and then that becomes a big challenge throughout

00:27:14.360 --> 00:27:17.380
<v Andrew>everything right when you've got you know 500 000 lines of

00:27:17.380 --> 00:27:20.160
<v Andrew>rust and now you're trying to build in

00:27:20.160 --> 00:27:23.080
<v Andrew>wasm that's a lot different than we're starting from scratch and

00:27:23.080 --> 00:27:26.420
<v Andrew>building in wasm support right we could have done things probably a

00:27:26.420 --> 00:27:29.500
<v Andrew>lot differently but there are hundreds of features across

00:27:29.500 --> 00:27:32.380
<v Andrew>you know a dozen products or whatever that are

00:27:32.380 --> 00:27:37.420
<v Andrew>trying to use this stuff and going back and refactoring them maybe just doesn't

00:27:37.420 --> 00:27:41.300
<v Andrew>doesn't add up right now and we don't have time for that and so there are probably

00:27:41.300 --> 00:27:46.180
<v Andrew>other ways we could use those x or whatever they call them to to better better

00:27:46.180 --> 00:27:50.440
<v Andrew>use i think these are probably our temporary temporary solutions but.

00:27:50.440 --> 00:27:56.540
<v Matthias>I fully get it because at some point you also need to ship things and this seems

00:27:56.540 --> 00:28:01.980
<v Matthias>like an escape hatch that kind of was a pragmatic approach to solving this problem.

00:28:02.380 --> 00:28:07.640
<v Matthias>What a lot of people forget is that these are apps that eventually need releases

00:28:07.640 --> 00:28:12.760
<v Matthias>to change or if they have breaking changes, then it's not that easy because

00:28:12.760 --> 00:28:15.100
<v Matthias>they might be used in other parts of the application.

00:28:15.540 --> 00:28:17.960
<v Matthias>So the other thing I wondered was,

00:28:18.660 --> 00:28:23.260
<v Matthias>Is there a guideline for keeping the core synchronous Rust?

00:28:23.820 --> 00:28:30.300
<v Matthias>How deep does the async part go? And at what point do you stop using async?

00:28:30.440 --> 00:28:34.940
<v Matthias>And do you start having your own little, say, domain, which is sync?

00:28:35.120 --> 00:28:38.900
<v Matthias>Is there such a differentiation? Or would you say that doesn't make any sense

00:28:38.900 --> 00:28:41.040
<v Matthias>at your scale or for the project you do?

00:28:41.420 --> 00:28:44.860
<v Andrew>You know, it might make sense in some places. I don't know that we really do

00:28:44.860 --> 00:28:49.040
<v Andrew>it much, though. It's definitely pretty async down to the root of things.

00:28:49.220 --> 00:28:54.280
<v Andrew>I mean, the way our requests from the client into the core work is,

00:28:54.380 --> 00:28:58.840
<v Andrew>you know, you make this request over the FFI, which is sort of inherently async, right?

00:28:58.920 --> 00:29:02.940
<v Andrew>Because that's not an API where you're waiting, you know, it's not baked into

00:29:02.940 --> 00:29:06.240
<v Andrew>like the HTTP protocol where you're going to get a response and blah, blah, blah.

00:29:06.540 --> 00:29:12.500
<v Andrew>So you sort of send this request into the core of the FFI. And then what the

00:29:12.500 --> 00:29:18.800
<v Andrew>core does is that FFI holds on to a sender and it hands off that request to

00:29:18.800 --> 00:29:21.220
<v Andrew>a thread that is watching the receiver.

00:29:21.420 --> 00:29:26.460
<v Andrew>And that dispatches invocations, you know, these requests that do the work and

00:29:26.460 --> 00:29:29.360
<v Andrew>handle the type process and blah, blah, blah, and then come back.

00:29:29.360 --> 00:29:35.120
<v Andrew>And we, you know, the way that we handle that is the front end sends in a callback

00:29:35.120 --> 00:29:38.220
<v Andrew>that once the request is done processing,

00:29:38.220 --> 00:29:43.260
<v Andrew>that invocation dispatch loop executes the callback with the resulting data

00:29:43.260 --> 00:29:45.100
<v Andrew>as an input to that callback.

00:29:45.760 --> 00:29:50.580
<v Andrew>So that way, the client side handles sort of a registry of here are all the

00:29:50.580 --> 00:29:53.260
<v Andrew>requests that I have made and sort of an identifier.

00:29:53.260 --> 00:29:58.040
<v Andrew>So when that callback gets executed, I can put it into my local cache or store

00:29:58.040 --> 00:30:01.080
<v Andrew>or plug it into this React component or whatever it might be.

00:30:01.420 --> 00:30:04.540
<v Andrew>But the whole process is sort of inherently async.

00:30:04.720 --> 00:30:09.900
<v Andrew>It is baked into everything from client side all the way down to the database and back.

00:30:09.900 --> 00:30:13.340
<v Andrew>So I'm sure there are some things where it's like, hey, we need to do multiple

00:30:13.340 --> 00:30:17.020
<v Andrew>things and they need to be synchronous in order, but they're a bit of like a

00:30:17.020 --> 00:30:20.980
<v Andrew>bubble that's still within an async, you know, flow end to end.

00:30:21.920 --> 00:30:28.080
<v Matthias>The callback mechanism that you describe sounds a lot like the Waker in Tokio,

00:30:28.080 --> 00:30:34.420
<v Matthias>but just on a higher level, I would assume, like on a data level somehow.

00:30:35.160 --> 00:30:39.000
<v Andrew>Exactly. Yeah, it is kind of like that where the we are.

00:30:39.460 --> 00:30:42.920
<v Andrew>It is sort of, yeah, I guess it's like building in our own hand rolled waker

00:30:42.920 --> 00:30:50.320
<v Andrew>in some way of like the the client technically sends off this request and it's done in theory.

00:30:50.480 --> 00:30:56.060
<v Andrew>Right. Or technologically it is done. But it has set up this function,

00:30:56.060 --> 00:31:00.520
<v Andrew>you know, that is somewhere in memory, and it has handed us off where this thing is.

00:31:00.660 --> 00:31:05.160
<v Andrew>So then when we go call that code with this data, it is now kicking off a new

00:31:05.160 --> 00:31:09.540
<v Andrew>thing. It just so happens that we have in code tied those two pieces together.

00:31:09.960 --> 00:31:14.960
<v Andrew>Right? So it's sort of like the mechanism of a waker, except that we're not

00:31:14.960 --> 00:31:18.000
<v Andrew>actually, you know, pulling it or anything like that.

00:31:18.180 --> 00:31:21.640
<v Andrew>It is inherently async to when that thing gets called back.

00:31:21.640 --> 00:31:25.780
<v Matthias>Did you have to use any unsafe code to pull it off?

00:31:26.580 --> 00:31:33.440
<v Andrew>I'm sure in the FFI there's some, you know, just the nature of, you know, how FFI works.

00:31:33.560 --> 00:31:37.920
<v Andrew>I'm sure the calls across the actual FFI are wrapped in unsafe.

00:31:39.170 --> 00:31:42.650
<v Andrew>And then I think there's probably some, you know, we talked about zeroizing alloc.

00:31:42.970 --> 00:31:48.050
<v Andrew>I'm sure there's some amount of wrapping there to ensure that bytes are flipped

00:31:48.050 --> 00:31:52.410
<v Andrew>to zeros, you know, in things that were not being handled by the Rust allocator.

00:31:52.550 --> 00:31:55.690
<v Andrew>But in general, the process is fairly safe, right?

00:31:55.710 --> 00:32:00.650
<v Andrew>You make the call over the FFI, and because that is holding this object with

00:32:00.650 --> 00:32:03.510
<v Andrew>the sender, once you send that all across, you know, that's fine.

00:32:03.590 --> 00:32:07.390
<v Andrew>Everything there can be done safely. And then executing the actual callback

00:32:07.390 --> 00:32:10.430
<v Andrew>probably technically has to be wrapped and unsafe, I would guess,

00:32:10.510 --> 00:32:14.330
<v Andrew>because you are sort of triggering just a memory location.

00:32:15.030 --> 00:32:19.990
<v Andrew>But a lot of that is based on, you know, guarantees that we can make in both sides of the equation.

00:32:20.430 --> 00:32:27.010
<v Matthias>So you mentioned 600 crates. And when I heard that number, I was, well, awestruck.

00:32:28.490 --> 00:32:34.670
<v Matthias>How do you not drown in dependency hell? How do you keep all of these crates up to date?

00:32:35.630 --> 00:32:38.890
<v Andrew>Yeah, I think you're assuming we aren't drowning in that. No,

00:32:39.050 --> 00:32:43.270
<v Andrew>it's, it's, it's not too bad. I mean, so part of it is automation, right?

00:32:43.470 --> 00:32:47.950
<v Andrew>You know, making sure that we're running things to ensure like we have dependency

00:32:47.950 --> 00:32:51.290
<v Andrew>monitoring for vulnerabilities and stuff like that to keep all that stuff up

00:32:51.290 --> 00:32:53.930
<v Andrew>to date and make sure that we're not, you know, we're not passing pipelines

00:32:53.930 --> 00:32:54.990
<v Andrew>that have vulnerable dependencies.

00:32:54.990 --> 00:32:57.430
<v Andrew>And also, if we have a dependency that has become vulnerable,

00:32:57.470 --> 00:32:59.090
<v Andrew>we're updating it quickly and so forth.

00:32:59.770 --> 00:33:04.350
<v Andrew>But beyond that, it can be tricky, you know, to manage all those dependencies.

00:33:04.730 --> 00:33:08.310
<v Andrew>A lot of it just comes with the architecture of like, let's make sure,

00:33:08.850 --> 00:33:11.630
<v Andrew>you know, we have directories, right? So we have, let's say, a data directory.

00:33:12.090 --> 00:33:17.350
<v Andrew>And this data directory, you know, okay, you are allowed to import anything

00:33:17.350 --> 00:33:21.730
<v Andrew>else that's in the data directory or any, you know, third party dependency that's safe.

00:33:21.890 --> 00:33:25.150
<v Andrew>But you can't import anything from services or apps or so forth,

00:33:25.230 --> 00:33:29.310
<v Andrew>right? And we create a bit of a inherent hierarchy to these things.

00:33:29.350 --> 00:33:34.330
<v Andrew>And so a lot of it is just making sure that we have clearly defined like app crates and.

00:33:34.900 --> 00:33:40.260
<v Andrew>Cannot, or app grates can really import anything that they want, except the FFI.

00:33:40.540 --> 00:33:44.560
<v Andrew>And app grates should only be imported by the FFI. No one else should ever import

00:33:44.560 --> 00:33:47.840
<v Andrew>an app grate. So there's our first, you know, level. And then we go to services.

00:33:48.060 --> 00:33:52.080
<v Andrew>It's like, all right, services can be imported by each other or app grates, but nobody else.

00:33:52.380 --> 00:33:55.600
<v Andrew>And now, you know, data can do this, right? And you create a little bit of these

00:33:55.600 --> 00:33:59.320
<v Andrew>rules, and then you end up with a ton of things that fall outside of,

00:33:59.820 --> 00:34:03.020
<v Andrew>you know they may be crates that define types or

00:34:03.020 --> 00:34:05.900
<v Andrew>a server client or all these different things and that's

00:34:05.900 --> 00:34:08.540
<v Andrew>where you get into the difficult parts of like well if we have

00:34:08.540 --> 00:34:11.500
<v Andrew>a server client who's allowed to use that you know

00:34:11.500 --> 00:34:14.540
<v Andrew>can anyone call that from anywhere or should

00:34:14.540 --> 00:34:17.420
<v Andrew>that ever talk to the data you know crates or

00:34:17.420 --> 00:34:20.420
<v Andrew>should we keep those separate inherently what about types what

00:34:20.420 --> 00:34:23.300
<v Andrew>if we have a type that is this way on the server and it is also that

00:34:23.300 --> 00:34:26.240
<v Andrew>way in the database well do we want to duplicate that to let those

00:34:26.240 --> 00:34:29.340
<v Andrew>like to let drift be okay so that way we're not you know

00:34:29.340 --> 00:34:32.740
<v Andrew>modifying both all the time or one all the time so you

00:34:32.740 --> 00:34:37.500
<v Andrew>definitely get into challenges that that come with having that many crates and

00:34:37.500 --> 00:34:41.580
<v Andrew>there's probably more automation that wants to happen but there's definitely

00:34:41.580 --> 00:34:45.160
<v Andrew>you know the short answer i guess is there is a lot of human process that comes

00:34:45.160 --> 00:34:49.080
<v Andrew>into you know we have different teams that own different concepts they don't

00:34:49.080 --> 00:34:51.520
<v Andrew>own necessarily specific bits of code.

00:34:51.680 --> 00:34:54.260
<v Andrew>They may, but in general, they own concepts.

00:34:54.700 --> 00:34:58.680
<v Andrew>And because you're owning that concept, we have automation, you know,

00:34:58.720 --> 00:35:01.240
<v Andrew>that we'll say, okay, these bits of code definitely touch that concept.

00:35:01.640 --> 00:35:05.140
<v Andrew>Or just a lot of people going, okay, this should probably be reviewed by such

00:35:05.140 --> 00:35:06.380
<v Andrew>and such team or so forth.

00:35:06.660 --> 00:35:10.740
<v Andrew>And just making sure that we keep everything as clean as possible.

00:35:11.000 --> 00:35:13.860
<v Andrew>And that we are, when we do code review, we're looking at it to go,

00:35:13.960 --> 00:35:15.700
<v Andrew>does this order of imports make sense?

00:35:16.140 --> 00:35:19.700
<v Andrew>You know, and we'll have things with like, oh, they implemented this on some

00:35:19.700 --> 00:35:21.900
<v Andrew>model, but it doesn't need to be there.

00:35:22.040 --> 00:35:24.960
<v Andrew>It was only being consumed in one place. So let's just inline all of that.

00:35:25.060 --> 00:35:27.840
<v Andrew>Let's get rid of that crate, you know, that whole model concept.

00:35:28.000 --> 00:35:29.640
<v Andrew>Let's just inline it right where it was.

00:35:30.040 --> 00:35:32.580
<v Andrew>And then we may find out in the future, oh, well, now somewhere else wants to

00:35:32.580 --> 00:35:35.060
<v Andrew>use it. Okay, let's pull it back out and put it back into the model and we'll

00:35:35.060 --> 00:35:37.200
<v Andrew>do that, you know, and that's okay.

00:35:37.380 --> 00:35:41.120
<v Andrew>You know, we want to avoid the like, well, we might need it in the future because

00:35:41.120 --> 00:35:42.860
<v Andrew>that's when crates really become a problem.

00:35:43.120 --> 00:35:46.080
<v Andrew>You know, we put it in this new crate because we might need it somewhere else.

00:35:46.080 --> 00:35:49.320
<v Andrew>Let's not do that let's just enlighten till we know we need it somewhere else

00:35:49.320 --> 00:35:52.920
<v Andrew>and then we'll deal with pouring out and that's really the only way that you

00:35:52.920 --> 00:35:58.840
<v Andrew>know you kind of bake in avoidance of crates just proliferating everywhere it.

00:35:58.840 --> 00:36:05.460
<v Matthias>Sounds like you're treating crates like cattle i wonder how much the rust ecosystem

00:36:05.460 --> 00:36:10.700
<v Matthias>helps with that and how much of that is still manual because there are tools

00:36:10.700 --> 00:36:12.300
<v Matthias>like cargo deny for example or,

00:36:12.960 --> 00:36:16.220
<v Matthias>I don't know. Do you have any tools that you like outside of,

00:36:16.400 --> 00:36:18.440
<v Matthias>say, Clippy that you prefer?

00:36:19.040 --> 00:36:22.440
<v Andrew>Yeah, a lot of Clippy here. Definitely Cargo Deny as well.

00:36:22.780 --> 00:36:27.560
<v Andrew>Make sure that, again, that if it's an FFI crate, you should only be importing

00:36:27.560 --> 00:36:30.900
<v Andrew>certain things, or if it's an app, you shouldn't be importing certain things or so forth.

00:36:32.220 --> 00:36:35.140
<v Andrew>Again, it probably wants more automation than we have.

00:36:35.540 --> 00:36:40.180
<v Andrew>A lot of it is just the code architecture, right? If we make sure that the data

00:36:40.180 --> 00:36:45.380
<v Andrew>layer is self-contained, and then we make sure FFI to app to service is a self-contained

00:36:45.380 --> 00:36:49.520
<v Andrew>flow, well, everything else then becomes domain-specific, right?

00:36:49.540 --> 00:36:53.960
<v Andrew>We're not creating global things beyond that, wherever we can avoid it at least.

00:36:54.320 --> 00:36:58.540
<v Andrew>So that way, if your team, let's say, works on autofill, you get to use the

00:36:58.540 --> 00:37:02.460
<v Andrew>data layer in prescribed ways, and then you import all your stuff into a service

00:37:02.460 --> 00:37:04.180
<v Andrew>which goes into an app which goes into the FFI.

00:37:04.660 --> 00:37:08.620
<v Andrew>Anything in between there, that's up to you. You know, if you create a circular

00:37:08.620 --> 00:37:10.220
<v Andrew>dependency or whatever, that's your problem.

00:37:10.340 --> 00:37:14.060
<v Andrew>Or if you create a bad architecture between these things, well,

00:37:14.140 --> 00:37:16.160
<v Andrew>you have to own that, right? You've got to maintain that.

00:37:16.240 --> 00:37:20.280
<v Andrew>So you're going to find the problems with that and generally fix it yourself.

00:37:20.460 --> 00:37:25.260
<v Andrew>And so a lot of it is just bad architecture of like, keep the top layer contained,

00:37:25.480 --> 00:37:26.620
<v Andrew>keep the bottom layer contained.

00:37:26.760 --> 00:37:29.860
<v Andrew>And then everything in the middle is feature specific or domain specific.

00:37:30.020 --> 00:37:33.300
<v Andrew>So that way, those bounded domains are dealing with themselves.

00:37:33.300 --> 00:37:37.900
<v Andrew>And there's a couple other things that have this, like we have a foundation

00:37:37.900 --> 00:37:41.760
<v Andrew>directory, which deals with OS-specific calls.

00:37:42.240 --> 00:37:44.660
<v Andrew>You know, anything that's Windows-specific has its own area and so forth.

00:37:44.900 --> 00:37:47.000
<v Andrew>So there are a few other things we do like that, where it's like,

00:37:47.060 --> 00:37:51.380
<v Andrew>okay, that is maintained by this platform advancement team.

00:37:51.940 --> 00:37:55.000
<v Andrew>And if you need changes there, you work with them to make those changes.

00:37:55.000 --> 00:37:59.420
<v Andrew>But you are just consuming those things. And any, you know, interweaving of

00:37:59.420 --> 00:38:04.800
<v Andrew>crates that you do within your bounded domain needs to happen within the box you were provided.

00:38:05.460 --> 00:38:08.980
<v Andrew>But it definitely does rely on a little bit of that automation,

00:38:09.000 --> 00:38:12.920
<v Andrew>like you said, of like cargo deny and clippy and so forth, to ensure that we

00:38:12.920 --> 00:38:18.700
<v Andrew>are cleaning that up where we can, but it's definitely a manual process a lot of times.

00:38:19.380 --> 00:38:26.980
<v Matthias>I'm not sure if it's true, but I heard that 1Password uses Nix for their development environment.

00:38:27.780 --> 00:38:29.780
<v Matthias>Can you say a few words about that?

00:38:30.360 --> 00:38:33.720
<v Andrew>Yeah, so we definitely have a lot of Nix usage.

00:38:33.920 --> 00:38:40.100
<v Andrew>So it powers our, on the core side at least, it powers a lot of our build processes and stuff like that.

00:38:40.260 --> 00:38:45.020
<v Andrew>And then we use it to manage our tool chains on the core side as well.

00:38:45.780 --> 00:38:51.100
<v Andrew>And that has been really, really nice because there is so much,

00:38:51.100 --> 00:38:55.380
<v Andrew>you know, tool chain stuff that you need when you're working across all these platforms.

00:38:55.880 --> 00:38:59.980
<v Andrew>You know, you might need all of these Linux-specific tools and you need these

00:38:59.980 --> 00:39:04.060
<v Andrew>Mac-specific tools and all these things that make Android Studio work and there's

00:39:04.060 --> 00:39:08.620
<v Andrew>all these different things that come together as well as, you know, internal tools, right?

00:39:08.640 --> 00:39:12.560
<v Andrew>We have the 1Password CLI, which we use for things and the TypeShare tool,

00:39:12.680 --> 00:39:16.380
<v Andrew>which is a CLI tool that is used for things And so whenever we make updates

00:39:16.380 --> 00:39:20.220
<v Andrew>to TypeShare, that needs to become part of developers' toolchains.

00:39:20.320 --> 00:39:23.620
<v Andrew>And so we use Nix to manage all of that.

00:39:23.740 --> 00:39:28.660
<v Andrew>And that way, whenever there is an update, if I pull main and that Nix flake

00:39:28.660 --> 00:39:30.980
<v Andrew>has changed on main, well, my toolchain just gets updated.

00:39:31.100 --> 00:39:33.020
<v Andrew>I don't know the difference. So, you know, I have to wait a few seconds for

00:39:33.020 --> 00:39:36.940
<v Andrew>it to pull everything in, build the tool chain. But from that point, I don't care.

00:39:37.100 --> 00:39:42.900
<v Andrew>And there's the direnv tool, which basically sets up that directory to automatically

00:39:42.900 --> 00:39:46.540
<v Andrew>use the Nix Flake as your tool chain for that directory. So I don't have to

00:39:46.540 --> 00:39:47.740
<v Andrew>worry about version management.

00:39:48.060 --> 00:39:52.200
<v Andrew>I don't have to worry about, you know, did I run the install script too long

00:39:52.200 --> 00:39:54.180
<v Andrew>ago and somebody added something to it since then?

00:39:54.300 --> 00:39:56.580
<v Andrew>That's not my problem. Nix just handles all of that.

00:39:57.220 --> 00:40:00.900
<v Andrew>And it's been really amazing. I mean, there's a bit of knowledge,

00:40:01.160 --> 00:40:05.280
<v Andrew>Nix-specific knowledge, flakes in the language and all these different things

00:40:05.280 --> 00:40:06.660
<v Andrew>can require a little bit of.

00:40:07.200 --> 00:40:09.960
<v Andrew>A little bit of playing with to really understand what's happening,

00:40:10.280 --> 00:40:12.760
<v Andrew>but it's been really powerful and it's helped.

00:40:12.900 --> 00:40:15.760
<v Andrew>We have a concept here, which I know some other companies have as well.

00:40:15.940 --> 00:40:23.180
<v Andrew>We call them guilds of like cross team interest in a topic. So like there is a Rust guild, right?

00:40:23.520 --> 00:40:26.680
<v Andrew>And we have all the developers on different teams. Like my team has,

00:40:26.800 --> 00:40:29.420
<v Andrew>let's say four Rust developers and then some other developers.

00:40:29.560 --> 00:40:32.840
<v Andrew>But then the autofill team has a couple of Rust developers and this team and so forth.

00:40:32.920 --> 00:40:37.880
<v Andrew>And we don't maybe collaborate all that directly, but now in the Rust guild, we can just talk Rust.

00:40:38.100 --> 00:40:40.140
<v Andrew>We don't worry about, you know, interactions with other things.

00:40:40.240 --> 00:40:42.460
<v Andrew>We just talk about how do we want to write Rust?

00:40:42.680 --> 00:40:46.900
<v Andrew>Here's an interesting article about Rust, so forth. And we have one of those for Nix as well.

00:40:47.140 --> 00:40:49.880
<v Andrew>So, you know, the build and release people are in there and some of the people

00:40:49.880 --> 00:40:54.020
<v Andrew>from my team who are all just kind of Nix fans are in there and so forth.

00:40:54.060 --> 00:40:58.200
<v Andrew>And that helps us to make sure that, you know, if someone who maybe owns the

00:40:58.200 --> 00:41:01.860
<v Andrew>tool chain is working on something, you know, like, hey, I couldn't figure out how to do this.

00:41:01.980 --> 00:41:04.240
<v Andrew>Well, now there's a bunch of other people who just work on this in their spare

00:41:04.240 --> 00:41:07.280
<v Andrew>time or, you know, have their home set up in Nix and so forth.

00:41:07.360 --> 00:41:11.240
<v Andrew>Like, oh, I've done that here. And we can, we can sort of augment the knowledge

00:41:11.240 --> 00:41:15.760
<v Andrew>on various teams and, and really help to skill people up.

00:41:15.860 --> 00:41:20.260
<v Andrew>Like the Rust Guild, we run a Rust study group that has, I think we had like

00:41:20.260 --> 00:41:23.340
<v Andrew>160 people in it or something like that the last time I looked.

00:41:23.660 --> 00:41:26.520
<v Andrew>And so it's people, you know, going through the book together and learning from

00:41:26.520 --> 00:41:30.500
<v Andrew>some of the experts that work here in Rust and then working on projects together

00:41:30.500 --> 00:41:34.420
<v Andrew>and all these different things and it helps us to really kind of like raise

00:41:34.420 --> 00:41:38.020
<v Andrew>the floor of skills in all these different domains, including them.

00:41:38.870 --> 00:41:44.990
<v Matthias>About the external dependencies, so any of the popular crates,

00:41:45.390 --> 00:41:52.450
<v Matthias>are there things that you use from the ecosystem that you kind of wanted to mention?

00:41:53.570 --> 00:41:54.870
<v Matthias>Could be anything, really.

00:41:55.510 --> 00:41:57.830
<v Andrew>Yeah, I mean, so obviously, like I said, we use Tokio a lot,

00:41:57.930 --> 00:42:00.070
<v Andrew>and we use the whole Tokio ecosystem, right?

00:42:00.130 --> 00:42:04.790
<v Andrew>We're using Tokio itself for channels and all these different things.

00:42:04.790 --> 00:42:09.210
<v Andrew>We use axum for various services and so forth.

00:42:09.650 --> 00:42:15.130
<v Andrew>Tower, you know, the tower middleware is really, really helpful because it allows us to share things.

00:42:15.450 --> 00:42:19.150
<v Andrew>You know, if we have one, again, feature that's totally independent from some

00:42:19.150 --> 00:42:21.310
<v Andrew>other feature, but if they create a middleware that handles,

00:42:21.450 --> 00:42:22.370
<v Andrew>oh, this handles authentication.

00:42:22.770 --> 00:42:25.490
<v Andrew>Great. Well, now this one can use it too because we auth the same way.

00:42:25.490 --> 00:42:28.870
<v Andrew>And so it allows a lot of sharing there.

00:42:29.410 --> 00:42:33.010
<v Andrew>Tracing is really critical. Obviously, again, having so many features and so

00:42:33.010 --> 00:42:37.930
<v Andrew>many layers using tracing gives us a lot of visibility into,

00:42:38.230 --> 00:42:40.950
<v Andrew>you know, did I make something that just slowed everything down?

00:42:41.150 --> 00:42:44.850
<v Andrew>Or where is my slowdown occurring, you know, and so forth. So that's great.

00:42:45.150 --> 00:42:49.150
<v Andrew>Serde is obviously pretty critical as well, right? We have to do a lot of serializing

00:42:49.150 --> 00:42:52.770
<v Andrew>and deserializing, you know, coming in from the server and so forth.

00:42:53.110 --> 00:42:54.170
<v Andrew>So that's really helpful.

00:42:54.690 --> 00:42:57.050
<v Andrew>And then some of our internal crates, right? Like I mentioned,

00:42:57.210 --> 00:42:59.270
<v Andrew>like TypeShare, passkey-rs, and so forth.

00:42:59.570 --> 00:43:04.410
<v Andrew>The only other ones that I know of that come up a lot are like RustQLite is

00:43:04.410 --> 00:43:07.350
<v Andrew>important for SQLite interaction. That makes things a lot easier.

00:43:07.710 --> 00:43:11.250
<v Andrew>And then testing things, right? Like MockAll is good.

00:43:11.450 --> 00:43:16.770
<v Andrew>Cool Asserts we use. We also have some developers here who have public crates

00:43:16.770 --> 00:43:18.550
<v Andrew>that we use that are nice.

00:43:18.690 --> 00:43:22.450
<v Andrew>Like one of our developers, I think, works on Neon, which handles like Node.js

00:43:22.450 --> 00:43:24.390
<v Andrew>bindings for the Electron apps.

00:43:25.150 --> 00:43:31.490
<v Andrew>Nathan West, who's here, made nom-supreme, which is a NOM helper library,

00:43:31.630 --> 00:43:33.310
<v Andrew>which is really cool. I really like NOM Supreme.

00:43:34.140 --> 00:43:38.000
<v Andrew>And so forth. And so there's, there's a lot of really cool things.

00:43:38.180 --> 00:43:43.660
<v Andrew>One of my teammates, Ivan, also has a project called Crane, which helps with Nick's projects.

00:43:43.860 --> 00:43:46.080
<v Andrew>And I don't think we actually are using Crane here. But it's funny,

00:43:46.180 --> 00:43:49.780
<v Andrew>because we'll come across open source projects, we'll talk to other teams.

00:43:50.000 --> 00:43:53.760
<v Andrew>We were talking to the team that built the Zed editor, when we were at RustConf.

00:43:53.980 --> 00:43:56.680
<v Andrew>And, you know, so we, we opened up some communication with them,

00:43:56.960 --> 00:44:00.260
<v Andrew>trying to, you know, help kind of beta test some stuff that they were working on.

00:44:00.440 --> 00:44:03.600
<v Andrew>And they were using Crane to build Zed. And so I was like, oh,

00:44:03.640 --> 00:44:06.340
<v Andrew>that's funny. That's something that one of the people here made.

00:44:06.520 --> 00:44:09.200
<v Andrew>So it's kind of neat seeing the ecosystem come together.

00:44:09.800 --> 00:44:13.180
<v Matthias>Yeah, totally. That's always surprising.

00:44:13.320 --> 00:44:17.940
<v Matthias>The code sharing that happens between different companies using Rust,

00:44:18.020 --> 00:44:19.120
<v Matthias>that's always very surprising.

00:44:19.280 --> 00:44:22.340
<v Matthias>And by the way, if someone wants to listen to the episode with Zed,

00:44:22.700 --> 00:44:24.560
<v Matthias>it's been a couple episodes before.

00:44:24.880 --> 00:44:28.360
<v Matthias>These guys are doing amazing work. we can't

00:44:28.360 --> 00:44:32.320
<v Matthias>talk about all of the crates but one thing specifically

00:44:32.320 --> 00:44:38.800
<v Matthias>that i wanted to ask you about was the tracing ecosystem of crates specifically

00:44:38.800 --> 00:44:44.400
<v Matthias>if you use tracing in combination with the log crate or if you use tracing for

00:44:44.400 --> 00:44:50.100
<v Matthias>tracing plus logging which is a very popular usage of that crate.

00:44:50.100 --> 00:44:55.360
<v Andrew>Yeah so that is actually something i think that is coming about now i mean we've

00:44:55.360 --> 00:45:00.380
<v Andrew>used tracing primarily for tracing, right, for sort of internal performance telemetry.

00:45:00.920 --> 00:45:04.220
<v Andrew>A lot, and we have a lot going on there. But one of the other things now is

00:45:04.220 --> 00:45:08.700
<v Andrew>especially, you know, in our cloud infrastructure, trying to make sure that,

00:45:08.740 --> 00:45:12.540
<v Andrew>you know, we have crates in, or crates, we have services in various languages,

00:45:12.540 --> 00:45:15.660
<v Andrew>especially now, you know, that all these other companies are coming into the fray.

00:45:15.800 --> 00:45:19.600
<v Andrew>There's, you know, Ruby and, you know, .NET, I think, and all these other things.

00:45:19.940 --> 00:45:24.540
<v Andrew>And so we want to make sure that our observability is not hindered by that.

00:45:24.740 --> 00:45:29.380
<v Andrew>So we have some, you know, intermediate things that are handling,

00:45:29.600 --> 00:45:33.020
<v Andrew>let's say logging output and making sure that it is normalized so that we can

00:45:33.020 --> 00:45:38.360
<v Andrew>handle observing, you know, cross service, you know, the whole ecosystem, right?

00:45:38.540 --> 00:45:42.700
<v Andrew>And so that's something that I think we're actually doing now is using tracing,

00:45:42.980 --> 00:45:46.900
<v Andrew>tracing subscriber to make sure that our log output is, you know,

00:45:46.980 --> 00:45:52.440
<v Andrew>meets the standard essentially so that any given Rust app can output their logs

00:45:52.440 --> 00:45:56.080
<v Andrew>in the right format and make sure that they're consumable by these other services.

00:45:56.860 --> 00:46:02.240
<v Matthias>Are there any things that you specifically like about tracing or you dislike

00:46:02.240 --> 00:46:03.480
<v Matthias>about tracing right now?

00:46:04.360 --> 00:46:07.380
<v Andrew>I don't know. I didn't work on the implementation of it too much,

00:46:07.480 --> 00:46:09.980
<v Andrew>so I would say I don't have a lot that I dislike about it.

00:46:10.060 --> 00:46:14.500
<v Andrew>It's really nice to be able to just jump on, to have some function and go,

00:46:14.620 --> 00:46:17.640
<v Andrew>I'll just add the tracing macro to this, right?

00:46:17.640 --> 00:46:21.440
<v Andrew>And now I'm getting data about this, you know, and I can instrument these things

00:46:21.440 --> 00:46:25.040
<v Andrew>very quickly and easily and it adds in there and I'm seeing,

00:46:25.240 --> 00:46:26.640
<v Andrew>you know, everything that I want.

00:46:27.260 --> 00:46:31.460
<v Andrew>It's been a huge help to be able to go. You know, one of the things we were looking at was like,

00:46:32.160 --> 00:46:38.100
<v Andrew>when we do these invocations, right, they are sort of inherently async,

00:46:38.260 --> 00:46:43.320
<v Andrew>but you may have invocations that are performance heavy, right?

00:46:43.420 --> 00:46:46.740
<v Andrew>Something that has to like, you know, let's say iterate through a giant list,

00:46:46.740 --> 00:46:48.420
<v Andrew>and it just has to happen that way.

00:46:48.560 --> 00:46:51.520
<v Andrew>So we have a blocking thread pool, you know, Tokio gives you,

00:46:51.620 --> 00:46:54.100
<v Andrew>you can do a blocking task right on this blocking thread pool.

00:46:54.800 --> 00:46:58.480
<v Andrew>But you also have async tasks and async tasks tend to be more,

00:46:58.700 --> 00:47:00.500
<v Andrew>you know, cooperative in a lot of cases.

00:47:00.940 --> 00:47:03.420
<v Andrew>And so we got down to the point where it was like, you know,

00:47:03.480 --> 00:47:04.880
<v Andrew>we have hundreds of these invocations.

00:47:05.000 --> 00:47:07.860
<v Andrew>Well, how do we know which ones should be blocking and should be async,

00:47:07.920 --> 00:47:10.220
<v Andrew>right? If it's got an await, it needs to be async.

00:47:10.720 --> 00:47:14.840
<v Andrew>But out of the hundred that maybe don't have an await, which ones are better

00:47:14.840 --> 00:47:16.340
<v Andrew>served on which thread pool?

00:47:16.540 --> 00:47:19.560
<v Andrew>And so we can use tracing and just go through and just literally flip it from

00:47:19.560 --> 00:47:22.620
<v Andrew>blocking to async and, you know, do the little minor, you know,

00:47:22.720 --> 00:47:25.360
<v Andrew>syntax conversions we need to do and just do AB,

00:47:25.680 --> 00:47:27.760
<v Andrew>you know, one to the other and go, okay, here was this one here was this one

00:47:27.760 --> 00:47:28.500
<v Andrew>oh it's faster that let's

00:47:28.500 --> 00:47:31.520
<v Andrew>put it over there you know and it makes it really nice to be able to just kind

00:47:31.520 --> 00:47:34.220
<v Andrew>of jump through all these things i did that i think it was i guess two years

00:47:34.220 --> 00:47:37.780
<v Andrew>ago now and just ran through every invocation as it was and then flip them all

00:47:37.780 --> 00:47:41.320
<v Andrew>to the other one and see which one's faster and had an mr with just everything

00:47:41.320 --> 00:47:44.940
<v Andrew>here is what came up faster with tracing and here's all my results so tracing

00:47:44.940 --> 00:47:46.480
<v Andrew>is i mean it's incredible that's.

00:47:46.480 --> 00:47:52.400
<v Matthias>A really nice use case for tracing the other thing is Tokio console which is

00:47:52.400 --> 00:47:56.120
<v Matthias>similar i don't know if you've heard about it, but it shows you

00:47:56.560 --> 00:48:01.980
<v Matthias>the state of Tokio and the futures that can execute it and how long they take,

00:48:02.860 --> 00:48:03.620
<v Matthias>Did you hear about that?

00:48:03.640 --> 00:48:07.260
<v Andrew>Yeah, Tokio console is pretty awesome as well. We have, I think Ivan actually,

00:48:07.340 --> 00:48:10.040
<v Andrew>the one that I mentioned who works on Crane, I think he also is one of the maintainers of Tokio.

00:48:10.220 --> 00:48:14.400
<v Andrew>But Ivan has helped me learn a lot. He said, I had no Rust background at all

00:48:14.400 --> 00:48:16.760
<v Andrew>when I got here. And Ivan is a Rust expert.

00:48:16.940 --> 00:48:20.380
<v Andrew>We have a few others as well. Like I mentioned, Nathan is absolutely incredible

00:48:20.380 --> 00:48:22.740
<v Andrew>just the things that they know when it comes to Rust.

00:48:22.860 --> 00:48:25.560
<v Andrew>But the last three years, I feel like I've learned more from Ivan in the last

00:48:25.560 --> 00:48:29.480
<v Andrew>three years than I learned in the prior seven or eight combined, everything that I did.

00:48:29.640 --> 00:48:35.080
<v Andrew>But yeah, showing me, When you get through and you've got the client app running

00:48:35.080 --> 00:48:39.380
<v Andrew>and it makes this request and we're dispatching this one task and then that

00:48:39.380 --> 00:48:44.380
<v Andrew>may kick off other tasks and the database access is all asynchronous and so

00:48:44.380 --> 00:48:47.680
<v Andrew>there's a queue of these requests and then there's events that get triggered

00:48:47.680 --> 00:48:49.620
<v Andrew>off of that which may trigger other async tasks.

00:48:49.620 --> 00:48:54.160
<v Andrew>And so all this stuff is going on and, you know, looking at all this stuff in

00:48:54.160 --> 00:48:59.220
<v Andrew>the console is a huge help to get visibility, like what's really happening, right?

00:48:59.340 --> 00:49:03.040
<v Andrew>You know, I see a log message just starting sync and then I see a log message just sync completed.

00:49:03.200 --> 00:49:07.420
<v Andrew>But inside of that, there was so many tasks that spun up and some were slow

00:49:07.420 --> 00:49:10.780
<v Andrew>and some were fast and so forth. And so, yeah, like you said,

00:49:10.860 --> 00:49:15.940
<v Andrew>Tokio console is really great for understanding the futures that happened.

00:49:16.480 --> 00:49:19.680
<v Andrew>You know, we use tracing, I think, more for like function calls, right?

00:49:19.760 --> 00:49:23.720
<v Andrew>Like, in our case, at least, like, we called this function, it is instrumented,

00:49:23.780 --> 00:49:25.600
<v Andrew>I see this function took 10 seconds.

00:49:25.800 --> 00:49:28.000
<v Andrew>And inside of that, this one took, well, I guess 10 would be a long time.

00:49:28.260 --> 00:49:29.380
<v Andrew>Let's say it took 100 milliseconds.

00:49:29.760 --> 00:49:32.780
<v Andrew>And inside of that, here are three others that took 10 milliseconds each, right?

00:49:32.820 --> 00:49:36.560
<v Andrew>And I get that visibility. But seeing the futures that kicked off and how long

00:49:36.560 --> 00:49:41.460
<v Andrew>those took does really give you another level of visibility into what's really happening under them.

00:49:43.220 --> 00:49:48.300
<v Matthias>If I understand correctly, you don't trace every future, but you kind of group

00:49:48.300 --> 00:49:54.420
<v Matthias>them into logical units, things that make sense to be executed together,

00:49:54.420 --> 00:49:55.920
<v Matthias>just to get some insights.

00:49:56.720 --> 00:49:59.580
<v Andrew>Yeah, and that's another thing. I mean, that's really great about the way that

00:49:59.580 --> 00:50:03.100
<v Andrew>the Tokio Tracing crate is set up is you have like the spans, right?

00:50:03.180 --> 00:50:06.560
<v Andrew>And you can create spans and enter spans and all these different things.

00:50:06.680 --> 00:50:11.180
<v Andrew>And so we use those pretty heavily. there are probably scenarios or code paths

00:50:11.180 --> 00:50:13.280
<v Andrew>where individual futures are traced.

00:50:13.580 --> 00:50:17.600
<v Andrew>But in general, you know, a lot of times it'll just be when we're going to some

00:50:17.600 --> 00:50:20.820
<v Andrew>block of code, what, you know, how long is this taking, right?

00:50:20.940 --> 00:50:24.980
<v Andrew>What do we, what is happening here? And so it's not always every single future.

00:50:25.040 --> 00:50:28.060
<v Andrew>It is, it is specifically what we're trying to instrument, right?

00:50:28.460 --> 00:50:34.040
<v Andrew>And so the, having the console as well is very helpful, but those spans make

00:50:34.040 --> 00:50:38.660
<v Andrew>it nice to have logical grouping, like you said, of different concepts.

00:50:38.960 --> 00:50:43.680
<v Andrew>And so I can see within the span, how long is the whole span taking and then

00:50:43.680 --> 00:50:47.140
<v Andrew>how long are individual blocks of that span taking, whether it's multiple futures

00:50:47.140 --> 00:50:51.320
<v Andrew>or one, I may or may not care, you know, how long the individual futures take, right?

00:50:51.380 --> 00:50:55.700
<v Andrew>Let's say I have some future that does some unit of work and that unit of work has to happen.

00:50:56.140 --> 00:50:59.700
<v Andrew>And there's no other way to do it. Maybe I don't necessarily care how long those

00:50:59.700 --> 00:51:02.060
<v Andrew>futures take, but I do care how long this block takes.

00:51:02.160 --> 00:51:05.240
<v Andrew>And that may help me, you know, determine, oh

00:51:05.240 --> 00:51:07.960
<v Andrew>this is a vec and it doesn't need to be a vec maybe now we can

00:51:07.960 --> 00:51:10.760
<v Andrew>order it and it you know with the data sets we have it makes more

00:51:10.760 --> 00:51:15.740
<v Andrew>sense to spend the upfront time hashing this or making it a btree set or something

00:51:15.740 --> 00:51:19.980
<v Andrew>like that and ordering it all so that you know most often what we're acting

00:51:19.980 --> 00:51:24.480
<v Andrew>on is we're inserting somewhere okay this gives us that that speed up on insert

00:51:24.480 --> 00:51:30.620
<v Andrew>and it's often worth you know the time to sort it or something so yeah the spans are really nice.

00:51:31.290 --> 00:51:36.730
<v Matthias>Well, some people might listen to this and say, I will never get to this level of proficiency.

00:51:37.570 --> 00:51:43.550
<v Matthias>And maybe they are curious what it feels like on a day to day to work together

00:51:43.550 --> 00:51:47.810
<v Matthias>with maybe 100 other Rust developers on the same code base.

00:51:47.930 --> 00:51:52.210
<v Matthias>What are some of the patterns that you see evolve over time?

00:51:52.210 --> 00:51:54.230
<v Matthias>What is the complexity like?

00:51:54.390 --> 00:51:57.650
<v Matthias>Is it a thing that people can teach themselves?

00:51:58.270 --> 00:52:04.090
<v Matthias>Are there any guidelines? What are some things that you would say evolved since

00:52:04.090 --> 00:52:08.250
<v Matthias>you started working with Rust that you would say you should definitely follow

00:52:08.250 --> 00:52:12.210
<v Matthias>this and these are the best practices that we see at 1Password?

00:52:12.830 --> 00:52:15.750
<v Andrew>Yeah, I mean, so I would say first and foremost, when I got here,

00:52:15.990 --> 00:52:19.190
<v Andrew>when they interviewed me, they tried to show me some Rust code because I had

00:52:19.190 --> 00:52:20.110
<v Andrew>never done it at that point.

00:52:20.610 --> 00:52:24.010
<v Andrew>They showed me some russ code and it was essentially a like

00:52:24.010 --> 00:52:26.810
<v Andrew>a number aware sort so making sure that you

00:52:26.810 --> 00:52:29.550
<v Andrew>know one password you know shows up in the right

00:52:29.550 --> 00:52:34.950
<v Andrew>order in this list or something like that right and i could not get through

00:52:34.950 --> 00:52:39.210
<v Andrew>it at the time like i i wasn't i was generally following like it's trying to

00:52:39.210 --> 00:52:42.410
<v Andrew>do this but it was using these chunks and i didn't really know what that was

00:52:42.410 --> 00:52:45.490
<v Andrew>and then it did a little bit of memory stuff and i had never touched memory

00:52:45.490 --> 00:52:48.410
<v Andrew>coming from Column TypeScript. So I had no clue what was going on.

00:52:49.190 --> 00:52:52.130
<v Andrew>And luckily they hired me anyway. I don't know why, but they did.

00:52:52.350 --> 00:52:58.050
<v Andrew>And so, you know, in the last three years is everything that I have learned

00:52:58.050 --> 00:53:01.070
<v Andrew>when it comes to Rust, right? That's the only time I've ever seen it.

00:53:01.670 --> 00:53:05.930
<v Andrew>And so it's definitely something you can pick up. I have not done it alone.

00:53:06.130 --> 00:53:12.050
<v Andrew>Right. I have had multiple teachers who are absolutely incredible when it comes to Rust.

00:53:12.290 --> 00:53:15.650
<v Andrew>And like I mentioned, we had that Rust study group, which is something that

00:53:15.650 --> 00:53:20.490
<v Andrew>I took part in in the first iteration when my co-workers Tanner had set it up.

00:53:20.790 --> 00:53:25.170
<v Andrew>And then it had been so massively helpful to me that I ended up taking it over

00:53:25.170 --> 00:53:28.310
<v Andrew>and running the second iteration of it. And now, you know, we've grown this

00:53:28.310 --> 00:53:29.390
<v Andrew>into this whole Rust guild.

00:53:29.730 --> 00:53:32.890
<v Andrew>So all that to say, anytime you can learn from other people,

00:53:32.890 --> 00:53:37.150
<v Andrew>it will be massively helpful, I think, especially in Rust, because you may be

00:53:37.150 --> 00:53:40.790
<v Andrew>coming from languages where the concepts just don't exist, right?

00:53:40.790 --> 00:53:43.810
<v Andrew>And you're trying to learn all these brand new things.

00:53:43.970 --> 00:53:47.010
<v Andrew>So that's a huge help. You can learn it on your own.

00:53:47.230 --> 00:53:49.970
<v Andrew>There are a lot of good resources out there now. One of the things that's been

00:53:49.970 --> 00:53:53.530
<v Andrew>really incredible in the Rust community is there's a lot of the books that are

00:53:53.530 --> 00:53:56.830
<v Andrew>amazing books in Rust that are just free, right?

00:53:57.030 --> 00:54:00.010
<v Andrew>Like the Rust Atomics and Locks book from Mara is free.

00:54:00.190 --> 00:54:02.270
<v Andrew>You can get it on the internet, you know, also buy it if you can.

00:54:02.270 --> 00:54:05.950
<v Andrew>But there's so many of these things. The Rust book itself is really great.

00:54:06.330 --> 00:54:10.710
<v Andrew>One of the hardest things to get from, you know, zero to productive,

00:54:10.750 --> 00:54:14.630
<v Andrew>I found, actually, I spoke at RustConf a bit about this this past year.

00:54:15.030 --> 00:54:21.070
<v Andrew>What we found teaching people is the issue is not learning the Rust syntax.

00:54:21.550 --> 00:54:26.050
<v Andrew>It tends to be that Rust, good Rust, requires a bit of engineering knowledge.

00:54:26.330 --> 00:54:29.310
<v Andrew>And that's not maybe engineering knowledge that the book is covered,

00:54:29.670 --> 00:54:31.690
<v Andrew>right? Right. And you and I talked about this a little bit, right?

00:54:31.730 --> 00:54:33.730
<v Andrew>Like, how do I know when I make a new crate?

00:54:34.010 --> 00:54:36.270
<v Andrew>Well, the Rust book doesn't, I mean, it's not going to tell you that that's

00:54:36.270 --> 00:54:39.750
<v Andrew>not really a Rust problem, right? That's a, your code base problem.

00:54:39.930 --> 00:54:40.950
<v Andrew>It's an engineering problem.

00:54:41.390 --> 00:54:46.350
<v Andrew>It tends to expose your, you know, lack of knowledge in other areas,

00:54:46.370 --> 00:54:48.790
<v Andrew>which again, I also have no computer science background.

00:54:48.950 --> 00:54:51.830
<v Andrew>I was a construction worker before and I worked at, you know,

00:54:51.930 --> 00:54:56.990
<v Andrew>a drugstore before I became a developer. So I had no idea about binary trees

00:54:56.990 --> 00:54:59.130
<v Andrew>and sorting. I still really don't to be honest but.

00:55:00.730 --> 00:55:05.890
<v Andrew>Rust has a way of bringing those things out in you, which is hard at first,

00:55:06.170 --> 00:55:10.250
<v Andrew>but it also helps you to shore them up because you see where your gaps are.

00:55:10.410 --> 00:55:12.890
<v Andrew>And there is so much information out there that you can learn from,

00:55:12.950 --> 00:55:15.630
<v Andrew>but it does take time and not everybody has time.

00:55:16.190 --> 00:55:19.710
<v Andrew>So that can be a bit difficult. But anyway, that's a long way to say you can

00:55:19.710 --> 00:55:22.310
<v Andrew>learn on your own, but learn from others wherever you can.

00:55:22.450 --> 00:55:26.490
<v Andrew>Look at code, try and understand it. And then getting into patterns,

00:55:26.490 --> 00:55:31.830
<v Andrew>a lot of it has been thinking about two things, I think, heavily.

00:55:32.490 --> 00:55:37.430
<v Andrew>What, like, why are you abstracting something? Because abstractions are really big in Rust, right?

00:55:37.530 --> 00:55:41.370
<v Andrew>You know, like I said, we use RusQlite, but we wrap every transaction so that

00:55:41.370 --> 00:55:44.290
<v Andrew>we add some counter that we want to follow in debug mode.

00:55:44.430 --> 00:55:50.070
<v Andrew>And then we have to wrap, you know, maybe the call to save to increment that counter, right?

00:55:50.130 --> 00:55:53.310
<v Andrew>To insert a row to increment that counter. So you end up with abstractions on

00:55:53.310 --> 00:55:54.590
<v Andrew>abstractions on abstractions.

00:55:54.770 --> 00:55:59.250
<v Andrew>And if you don't know what you're looking at, those are even harder to follow.

00:55:59.830 --> 00:56:05.210
<v Andrew>So making sure that your abstractions make sense. And if they have to be complicated

00:56:05.210 --> 00:56:07.130
<v Andrew>for any reason, document them really well.

00:56:07.670 --> 00:56:10.690
<v Andrew>That's, I mean, critical. Even if you're the one that's going to come back and

00:56:10.690 --> 00:56:12.770
<v Andrew>read it, make sure you know why you made this abstraction.

00:56:13.270 --> 00:56:20.150
<v Andrew>That's really important. And then the second thing I think is trying to make

00:56:20.150 --> 00:56:25.870
<v Andrew>sure that you are not driving performance at the cost of simplicity, right?

00:56:26.050 --> 00:56:29.650
<v Andrew>You know, if I look at this and it's like, well, technically the fastest way

00:56:29.650 --> 00:56:33.050
<v Andrew>is, you know, creating this one shot channel that watches. And once that gets

00:56:33.050 --> 00:56:36.310
<v Andrew>something, it kicks off a receiving loop on a receiver. And then it does this look up.

00:56:36.710 --> 00:56:41.010
<v Andrew>If you can do that with a Vec.Find or whatever, just do it.

00:56:41.010 --> 00:56:44.510
<v Andrew>Like, you know, unless you really, really need to eke out that performance,

00:56:44.710 --> 00:56:48.670
<v Andrew>keep things simple where you can, you know, you'll get to places like 1Password

00:56:48.670 --> 00:56:53.750
<v Andrew>where it's like, yeah, we have to do all this zeroizing allocation and we can't log dynamic strings.

00:56:53.930 --> 00:56:55.970
<v Andrew>There's a whole loggable trait

00:56:55.970 --> 00:56:59.410
<v Andrew>in this whole process it has to go through to make it, you know, work.

00:57:00.210 --> 00:57:04.990
<v Andrew>But that's not, you know, you don't need to understand the internals of that every time, right?

00:57:05.130 --> 00:57:09.150
<v Andrew>You know, just understand what you have to, keep things simple wherever you can.

00:57:09.350 --> 00:57:13.270
<v Andrew>Even here, you know, we try to make sure that we're holding each other accountable

00:57:13.270 --> 00:57:14.990
<v Andrew>for like, it doesn't need to be that hard.

00:57:15.370 --> 00:57:18.070
<v Andrew>Keep it simple. Yes, it's technically faster this other way.

00:57:18.190 --> 00:57:21.090
<v Andrew>We don't have realistic data sets that need that speed up.

00:57:21.370 --> 00:57:24.490
<v Andrew>You know, when we get there, we'll do that. Yes, in the future,

00:57:24.650 --> 00:57:26.750
<v Andrew>we might have those and we might see a slowdown. And guess what,

00:57:26.810 --> 00:57:27.890
<v Andrew>when that happens, we'll fix it.

00:57:28.150 --> 00:57:32.930
<v Andrew>And so forth. So I think a lot of it just comes back to Rust is complex.

00:57:33.370 --> 00:57:37.530
<v Andrew>Keep it simple wherever you can. Learn everything that you come across,

00:57:37.530 --> 00:57:41.210
<v Andrew>but, you know, take it one thing at a time. You will eventually get there.

00:57:41.490 --> 00:57:45.610
<v Andrew>And that pattern is true all the way up into 1Password where things are complex.

00:57:45.930 --> 00:57:49.490
<v Andrew>Keep it simple where you can and then learn things one at a time when they can't be simple.

00:57:50.210 --> 00:57:58.190
<v Matthias>I can totally get behind that. Makes a lot of sense. It matches with what I see out there.

00:57:58.190 --> 00:57:59.070
<v Andrew>Yeah

00:57:59.080 --> 00:58:00.440
<v Matthias>We're

00:58:00.430 --> 00:58:07.750
<v Matthias>getting close to the end and traditionally the final question is what's your

00:58:07.750 --> 00:58:09.770
<v Matthias>statement to the rust community.

00:58:09.770 --> 00:58:16.070
<v Andrew>Uh yeah so i mean i think one of the you know there there is some amount of

00:58:16.070 --> 00:58:19.570
<v Andrew>like thank you to the rust community for keeping things open right like i said

00:58:19.570 --> 00:58:23.150
<v Andrew>there's so many books out there and the rust book and the brown version of the

00:58:23.150 --> 00:58:25.570
<v Andrew>rust book is is amazing with the quizzes and things.

00:58:25.730 --> 00:58:30.410
<v Andrew>That's all great. I think we also need to continue to or increase how often

00:58:30.410 --> 00:58:32.070
<v Andrew>we relate to people, right?

00:58:32.190 --> 00:58:36.310
<v Andrew>Meet people where they're coming from, understanding, you know,

00:58:36.390 --> 00:58:37.330
<v Andrew>what they do and don't know.

00:58:37.650 --> 00:58:40.990
<v Andrew>Obviously, with someone coming from my background, that was really critical

00:58:40.990 --> 00:58:45.970
<v Andrew>that people here did that, you know, and there's a lot of, you know,

00:58:46.190 --> 00:58:49.070
<v Andrew>acronyms or computer science knowledge.

00:58:49.070 --> 00:58:52.730
<v Andrew>And there's so many people in Rust that are so smart, it can be difficult,

00:58:52.770 --> 00:58:55.970
<v Andrew>you know, sometimes coming in and going, you know, they're like,

00:58:56.030 --> 00:58:56.990
<v Andrew>well, you should make a beat reset.

00:58:57.370 --> 00:59:01.370
<v Andrew>Why? What? I don't understand why that matters, you know, and so forth.

00:59:01.370 --> 00:59:02.930
<v Andrew>And, and just a lot of little things, right.

00:59:03.310 --> 00:59:06.750
<v Andrew>Understanding how did you learn what you learned, you know? And it's like,

00:59:06.810 --> 00:59:08.810
<v Andrew>oh, well, in my OS class, we did this.

00:59:08.930 --> 00:59:12.230
<v Andrew>It's like, oh, I didn't have, you know, so there's, there's a lot of that,

00:59:12.390 --> 00:59:18.510
<v Andrew>that I think we can continue to improve on just finding paths to not just go

00:59:18.510 --> 00:59:21.890
<v Andrew>from zero to rust, which I think we've started on, or we have a really good

00:59:21.890 --> 00:59:26.670
<v Andrew>path to with the Rust book or to go from Haskell to Rust or C++ to Rust or whatever, right?

00:59:27.170 --> 00:59:30.830
<v Andrew>I think there is a missing middle gap of how do you go from TypeScript to Rust

00:59:30.830 --> 00:59:34.170
<v Andrew>or this or that where it's like, I understand variables. I understand all that.

00:59:34.170 --> 00:59:36.950
<v Andrew>So the whole beginning of the Rust book feels boring and I'm getting lost.

00:59:37.630 --> 00:59:41.310
<v Andrew>And then we go straight into memory or, you know, async and really how async

00:59:41.310 --> 00:59:43.930
<v Andrew>works. And there are these missing pieces sometimes.

00:59:44.290 --> 00:59:48.830
<v Andrew>And so I think finding practical applications of Rust is really critical.

00:59:49.110 --> 00:59:53.090
<v Andrew>One of the big things I push for a lot within 1Password in the Rust study group

00:59:53.090 --> 00:59:55.870
<v Andrew>is how can we build one cohesive thing?

00:59:55.870 --> 01:00:00.090
<v Andrew>So it's not learning all the Rust concepts one by one, and it's not getting

01:00:00.090 --> 01:00:02.830
<v Andrew>straight into the 1Password code base, which is terrifying.

01:00:02.830 --> 01:00:05.670
<v Andrew>It is how do I learn these concepts and

01:00:05.670 --> 01:00:08.370
<v Andrew>apply them to one thing that I have now built and now I

01:00:08.370 --> 01:00:11.350
<v Andrew>understand why you know

01:00:11.350 --> 01:00:14.210
<v Andrew>a Tokio Tokio mutex and

01:00:14.210 --> 01:00:17.430
<v Andrew>a standard mutex they're different and why it matters that they're different

01:00:17.430 --> 01:00:21.670
<v Andrew>and you might need both in different cases right I've seen it in use and now

01:00:21.670 --> 01:00:26.430
<v Andrew>I can understand you know thread boundaries or whatever it might be or weight

01:00:26.430 --> 01:00:30.550
<v Andrew>boundaries I should say and stuff starts to to make sense to you because you've

01:00:30.550 --> 01:00:32.110
<v Andrew>had a real use case for it,

01:00:32.350 --> 01:00:34.990
<v Andrew>not just what it was when I learned it, right?

01:00:35.050 --> 01:00:38.630
<v Andrew>There's things like rustlings, which is incredible for exercise-based learning.

01:00:39.010 --> 01:00:43.090
<v Andrew>But at the end, I didn't see exercise six mesh with exercise 10.

01:00:43.090 --> 01:00:45.990
<v Andrew>And now I understand that those are two maybe related things.

01:00:46.130 --> 01:00:50.070
<v Andrew>And so a lot of people say, right, build stuff. That is the greatest way.

01:00:50.230 --> 01:00:55.010
<v Andrew>But that's not realistic for everyone. I was working before I became a developer.

01:00:55.190 --> 01:00:59.490
<v Andrew>I was working 50, 60 hours a week and then you know, coming home and trying

01:00:59.490 --> 01:01:01.790
<v Andrew>to keep, you know, my apartment clean and all these things.

01:01:01.970 --> 01:01:04.350
<v Andrew>And I did not have that much time left to just build things.

01:01:04.410 --> 01:01:08.230
<v Andrew>It took me a year or more just to try and figure out, you know.

01:01:08.890 --> 01:01:10.510
<v Andrew>React or whatever it was at the time.

01:01:11.290 --> 01:01:15.310
<v Andrew>And if it were Rust, I was trying to learn, I have no idea how long it would have taken, you know.

01:01:15.470 --> 01:01:22.010
<v Andrew>And so I think just finding ways to bridge those gaps and make cohesive learnings

01:01:22.010 --> 01:01:25.690
<v Andrew>that make concepts actually make sense holistically.

01:01:25.930 --> 01:01:30.690
<v Andrew>I think that's a really, really huge area that will help a lot of people close

01:01:30.690 --> 01:01:33.250
<v Andrew>the gap of Rust, which will help Rust adoption.

01:01:33.490 --> 01:01:36.250
<v Andrew>You know, I've seen that even here, where it's like, we may have something we

01:01:36.250 --> 01:01:41.250
<v Andrew>build and go because ramping that team up on Rust is just not feasible in the timeframe we have.

01:01:41.550 --> 01:01:45.150
<v Andrew>Well, if there's better resources to get from Go to Rust, that becomes a non-issue,

01:01:45.390 --> 01:01:49.270
<v Andrew>you know, and I think we'll see Rust grow the more we are open to bringing people

01:01:49.270 --> 01:01:52.010
<v Andrew>in from more intermediate spaces into Rust.

01:01:52.510 --> 01:01:57.930
<v Matthias>What an amazing and insightful answer. I can really get behind it.

01:01:58.050 --> 01:02:00.410
<v Matthias>I can fully relate to that.

01:02:00.970 --> 01:02:05.070
<v Matthias>Andrew, thanks so much for being on the podcast today.

01:02:05.450 --> 01:02:08.210
<v Andrew>Yeah, thank you very much for having me. I really, really enjoyed it.

01:02:08.750 --> 01:02:12.410
<v Matthias>Rust in Production is a podcast by corrode. It is hosted by me,

01:02:12.710 --> 01:02:16.530
<v Matthias>Matthias Endler, and produced by Simon Brüggen. For show notes,

01:02:16.710 --> 01:02:20.670
<v Matthias>transcripts, and to learn more about how we can help your company make the most

01:02:20.670 --> 01:02:22.810
<v Matthias>of Rust, visit corrode.dev.

01:02:23.010 --> 01:02:25.290
<v Matthias>Thanks for listening to Rust in Production.