CommunityNews
Structural typing in Rust
Have you ever wanted to write a structurally typed function in Rust? Do you spend a lot of time and effort getting your Rust
structs just so , and want to DRY-out data access for common field paths without declaring a newtraitand implementing it for each struct (let’s say,CatandDogboth have aname: Stringfield)? If so, read on.
Read in full here:
This thread was posted by one of our members via one of our news source trackers.
Most Liked
OvermindDL1
What this article is talking about isn’t structural typing, it’s nominal row typing. Rust already has a structural type, it’s the Tuple, but the examples and such they show is about a nominal row type. Very bad set of misnaming there… >.>
And yes, row typing is fun, though often not but sometimes can be zero-cost. ^.^
Popular Backend topics
Other popular topics
Categories:
Sub Categories:
Popular Portals
- /elixir
- /rust
- /ruby
- /wasm
- /erlang
- /phoenix
- /keyboards
- /python
- /js
- /rails
- /security
- /go
- /swift
- /vim
- /clojure
- /emacs
- /haskell
- /java
- /svelte
- /onivim
- /typescript
- /kotlin
- /c-plus-plus
- /crystal
- /tailwind
- /react
- /gleam
- /ocaml
- /flutter
- /elm
- /vscode
- /ash
- /html
- /opensuse
- /centos
- /php
- /deepseek
- /zig
- /scala
- /lisp
- /textmate
- /sublime-text
- /react-native
- /nixos
- /debian
- /agda
- /kubuntu
- /arch-linux
- /django
- /deno
- /revery
- /ubuntu
- /nodejs
- /manjaro
- /spring
- /diversity
- /lua
- /julia
- /c
- /slackware







