File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 11# Changelog
22
3+ ## v0.13.0 (May 20, 2021)
4+
5+ - Update darling to 2018 edition [ #129 ] ( https://github.com/TedDriggs/darling/pull/129 )
6+ - Error on duplicate fields in ` #[darling(...)] ` attributes [ #130 ] ( https://github.com/TedDriggs/darling/pull/130 )
7+ - Impl ` Copy ` for ` SpannedValue<T: Copy> `
8+ - Add ` SpannedValue::map_ref `
9+
310## v0.13.0-beta (April 20, 2021)
411
512- Update darling to 2018 edition [ #129 ] ( https://github.com/TedDriggs/darling/pull/129 )
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ use crate::{
1919/// but the user may not always explicitly set those options in their source code.
2020/// In this case, using `Default::default()` will create an instance which points
2121/// to `Span::call_site()`.
22- #[ derive( Debug , Clone ) ]
22+ #[ derive( Debug , Clone , Copy ) ]
2323pub struct SpannedValue < T > {
2424 value : T ,
2525 span : Span ,
@@ -34,6 +34,11 @@ impl<T> SpannedValue<T> {
3434 pub fn span ( & self ) -> Span {
3535 self . span
3636 }
37+
38+ /// Apply a mapping function to a reference to the spanned value.
39+ pub fn map_ref < U > ( & self , map_fn : impl FnOnce ( & T ) -> U ) -> SpannedValue < U > {
40+ SpannedValue :: new ( map_fn ( & self . value ) , self . span )
41+ }
3742}
3843
3944impl < T : Default > Default for SpannedValue < T > {
You can’t perform that action at this time.
0 commit comments