Skip to content

tfpk/require_lifetimes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Require Lifetimes

Require Lifetimes is a crate which provides the #[require_lifetimes] annotation. This annotation ensures that the annotated function must have lifetimes for every reference in its signature. In other words, it forces the author to not rely on lifetime elision for a given function. It also stops the author from using the anonymous lifetime '_.

The intent behind this crate is to force the user to actually understand lifetimes. This will be useful when teaching students how lifetimes work, or when trying to write explanatory material. This crate should not be used in production applications, as adding unnecessary lifetimes is an anti-pattern.

Examples

See the ui_tests folder for examples of programs with this annotation. Files ending in _err.rs_ have a corresponding .stderr that shows what their output will be.

About

A proc-macro to force rust authors to include lifetimes in their functions.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages