An exploration into various ways optional trait methods can be implemented in Rust.
- The
completefolder contains a big-blob of example code which shows off the various techniques.- The code is a bit of a mess, but it's done to make the outputted assembly as easy to analyze as possible.
- it's a
#![no_std]binary which links withlibc - doesn't use any of rust's formatting code.
- makes extensive use of
cfg_ifto remove any dead code
- it's a
- The
godbolt.shscript outputs the crate as a single file that can be copy/pasted into godbolt.orggodbolt.shtakes two arguments: theTargetimplementation (i.e:basic,advanced,faulty), and optional trait method implementation (i.e:option,fn,traits).
- The code is a bit of a mess, but it's done to make the outputted assembly as easy to analyze as possible.
writeup.mdcontains the draft version of a writeup discussing the various techniques