jhpratt,
@jhpratt@mastodon.social avatar

In , how can I leverage the type system to enforce that one object originates from another? Even requiring the lifetime be exact ('a: 'b and 'b: 'a) wouldn't work.

Basically, I have struct Bytes<'a>(&'a [u8]); and want to prevent someone from creating an arbitrary value that can be swapped in for the correct one. Yet at the same time it is essential that arbitrary values can be created.

Basically I'm trying to enforce my own version of provenance…

  • All
  • Subscribed
  • Moderated
  • Favorites
  • rust
  • modclub
  • DreamBathrooms
  • InstantRegret
  • magazineikmin
  • everett
  • Youngstown
  • mdbf
  • Durango
  • slotface
  • rosin
  • thenastyranch
  • kavyap
  • GTA5RPClips
  • cubers
  • JUstTest
  • tester
  • osvaldo12
  • tacticalgear
  • ethstaker
  • ngwrru68w68
  • khanakhh
  • Leos
  • normalnudes
  • cisconetworking
  • provamag3
  • megavids
  • anitta
  • lostlight
  • All magazines