Skip to content

sp3d/rs-rangedtype

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

rs-rangedtype: ranged types (a la vhdl) for rust

This implementation is still very rudimentary, but the useful parts are the procedural macro which generates the enumerations and the macro magic to generate impls. The checked arithmetic operations return None in case of over/underflow, and the regular operations panic! the task with a descriptive message.

Bugs:
	- This is the simplest implementation that might possibly work. It is based on enums, and large numbers of variants can bloat compile times or overflow the compiler's stack.
	- Only the Checked{Add, Sub, Mul, Div} traits are implemented yet; other operations require a manual trip through int conversions.
	- Types prescribe, not track, ranges. The latter (like in ATS) would require type wrangling that is difficult or impossible in Rust.

Nonetheless, hopefully some parts of this project will be found useful or will make it a little easier to write even safer programs in Rust.

Released under the WTFPL.

About

ranged types (a la vhdl) for rust

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published